Files
ersatztv/ErsatzTV.FFmpeg/Decoder/Cuvid/DecoderMpeg2Cuvid.cs
T
Jason DoveandGitHub 5a442a06a0 start to use new ffmpeg library (#632)
* start to add ffmpeg library

* start to hook ffmpeg lib into main app

* improvements

* more progress

* make pipeline builder configurable

* more options

* move more logic down into ffmpeg lib

* ffmpeg lib desired state refactoring

* add software scaling and padding

* add loudness normalization and software deinterlace

* add metadata output options

* add setsar filter

* use built-in scaling logic

* fixes

* initial nvidia support

* nvidia improvements

* support hls mode

* print old arguments at debug level

* fix package reference

* start to add qsv support

* formatting

* fix tests

* add timeout to transcode tests

* show successful ffmpeg arguments

* add vaapi support

* add more software decoders

* add experimental transcoder option

* call existing ffmpeg process service for unimplemented features

* fix nvidia mpeg2video bug

* update changelog

* ignore some neglected unit tests
2022-02-14 14:34:00 -06:00

50 lines
1.4 KiB
C#

namespace ErsatzTV.FFmpeg.Decoder.Cuvid;
public class DecoderMpeg2Cuvid : DecoderBase
{
private readonly FrameState _desiredState;
public DecoderMpeg2Cuvid(FrameState desiredState)
{
_desiredState = desiredState;
}
public override string Name => "mpeg2_cuvid";
public override IList<string> InputOptions
{
get
{
IList<string> result = base.InputOptions;
if (_desiredState.Deinterlaced)
{
result.Add("-deint");
result.Add("2");
// make sure we decode into software
result.Add("-hwaccel_output_format");
result.Add("nv12");
}
else
{
// make sure we decode into hardware
result.Add("-hwaccel_output_format");
result.Add("cuda");
}
return result;
}
}
public override FrameDataLocation OutputFrameDataLocation => FrameDataLocation.Hardware;
public override FrameState NextState(FrameState currentState)
{
FrameState result = base.NextState(currentState);
return _desiredState.Deinterlaced
// when -deint is used, a hwupload_cuda is required to use more hw filters
? result with { Deinterlaced = true, FrameDataLocation = FrameDataLocation.Software }
: result;
}
}