Răsfoiți Sursa

update subtitle transcoding

Luke Pulverenti 9 ani în urmă
părinte
comite
e5fdf31ec4

+ 5 - 5
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -770,12 +770,12 @@ namespace MediaBrowser.Model.Dlna
                         {
                         {
                             return profile;
                             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;
+                        }
                     }
                     }
                 }
                 }
             }
             }

+ 9 - 4
MediaBrowser.Model/Dlna/SubtitleProfile.cs

@@ -28,15 +28,20 @@ namespace MediaBrowser.Model.Dlna
             return list;
             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();
             List<string> languages = GetLanguages();
-            return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language);
+            return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
         }
         }
     }
     }
 }
 }

+ 13 - 3
MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs

@@ -105,6 +105,18 @@ namespace MediaBrowser.Server.Implementations.Library
             return GetMediaStreamsForItem(list);
             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)
         private IEnumerable<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> streams)
         {
         {
             var list = streams.ToList();
             var list = streams.ToList();
@@ -117,9 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library
             {
             {
                 var videoStream = list.FirstOrDefault(i => i.Type == MediaStreamType.Video);
                 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;
                 var videoBitrate = videoStream == null ? maxAllowedBitrateForExternalSubtitleStream : videoStream.BitRate ?? maxAllowedBitrateForExternalSubtitleStream;
 
 

+ 16 - 1
MediaBrowser.Server.Mono/Native/BaseMonoApp.cs

@@ -13,6 +13,12 @@ namespace MediaBrowser.Server.Mono.Native
 {
 {
     public abstract class BaseMonoApp : INativeApp
     public abstract class BaseMonoApp : INativeApp
     {
     {
+        protected StartupOptions StartupOptions { get; private set; }
+        protected BaseMonoApp(StartupOptions startupOptions)
+        {
+            StartupOptions = startupOptions;
+        }
+
         /// <summary>
         /// <summary>
         /// Shutdowns this instance.
         /// Shutdowns this instance.
         /// </summary>
         /// </summary>
@@ -111,7 +117,15 @@ namespace MediaBrowser.Server.Mono.Native
 
 
         public bool SupportsLibraryMonitor
         public bool SupportsLibraryMonitor
         {
         {
-            get { return false; }
+            get
+            {
+                if (StartupOptions.ContainsOption("-allowrealtimemonitor"))
+                {
+                    return true;    
+                }
+
+                return false;
+            }
         }
         }
 
 
         public void ConfigureAutoRun(bool autorun)
         public void ConfigureAutoRun(bool autorun)
@@ -170,6 +184,7 @@ namespace MediaBrowser.Server.Mono.Native
         }
         }
 
 
         private Uname _unixName;
         private Uname _unixName;
+
         private Uname GetUnixName()
         private Uname GetUnixName()
         {
         {
             if (_unixName == null)
             if (_unixName == null)

+ 5 - 0
MediaBrowser.Server.Mono/Native/NativeApp.cs

@@ -7,6 +7,11 @@ namespace MediaBrowser.Server.Mono.Native
     /// </summary>
     /// </summary>
     internal class NativeApp : BaseMonoApp
     internal class NativeApp : BaseMonoApp
     {
     {
+        public NativeApp(StartupOptions startupOptions)
+            : base(startupOptions)
+        {
+        }
+
         /// <summary>
         /// <summary>
         /// Shutdowns this instance.
         /// Shutdowns this instance.
         /// </summary>
         /// </summary>

+ 1 - 1
MediaBrowser.Server.Mono/Program.cs

@@ -80,7 +80,7 @@ namespace MediaBrowser.Server.Mono
             var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true);
             var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true);
             fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
             fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
 
 
-            var nativeApp = new NativeApp();
+            var nativeApp = new NativeApp(options);
 
 
             _appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);
             _appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);