瀏覽代碼

add IgnoreDts option

Luke Pulverenti 8 年之前
父節點
當前提交
7ee588060d

+ 2 - 1
Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs

@@ -420,7 +420,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                 SupportsDirectPlay = false,
                 SupportsDirectStream = true,
                 SupportsTranscoding = true,
-                IsInfiniteStream = true
+                IsInfiniteStream = true,
+                IgnoreDts = true
             };
 
             mediaSource.InferTotalBitrate();

+ 16 - 6
MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

@@ -1517,12 +1517,6 @@ namespace MediaBrowser.Controller.MediaEncoding
             inputModifier += " " + GetFastSeekCommandLineParameter(state.BaseRequest);
             inputModifier = inputModifier.Trim();
 
-            //inputModifier += " -fflags +genpts+ignidx+igndts";
-            //if (state.IsVideoRequest && genPts)
-            //{
-            //    inputModifier += " -fflags +genpts";
-            //}
-
             if (!string.IsNullOrEmpty(state.InputAudioSync))
             {
                 inputModifier += " -async " + state.InputAudioSync;
@@ -1538,6 +1532,21 @@ namespace MediaBrowser.Controller.MediaEncoding
                 inputModifier += " -re";
             }
 
+            var flags = new List<string>();
+            if (state.IgnoreDts)
+            {
+                flags.Add("+igndts");
+            }
+            if (state.IgnoreIndex)
+            {
+                flags.Add("+ignidx");
+            }
+
+            if (flags.Count > 0)
+            {
+                inputModifier += " -fflags " + string.Join("", flags.ToArray());
+            }
+
             var videoDecoder = GetVideoDecoder(state, encodingOptions);
             if (!string.IsNullOrWhiteSpace(videoDecoder))
             {
@@ -1633,6 +1642,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             state.RunTimeTicks = mediaSource.RunTimeTicks;
             state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders;
             state.ReadInputAtNativeFramerate = mediaSource.ReadAtNativeFramerate;
+            state.IgnoreDts = mediaSource.IgnoreDts;
 
             if (state.ReadInputAtNativeFramerate ||
                 mediaSource.Protocol == MediaProtocol.File && string.Equals(mediaSource.Container, "wtv", StringComparison.OrdinalIgnoreCase))

+ 10 - 0
MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs

@@ -39,6 +39,16 @@ namespace MediaBrowser.Controller.MediaEncoding
 
         public bool ReadInputAtNativeFramerate { get; set; }
 
+        public bool IgnoreDts
+        {
+            get { return MediaSource.IgnoreDts; }
+        }
+
+        public bool IgnoreIndex
+        {
+            get { return MediaSource.IgnoreIndex; }
+        }
+
         public string OutputContainer { get; set; }
 
         public string OutputVideoSync

+ 23 - 12
MediaBrowser.Model/Dlna/ResolutionNormalizer.cs

@@ -12,7 +12,9 @@ namespace MediaBrowser.Model.Dlna
                 new ResolutionConfiguration(426, 320000),
                 new ResolutionConfiguration(640, 400000),
                 new ResolutionConfiguration(720, 950000),
-                new ResolutionConfiguration(1280, 2500000)
+                new ResolutionConfiguration(1280, 2500000),
+                new ResolutionConfiguration(1920, 4000000),
+                new ResolutionConfiguration(3840, 35000000)
             };
 
         public static ResolutionOptions Normalize(int? inputBitrate,
@@ -35,19 +37,15 @@ namespace MediaBrowser.Model.Dlna
 				}
 			}
 
-			foreach (var config in Configurations)
+            var resolutionConfig = GetResolutionConfiguration(outputBitrate);
+            if (resolutionConfig != null)
             {
-				if (outputBitrate <= config.MaxBitrate)
-                {
-                    var originvalValue = maxWidth;
-
-                    maxWidth = Math.Min(config.MaxWidth, maxWidth ?? config.MaxWidth);
-                    if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
-                    {
-                        maxHeight = null;
-                    }
+                var originvalValue = maxWidth;
 
-                    break;
+                maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
+                if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
+                {
+                    maxHeight = null;
                 }
             }
 
@@ -58,6 +56,19 @@ namespace MediaBrowser.Model.Dlna
             };
         }
 
+        private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
+        {
+            foreach (var config in Configurations)
+            {
+                if (outputBitrate <= config.MaxBitrate)
+                {
+                    return config;
+                }
+            }
+
+            return null;
+        }
+
         private static double GetVideoBitrateScaleFactor(string codec)
         {
             if (StringHelper.EqualsIgnoreCase(codec, "h265") ||

+ 2 - 0
MediaBrowser.Model/Dto/MediaSourceInfo.cs

@@ -29,6 +29,8 @@ namespace MediaBrowser.Model.Dto
         public string ETag { get; set; }
         public long? RunTimeTicks { get; set; }
         public bool ReadAtNativeFramerate { get; set; }
+        public bool IgnoreDts { get; set; }
+        public bool IgnoreIndex { get; set; }
         public bool SupportsTranscoding { get; set; }
         public bool SupportsDirectStream { get; set; }
         public bool SupportsDirectPlay { get; set; }

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.698</version>
+        <version>3.0.699</version>
         <title>Emby.Common</title>
         <authors>Emby Team</authors>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.698</version>
+        <version>3.0.699</version>
         <title>Emby.Server.Core</title>
         <authors>Emby Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Emby Server.</description>
         <copyright>Copyright © Emby 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.696" />
+            <dependency id="MediaBrowser.Common" version="3.0.699" />
         </dependencies>
     </metadata>
     <files>