diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-05 12:05:08 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-05 12:05:08 -0400 |
| commit | e5fdf31ec43cf41ffc34fa69e328242dcc482975 (patch) | |
| tree | 1833fcb855a3cdd00eebe70b9c715b2b842fe2cd | |
| parent | 26487dc455bf65f5232509aae5313bca092c5b6a (diff) | |
update subtitle transcoding
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamBuilder.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/SubtitleProfile.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs | 16 | ||||
| -rw-r--r-- | MediaBrowser.Server.Mono/Native/BaseMonoApp.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Server.Mono/Native/NativeApp.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Server.Mono/Program.cs | 2 |
6 files changed, 49 insertions, 14 deletions
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index fb6864f15..e23cb8951 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 1795c374a..0723de222 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<string> 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 2f23aad1b..9694965c7 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<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> 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 d0ceb9e09..8d22dd6bd 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; + } + /// <summary> /// Shutdowns this instance. /// </summary> @@ -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 cd1e78e35..500555647 100644 --- a/MediaBrowser.Server.Mono/Native/NativeApp.cs +++ b/MediaBrowser.Server.Mono/Native/NativeApp.cs @@ -7,6 +7,11 @@ namespace MediaBrowser.Server.Mono.Native /// </summary> internal class NativeApp : BaseMonoApp { + public NativeApp(StartupOptions startupOptions) + : base(startupOptions) + { + } + /// <summary> /// Shutdowns this instance. /// </summary> diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 636d85515..908f3b136 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); |
