From e2052c771dbc332d0e12cef5213202c0ca3adc82 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Jul 2014 23:17:14 -0400 Subject: [PATCH] added new device profiles --- .../Playback/BaseStreamingService.cs | 24 +- .../Playback/Hls/BaseHlsService.cs | 5 +- .../HttpClientManager/HttpClientManager.cs | 22 +- MediaBrowser.Common/Net/HttpRequestOptions.cs | 1 - MediaBrowser.Dlna/DlnaManager.cs | 6 +- MediaBrowser.Dlna/MediaBrowser.Dlna.csproj | 6 + MediaBrowser.Dlna/Profiles/AndroidProfile.cs | 178 ++++++ MediaBrowser.Dlna/Profiles/DefaultProfile.cs | 1 + .../Profiles/PanasonicVieraProfile.cs | 9 + .../Profiles/SamsungSmartTvProfile.cs | 8 + .../Profiles/Windows81Profile.cs | 14 +- .../Profiles/WindowsPhoneProfile.cs | 15 +- MediaBrowser.Dlna/Profiles/Xml/Android.xml | 69 +++ MediaBrowser.Dlna/Profiles/Xml/Default.xml | 6 +- MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml | 6 +- .../Profiles/Xml/LG Smart TV.xml | 8 +- .../Profiles/Xml/Linksys DMA2100.xml | 6 +- .../Profiles/Xml/MediaMonkey.xml | 6 +- .../Profiles/Xml/Panasonic Viera.xml | 12 +- .../Profiles/Xml/Samsung Smart TV.xml | 12 +- .../Profiles/Xml/Sony Blu-ray Player 2013.xml | 8 +- .../Profiles/Xml/Sony Blu-ray Player.xml | 8 +- .../Profiles/Xml/Sony Bravia (2010).xml | 8 +- .../Profiles/Xml/Sony Bravia (2011).xml | 8 +- .../Profiles/Xml/Sony Bravia (2012).xml | 8 +- .../Profiles/Xml/Sony Bravia (2013).xml | 8 +- .../Profiles/Xml/Sony PlayStation 3.xml | 8 +- MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml | 8 +- .../Profiles/Xml/Windows 8 RT.xml | 66 +++ .../Profiles/Xml/Windows Phone.xml | 80 +++ MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml | 8 +- MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml | 6 +- MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml | 6 +- .../MediaBrowser.Model.Portable.csproj | 3 + .../MediaBrowser.Model.net35.csproj | 3 + MediaBrowser.Model/Dlna/AudioOptions.cs | 6 + MediaBrowser.Model/Dlna/DeviceProfile.cs | 6 + MediaBrowser.Model/Dlna/StreamBuilder.cs | 4 +- MediaBrowser.Model/Dlna/SubtitleProfile.cs | 8 + MediaBrowser.Model/Dlna/TranscodingProfile.cs | 9 + MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + .../MediaInfo/SubtitleFormat.cs | 1 + .../Channels/ChannelManager.cs | 2 +- .../Localization/JavaScript/ar.json | 86 ++- .../Localization/JavaScript/ca.json | 86 ++- .../Localization/JavaScript/cs.json | 86 ++- .../Localization/JavaScript/da.json | 86 ++- .../Localization/JavaScript/de.json | 86 ++- .../Localization/JavaScript/el.json | 86 ++- .../Localization/JavaScript/en_GB.json | 86 ++- .../Localization/JavaScript/en_US.json | 86 ++- .../Localization/JavaScript/es.json | 86 ++- .../Localization/JavaScript/es_MX.json | 86 ++- .../Localization/JavaScript/fr.json | 86 ++- .../Localization/JavaScript/he.json | 86 ++- .../Localization/JavaScript/it.json | 86 ++- .../Localization/JavaScript/javascript.json | 559 ++++++++++-------- .../Localization/JavaScript/kk.json | 86 ++- .../Localization/JavaScript/ms.json | 86 ++- .../Localization/JavaScript/nb.json | 86 ++- .../Localization/JavaScript/nl.json | 86 ++- .../Localization/JavaScript/pl.json | 86 ++- .../Localization/JavaScript/pt_BR.json | 88 ++- .../Localization/JavaScript/pt_PT.json | 86 ++- .../Localization/JavaScript/ru.json | 86 ++- .../Localization/JavaScript/sv.json | 112 +++- .../Localization/JavaScript/vi.json | 86 ++- .../Localization/JavaScript/zh_TW.json | 86 ++- .../Localization/Server/ar.json | 7 +- .../Localization/Server/ca.json | 7 +- .../Localization/Server/cs.json | 9 +- .../Localization/Server/da.json | 7 +- .../Localization/Server/de.json | 11 +- .../Localization/Server/el.json | 7 +- .../Localization/Server/en_GB.json | 7 +- .../Localization/Server/en_US.json | 7 +- .../Localization/Server/es.json | 5 +- .../Localization/Server/es_MX.json | 7 +- .../Localization/Server/fr.json | 13 +- .../Localization/Server/he.json | 13 +- .../Localization/Server/it.json | 9 +- .../Localization/Server/kk.json | 13 +- .../Localization/Server/ms.json | 7 +- .../Localization/Server/nb.json | 7 +- .../Localization/Server/nl.json | 7 +- .../Localization/Server/pl.json | 7 +- .../Localization/Server/pt_BR.json | 9 +- .../Localization/Server/pt_PT.json | 11 +- .../Localization/Server/ru.json | 11 +- .../Localization/Server/server.json | 4 +- .../Localization/Server/sv.json | 43 +- .../Localization/Server/vi.json | 7 +- .../Localization/Server/zh_TW.json | 9 +- .../MediaBrowser.WebDashboard.csproj | 3 + 94 files changed, 3031 insertions(+), 554 deletions(-) create mode 100644 MediaBrowser.Dlna/Profiles/AndroidProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/Xml/Android.xml create mode 100644 MediaBrowser.Dlna/Profiles/Xml/Windows 8 RT.xml create mode 100644 MediaBrowser.Dlna/Profiles/Xml/Windows Phone.xml create mode 100644 MediaBrowser.Model/Dlna/SubtitleProfile.cs diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 9609d8c290..5cae4c3f7f 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -607,7 +607,7 @@ namespace MediaBrowser.Api.Playback } } - // TODO: Perhaps also use original_size=1920x800 + // TODO: Perhaps also use original_size=1920x800 ?? return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB", subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"), charsetParam, @@ -817,7 +817,7 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Path; state.InputProtocol = MediaProtocol.File; - await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false); + await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); } else if (!string.IsNullOrEmpty(streamInfo.Url)) { @@ -838,7 +838,7 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Path; state.InputProtocol = MediaProtocol.File; - await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false); + await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); } else if (!string.IsNullOrEmpty(streamInfo.Url)) { @@ -943,19 +943,6 @@ namespace MediaBrowser.Api.Playback { await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false); } - - // Allow a small amount of time to buffer a little - // But not with HLS because it already has it's own wait - if (state.IsInputVideo && TranscodingJobType != TranscodingJobType.Hls) - { - await Task.Delay(500, cancellationTokenSource.Token).ConfigureAwait(false); - } - - // This is arbitrary, but add a little buffer time when internet streaming - if (state.InputProtocol != MediaProtocol.File) - { - await Task.Delay(2500, cancellationTokenSource.Token).ConfigureAwait(false); - } } private async void StartStreamingLog(StreamState state, Stream source, Stream target) @@ -1458,11 +1445,6 @@ namespace MediaBrowser.Api.Playback state.RunTimeTicks = recording.RunTimeTicks; - if (recording.RecordingInfo.Status == RecordingStatus.InProgress) - { - await Task.Delay(1000, cancellationToken).ConfigureAwait(false); - } - state.OutputAudioSync = "1000"; state.InputVideoSync = "-1"; state.InputAudioSync = "1"; diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 8eff75533e..317c4455a6 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -104,7 +104,10 @@ namespace MediaBrowser.Api.Playback.Hls } else { - await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, p => true, false).ConfigureAwait(false); + if (!string.IsNullOrWhiteSpace(state.Request.DeviceId)) + { + await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, p => true, false).ConfigureAwait(false); + } // If the playlist doesn't already exist, startup ffmpeg try diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 5efb39cbc0..11a5cdf083 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -107,7 +107,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager return client; } - private PropertyInfo _httpBehaviorPropertyInfo; private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) { var request = (HttpWebRequest)WebRequest.Create(options.Url); @@ -118,7 +117,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); - request.KeepAlive = options.EnableKeepAlive; + if (options.EnableKeepAlive) + { + request.KeepAlive = true; + } + request.Method = method; request.Pipelined = true; request.Timeout = 20000; @@ -133,21 +136,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Referer = options.Referer; } -#if !__MonoCS__ - if (options.EnableKeepAlive) - { - // This is a hack to prevent KeepAlive from getting disabled internally by the HttpWebRequest - // May need to remove this for mono - var sp = request.ServicePoint; - if (_httpBehaviorPropertyInfo == null) - { - _httpBehaviorPropertyInfo = sp.GetType().GetProperty("HttpBehaviour", BindingFlags.Instance | BindingFlags.NonPublic); - } - - _httpBehaviorPropertyInfo.SetValue(sp, (byte)0, null); - } -#endif - return request; } diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 3cba84334d..a2b42dedbe 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -106,7 +106,6 @@ namespace MediaBrowser.Common.Net { EnableHttpCompression = true; BufferContent = true; - EnableKeepAlive = true; RequestHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 21476c5d9f..048a7a0cf8 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Dlna _logger = logger; _jsonSerializer = jsonSerializer; - //DumpProfiles(); + DumpProfiles(); } public IEnumerable GetProfiles() @@ -75,6 +75,10 @@ namespace MediaBrowser.Dlna new LgTvProfile(), new Foobar2000Profile(), new MediaMonkeyProfile(), + new Windows81Profile(), + //new WindowsMediaCenterProfile(), + new WindowsPhoneProfile(), + new AndroidProfile(), new DefaultProfile() }; diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index 94f9c03919..e3a5289f51 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -82,6 +82,7 @@ + @@ -174,6 +175,11 @@ + + + + +