diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index fb6864f154..e23cb89519 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -770,12 +770,12 @@ namespace MediaBrowser.Model.Dlna { return profile; } - } - // For sync we can handle the longer extraction times - if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream) - { - return profile; + // For sync we can handle the longer extraction times + if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream) + { + return profile; + } } } } diff --git a/MediaBrowser.Model/Dlna/SubtitleProfile.cs b/MediaBrowser.Model/Dlna/SubtitleProfile.cs index 1795c374a4..0723de222b 100644 --- a/MediaBrowser.Model/Dlna/SubtitleProfile.cs +++ b/MediaBrowser.Model/Dlna/SubtitleProfile.cs @@ -28,15 +28,20 @@ namespace MediaBrowser.Model.Dlna return list; } - public bool SupportsLanguage(string language) + public bool SupportsLanguage(string subLanguage) { - if (string.IsNullOrEmpty(language)) + if (string.IsNullOrEmpty(Language)) { - language = "und"; + return true; + } + + if (string.IsNullOrEmpty(subLanguage)) + { + subLanguage = "und"; } List languages = GetLanguages(); - return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language); + return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage); } } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs index 2f23aad1b4..9694965c77 100644 --- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs +++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs @@ -105,6 +105,18 @@ namespace MediaBrowser.Server.Implementations.Library return GetMediaStreamsForItem(list); } + private int GetMaxAllowedBitrateForExternalSubtitleStream() + { + // This is abitrary but at some point it becomes too slow to extract subtitles on the fly + // We need to learn more about when this is the case vs. when it isn't + if (Environment.ProcessorCount >= 8) + { + return 10000000; + } + + return 2000000; + } + private IEnumerable GetMediaStreamsForItem(IEnumerable streams) { var list = streams.ToList(); @@ -117,9 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library { var videoStream = list.FirstOrDefault(i => i.Type == MediaStreamType.Video); - // This is abitrary but at some point it becomes too slow to extract subtitles on the fly - // We need to learn more about when this is the case vs. when it isn't - const int maxAllowedBitrateForExternalSubtitleStream = 10000000; + int maxAllowedBitrateForExternalSubtitleStream = GetMaxAllowedBitrateForExternalSubtitleStream(); var videoBitrate = videoStream == null ? maxAllowedBitrateForExternalSubtitleStream : videoStream.BitRate ?? maxAllowedBitrateForExternalSubtitleStream; diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index d0ceb9e09b..8d22dd6bdc 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -13,6 +13,12 @@ namespace MediaBrowser.Server.Mono.Native { public abstract class BaseMonoApp : INativeApp { + protected StartupOptions StartupOptions { get; private set; } + protected BaseMonoApp(StartupOptions startupOptions) + { + StartupOptions = startupOptions; + } + /// /// Shutdowns this instance. /// @@ -111,7 +117,15 @@ namespace MediaBrowser.Server.Mono.Native public bool SupportsLibraryMonitor { - get { return false; } + get + { + if (StartupOptions.ContainsOption("-allowrealtimemonitor")) + { + return true; + } + + return false; + } } public void ConfigureAutoRun(bool autorun) @@ -170,6 +184,7 @@ namespace MediaBrowser.Server.Mono.Native } private Uname _unixName; + private Uname GetUnixName() { if (_unixName == null) diff --git a/MediaBrowser.Server.Mono/Native/NativeApp.cs b/MediaBrowser.Server.Mono/Native/NativeApp.cs index cd1e78e354..500555647f 100644 --- a/MediaBrowser.Server.Mono/Native/NativeApp.cs +++ b/MediaBrowser.Server.Mono/Native/NativeApp.cs @@ -7,6 +7,11 @@ namespace MediaBrowser.Server.Mono.Native /// internal class NativeApp : BaseMonoApp { + public NativeApp(StartupOptions startupOptions) + : base(startupOptions) + { + } + /// /// Shutdowns this instance. /// diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 636d855158..908f3b136e 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -80,7 +80,7 @@ namespace MediaBrowser.Server.Mono var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); - var nativeApp = new NativeApp(); + var nativeApp = new NativeApp(options); _appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);