add videotoolbox

This commit is contained in:
artiume 2020-05-25 18:11:32 -04:00 committed by Vasily
parent 407de0209e
commit f056704c78

View File

@ -2826,6 +2826,38 @@ namespace MediaBrowser.Controller.MediaEncoding
return GetHwaccelType(state, encodingOptions, "vp9");
}
}
else if (string.Equals(encodingOptions.HardwareAccelerationType, "videotoolbox", StringComparison.OrdinalIgnoreCase))
{
switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
if (_mediaEncoder.SupportsDecoder("h264_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase))
{
return "-c:v h264_videotoolbox";
}
break;
case "mpeg2video":
if (_mediaEncoder.SupportsDecoder("mpeg2_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase))
{
return "-c:v mpeg2_videotoolbox";
}
break;
case "mpeg4":
if (_mediaEncoder.SupportsDecoder("mpeg4_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg4", StringComparer.OrdinalIgnoreCase))
{
return "-c:v mpeg4_videotoolbox";
}
break;
case "vc1":
if (_mediaEncoder.SupportsDecoder("vc1_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase))
{
return "-c:v vc1_videotoolbox";
}
break;
}
}
}
var whichCodec = videoStream.Codec.ToLowerInvariant();