diff options
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 6ef22ef5b..521bf7a81 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -195,6 +195,8 @@ namespace MediaBrowser.Controller.MediaEncoding stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); + + stream.BitDepth = GetBitDepth(stream.PixelFormat); } else { @@ -232,6 +234,34 @@ namespace MediaBrowser.Controller.MediaEncoding return stream; } + private static 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> |
