diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index fb8b50bf28..e0a2224edc 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2532,8 +2532,8 @@ namespace MediaBrowser.Controller.MediaEncoding { var videoType = state.MediaSource.VideoType ?? VideoType.VideoFile; var videoStream = state.VideoStream; - var IsColorDepth10 = (videoStream.Profile ?? string.Empty).IndexOf("Main 10", StringComparison.OrdinalIgnoreCase) != -1 - || (videoStream.Profile ?? string.Empty).IndexOf("High 10", StringComparison.OrdinalIgnoreCase) != -1; + var isColorDepth10 = !string.IsNullOrEmpty(videoStream.Profile) && (videoStream.Profile.Contains("Main 10", StringComparison.OrdinalIgnoreCase) + || videoStream.Profile.Contains("High 10", StringComparison.OrdinalIgnoreCase)); if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { @@ -2553,7 +2553,7 @@ namespace MediaBrowser.Controller.MediaEncoding && !string.IsNullOrEmpty(encodingOptions.HardwareAccelerationType)) { // Only hevc and vp9 formats have 10-bit hardware decoder support now. - if (IsColorDepth10 && !(string.Equals(videoStream.Codec, "hevc", StringComparison.OrdinalIgnoreCase) + if (isColorDepth10 && !(string.Equals(videoStream.Codec, "hevc", StringComparison.OrdinalIgnoreCase) || string.Equals(videoStream.Codec, "h265", StringComparison.OrdinalIgnoreCase) || string.Equals(videoStream.Codec, "vp9", StringComparison.OrdinalIgnoreCase))) { @@ -2581,7 +2581,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "h265": if (_mediaEncoder.SupportsDecoder("hevc_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2615,7 +2615,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "vp9": if (_mediaEncoder.SupportsDecoder("vp9_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2652,7 +2652,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "h265": if (_mediaEncoder.SupportsDecoder("hevc_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2692,7 +2692,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "vp9": if (_mediaEncoder.SupportsDecoder("vp9_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2723,7 +2723,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "h265": if (_mediaEncoder.SupportsDecoder("hevc_mediacodec") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2757,7 +2757,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "vp9": if (_mediaEncoder.SupportsDecoder("vp9_mediacodec") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2814,7 +2814,7 @@ namespace MediaBrowser.Controller.MediaEncoding return GetHwaccelType(state, encodingOptions, "h264"); case "hevc": case "h265": - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2832,7 +2832,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "mpeg4": return GetHwaccelType(state, encodingOptions, "mpeg4"); case "vp9": - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2855,7 +2855,7 @@ namespace MediaBrowser.Controller.MediaEncoding return GetHwaccelType(state, encodingOptions, "h264"); case "hevc": case "h265": - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) { @@ -2873,7 +2873,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "vp8": return GetHwaccelType(state, encodingOptions, "vp8"); case "vp9": - if (IsColorDepth10) + if (isColorDepth10) { if (encodingOptions.EnableDecodingColorDepth10) {