add videotoolbox acceleration (#575)

This commit is contained in:
Jason Dove
2022-01-17 15:05:23 -06:00
committed by GitHub
parent 0f4219f731
commit 0440f7643b
7 changed files with 42 additions and 6 deletions
@@ -10,6 +10,7 @@ namespace ErsatzTV.Validators
private static readonly List<string> QsvEncoders = new() { "h264_qsv", "hevc_qsv", "mpeg2_qsv" };
private static readonly List<string> NvencEncoders = new() { "h264_nvenc", "hevc_nvenc" };
private static readonly List<string> VaapiEncoders = new() { "h264_vaapi", "hevc_vaapi", "mpeg2_vaapi" };
private static readonly List<string> VideoToolboxEncoders = new() { "h264_videotoolbox", "hevc_videotoolbox" };
public FFmpegProfileEditViewModelValidator()
{
@@ -53,11 +54,21 @@ namespace ErsatzTV.Validators
.WithMessage("VAAPI codec is required (h264_vaapi, hevc_vaapi, mpeg2_vaapi)");
});
When(
x => x.HardwareAcceleration == HardwareAccelerationKind.VideoToolbox,
() =>
{
RuleFor(x => x.VideoCodec).Must(c => VideoToolboxEncoders.Contains(c))
.WithMessage("VideoToolbox codec is required (h264_videotoolbox, hevc_videotoolbox)");
});
When(
x => x.HardwareAcceleration == HardwareAccelerationKind.None,
() =>
{
RuleFor(x => x.VideoCodec).Must(c => !QsvEncoders.Contains(c) && !NvencEncoders.Contains(c))
RuleFor(x => x.VideoCodec).Must(
c => !QsvEncoders.Contains(c) && !NvencEncoders.Contains(c) && !VaapiEncoders.Contains(c) &&
!VideoToolboxEncoders.Contains(c))
.WithMessage("Hardware acceleration is required for this codec");
});
}