diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-12-26 21:39:11 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-12-26 21:43:17 -0500 |
| commit | 575751dbb07a302d21f8602ba56ae22ab45505c4 (patch) | |
| tree | e7937c99016167682bd935dd3eaf8958f11e5e0d | |
| parent | 0dcd698c17139b88dd33f4ab091c67525b9d1f98 (diff) | |
capture bit depth with ffprobe
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index d9fda220d..befff72d1 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -159,6 +159,11 @@ namespace MediaBrowser.MediaEncoding.Probing } stream.ChannelLayout = ParseChannelLayout(streamInfo.channel_layout); + + if (streamInfo.bits_per_sample > 0) + { + stream.BitDepth = streamInfo.bits_per_sample; + } } else if (string.Equals(streamInfo.codec_type, "subtitle", StringComparison.OrdinalIgnoreCase)) { @@ -177,7 +182,10 @@ namespace MediaBrowser.MediaEncoding.Probing stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); - stream.BitDepth = GetBitDepth(stream.PixelFormat); + if (streamInfo.bits_per_sample > 0) + { + stream.BitDepth = streamInfo.bits_per_sample; + } //stream.IsAnamorphic = string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase) || // string.Equals(stream.AspectRatio, "2.35:1", StringComparison.OrdinalIgnoreCase) || @@ -236,34 +244,6 @@ namespace MediaBrowser.MediaEncoding.Probing return stream; } - private int? GetBitDepth(string pixelFormat) - { - var eightBit = new List<string> - { - "yuv420p", - "yuv411p", - "yuvj420p", - "uyyvyy411", - "nv12", - "nv21", - "rgb444le", - "rgb444be", - "bgr444le", - "bgr444be", - "yuvj411p" - }; - - if (!string.IsNullOrEmpty(pixelFormat)) - { - if (eightBit.Contains(pixelFormat, StringComparer.OrdinalIgnoreCase)) - { - return 8; - } - } - - return null; - } - /// <summary> /// Gets a string from an FFProbeResult tags dictionary /// </summary> |
