more nvidia 10-bit fixes (#2426)
* fix playback with invalid ffmpeg profile * fix 10 bit output with nvidia and graphics engine
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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,
|
||||
_ => VideoFormat.Mpeg2Video
|
||||
};
|
||||
|
||||
public static int MapBitDepth(FFmpegProfileBitDepth bitDepth) =>
|
||||
bitDepth switch
|
||||
{
|
||||
FFmpegProfileBitDepth.EightBit => 8,
|
||||
_ => 10
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user