mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.8 KiB
46 lines
1.8 KiB
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.FFmpeg; |
|
using ErsatzTV.FFmpeg.Format; |
|
using ErsatzTV.FFmpeg.Preset; |
|
|
|
namespace ErsatzTV.Core.FFmpeg; |
|
|
|
public static class FFmpegLibraryHelper |
|
{ |
|
public static ICollection<string> PresetsForFFmpegProfile( |
|
HardwareAccelerationKind hardwareAccelerationKind, |
|
FFmpegProfileVideoFormat videoFormat, |
|
FFmpegProfileBitDepth bitDepth) => AvailablePresets.ForAccelAndFormat( |
|
MapAccel(hardwareAccelerationKind), |
|
MapVideoFormat(videoFormat), |
|
MapBitDepth(bitDepth)); |
|
|
|
public static HardwareAccelerationMode MapAccel(HardwareAccelerationKind kind) => |
|
kind switch |
|
{ |
|
HardwareAccelerationKind.Amf => HardwareAccelerationMode.Amf, |
|
HardwareAccelerationKind.Nvenc => HardwareAccelerationMode.Nvenc, |
|
HardwareAccelerationKind.Qsv => HardwareAccelerationMode.Qsv, |
|
HardwareAccelerationKind.Vaapi => HardwareAccelerationMode.Vaapi, |
|
HardwareAccelerationKind.VideoToolbox => HardwareAccelerationMode.VideoToolbox, |
|
HardwareAccelerationKind.V4l2m2m => HardwareAccelerationMode.V4l2m2m, |
|
HardwareAccelerationKind.Rkmpp => HardwareAccelerationMode.Rkmpp, |
|
_ => HardwareAccelerationMode.None |
|
}; |
|
|
|
public static string MapVideoFormat(FFmpegProfileVideoFormat format) => |
|
format switch |
|
{ |
|
FFmpegProfileVideoFormat.H264 => VideoFormat.H264, |
|
FFmpegProfileVideoFormat.Hevc => VideoFormat.Hevc, |
|
FFmpegProfileVideoFormat.Av1 => VideoFormat.Av1, |
|
_ => VideoFormat.Mpeg2Video |
|
}; |
|
|
|
public static int MapBitDepth(FFmpegProfileBitDepth bitDepth) => |
|
bitDepth switch |
|
{ |
|
FFmpegProfileBitDepth.EightBit => 8, |
|
_ => 10 |
|
}; |
|
}
|
|
|