* start to add v4l2m2m accel * add v4l2m2m pipeline * add encoders * fix decoders and encoders * output software frames from decoders * more buffers * hide v4l2m2m from ui
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
namespace ErsatzTV.FFmpeg.Filter;
|
|
|
|
public class WatermarkHardwareUploadFilter : BaseFilter
|
|
{
|
|
private readonly FrameState _currentState;
|
|
private readonly FFmpegState _ffmpegState;
|
|
|
|
public WatermarkHardwareUploadFilter(FrameState currentState, FFmpegState ffmpegState)
|
|
{
|
|
_currentState = currentState;
|
|
_ffmpegState = ffmpegState;
|
|
}
|
|
|
|
public override string Filter => _ffmpegState.EncoderHardwareAccelerationMode switch
|
|
{
|
|
HardwareAccelerationMode.None => string.Empty,
|
|
HardwareAccelerationMode.Nvenc => "hwupload_cuda",
|
|
HardwareAccelerationMode.Qsv => $"hwupload=extra_hw_frames={_ffmpegState.QsvExtraHardwareFrames}",
|
|
|
|
// leave vaapi in software since we don't (yet) use overlay_vaapi
|
|
HardwareAccelerationMode.Vaapi when _currentState.FrameDataLocation == FrameDataLocation.Software =>
|
|
string.Empty,
|
|
|
|
// leave videotoolbox in software since we use a software overlay filter
|
|
HardwareAccelerationMode.VideoToolbox => string.Empty,
|
|
|
|
// leave amf in software since we use a software overlay filter
|
|
HardwareAccelerationMode.Amf => string.Empty,
|
|
|
|
// leave v4l2m2m in software since we use a software overlay filter
|
|
HardwareAccelerationMode.V4l2m2m => string.Empty,
|
|
|
|
_ => "hwupload"
|
|
};
|
|
|
|
public override FrameState NextState(FrameState currentState) => currentState;
|
|
}
|