mirror of https://github.com/ErsatzTV/ErsatzTV.git
9 changed files with 81 additions and 22 deletions
@ -1,14 +1,27 @@ |
|||||||
namespace ErsatzTV.FFmpeg.Decoder.Cuvid; |
using ErsatzTV.FFmpeg.Format; |
||||||
|
|
||||||
|
namespace ErsatzTV.FFmpeg.Decoder.Cuvid; |
||||||
|
|
||||||
public class DecoderImplicitCuda : DecoderBase |
public class DecoderImplicitCuda : DecoderBase |
||||||
{ |
{ |
||||||
protected override FrameDataLocation OutputFrameDataLocation => FrameDataLocation.Hardware; |
protected override FrameDataLocation OutputFrameDataLocation => FrameDataLocation.Hardware; |
||||||
public override string Name => string.Empty; |
|
||||||
|
public override string Name => "implicit_cuda"; |
||||||
|
|
||||||
public override string[] InputOptions(InputFile inputFile) => |
public override string[] InputOptions(InputFile inputFile) => |
||||||
new[] |
[ |
||||||
{ |
|
||||||
"-hwaccel_output_format", |
"-hwaccel_output_format", |
||||||
"cuda" |
"cuda" |
||||||
}; |
]; |
||||||
|
|
||||||
|
public override FrameState NextState(FrameState currentState) |
||||||
|
{ |
||||||
|
FrameState nextState = base.NextState(currentState); |
||||||
|
|
||||||
|
return currentState.PixelFormat.Match( |
||||||
|
pixelFormat => pixelFormat.BitDepth == 8 |
||||||
|
? nextState with { PixelFormat = new PixelFormatNv12(pixelFormat.Name) } |
||||||
|
: nextState with { PixelFormat = new PixelFormatCuda(pixelFormat.Name, 10) }, |
||||||
|
() => nextState); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
namespace ErsatzTV.FFmpeg.Format; |
||||||
|
|
||||||
|
public class PixelFormatCuda(string name, int bitDepth = 8) : IPixelFormat |
||||||
|
{ |
||||||
|
public string Name { get; } = name; |
||||||
|
|
||||||
|
public string FFmpegName => "cuda"; |
||||||
|
|
||||||
|
public int BitDepth { get; } = bitDepth; |
||||||
|
} |
@ -1,16 +1,10 @@ |
|||||||
namespace ErsatzTV.FFmpeg.Format; |
namespace ErsatzTV.FFmpeg.Format; |
||||||
|
|
||||||
public class PixelFormatVaapi : IPixelFormat |
public class PixelFormatVaapi(string name, int bitDepth = 8) : IPixelFormat |
||||||
{ |
{ |
||||||
public PixelFormatVaapi(string name, int bitDepth = 8) |
public string Name { get; } = name; |
||||||
{ |
|
||||||
Name = name; |
|
||||||
BitDepth = bitDepth; |
|
||||||
} |
|
||||||
|
|
||||||
public string Name { get; } |
|
||||||
|
|
||||||
public string FFmpegName => "vaapi"; |
public string FFmpegName => "vaapi"; |
||||||
|
|
||||||
public int BitDepth { get; } |
public int BitDepth { get; } = bitDepth; |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue