Stream custom live channels using your own media
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.
 
 
 

38 lines
1.2 KiB

namespace ErsatzTV.FFmpeg.Decoder.Cuvid;
public class DecoderMpeg2Cuvid : DecoderBase
{
private readonly bool _contentIsInterlaced;
private readonly FFmpegState _ffmpegState;
public DecoderMpeg2Cuvid(FFmpegState ffmpegState, bool contentIsInterlaced)
{
_ffmpegState = ffmpegState;
_contentIsInterlaced = contentIsInterlaced;
}
public override string Name => "mpeg2_cuvid";
protected override FrameDataLocation OutputFrameDataLocation =>
_contentIsInterlaced || _ffmpegState.EncoderHardwareAccelerationMode == HardwareAccelerationMode.None
? FrameDataLocation.Software
: FrameDataLocation.Hardware;
public override IList<string> InputOptions(InputFile inputFile)
{
IList<string> result = base.InputOptions(inputFile);
if (_ffmpegState.EncoderHardwareAccelerationMode != HardwareAccelerationMode.None)
{
result.Add("-hwaccel_output_format");
result.Add("cuda");
}
else
{
result.Add("-hwaccel_output_format");
result.Add(InputBitDepth(inputFile) == 10 ? "p010le" : "nv12");
}
return result;
}
}