浏览代码

Merge pull request #3115 from MrTimscampi/ffprobe

Parse color transfer and color primaries from ffprobe, and fix video range
dkanada 5 年之前
父节点
当前提交
4b4b50f3ee

+ 14 - 0
MediaBrowser.MediaEncoding/Probing/MediaStreamInfo.cs

@@ -278,5 +278,19 @@ namespace MediaBrowser.MediaEncoding.Probing
         /// <value>The disposition.</value>
         /// <value>The disposition.</value>
         [JsonPropertyName("disposition")]
         [JsonPropertyName("disposition")]
         public IReadOnlyDictionary<string, int> Disposition { get; set; }
         public IReadOnlyDictionary<string, int> Disposition { get; set; }
+
+        /// <summary>
+        /// Gets or sets the color transfer.
+        /// </summary>
+        /// <value>The color transfer.</value>
+        [JsonPropertyName("color_transfer")]
+        public string ColorTransfer { get; set; }
+
+        /// <summary>
+        /// Gets or sets the color primaries.
+        /// </summary>
+        /// <value>The color primaries.</value>
+        [JsonPropertyName("color_primaries")]
+        public string ColorPrimaries { get; set; }
     }
     }
 }
 }

+ 10 - 0
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -695,6 +695,16 @@ namespace MediaBrowser.MediaEncoding.Probing
                 {
                 {
                     stream.RefFrames = streamInfo.Refs;
                     stream.RefFrames = streamInfo.Refs;
                 }
                 }
+
+                if (!string.IsNullOrEmpty(streamInfo.ColorTransfer))
+                {
+                    stream.ColorTransfer = streamInfo.ColorTransfer;
+                }
+
+                if (!string.IsNullOrEmpty(streamInfo.ColorPrimaries))
+                {
+                    stream.ColorPrimaries = streamInfo.ColorPrimaries;
+                }
             }
             }
             else
             else
             {
             {

+ 35 - 1
MediaBrowser.Model/Entities/MediaStream.cs

@@ -34,8 +34,22 @@ namespace MediaBrowser.Model.Entities
         /// <value>The language.</value>
         /// <value>The language.</value>
         public string Language { get; set; }
         public string Language { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the color transfer.
+        /// </summary>
+        /// <value>The color transfer.</value>
         public string ColorTransfer { get; set; }
         public string ColorTransfer { get; set; }
+
+        /// <summary>
+        /// Gets or sets the color primaries.
+        /// </summary>
+        /// <value>The color primaries.</value>
         public string ColorPrimaries { get; set; }
         public string ColorPrimaries { get; set; }
+
+        /// <summary>
+        /// Gets or sets the color space.
+        /// </summary>
+        /// <value>The color space.</value>
         public string ColorSpace { get; set; }
         public string ColorSpace { get; set; }
 
 
         /// <summary>
         /// <summary>
@@ -44,11 +58,28 @@ namespace MediaBrowser.Model.Entities
         /// <value>The comment.</value>
         /// <value>The comment.</value>
         public string Comment { get; set; }
         public string Comment { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the time base.
+        /// </summary>
+        /// <value>The time base.</value>
         public string TimeBase { get; set; }
         public string TimeBase { get; set; }
+
+        /// <summary>
+        /// Gets or sets the codec time base.
+        /// </summary>
+        /// <value>The codec time base.</value>
         public string CodecTimeBase { get; set; }
         public string CodecTimeBase { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the title.
+        /// </summary>
+        /// <value>The title.</value>
         public string Title { get; set; }
         public string Title { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the video range.
+        /// </summary>
+        /// <value>The video range.</value>
         public string VideoRange
         public string VideoRange
         {
         {
             get
             get
@@ -60,7 +91,8 @@ namespace MediaBrowser.Model.Entities
 
 
                 var colorTransfer = ColorTransfer;
                 var colorTransfer = ColorTransfer;
 
 
-                if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
+                if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)
+                    || string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
                 {
                 {
                     return "HDR";
                     return "HDR";
                 }
                 }
@@ -70,7 +102,9 @@ namespace MediaBrowser.Model.Entities
         }
         }
 
 
         public string localizedUndefined { get; set; }
         public string localizedUndefined { get; set; }
+
         public string localizedDefault { get; set; }
         public string localizedDefault { get; set; }
+
         public string localizedForced { get; set; }
         public string localizedForced { get; set; }
 
 
         public string DisplayTitle
         public string DisplayTitle