mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* more scaling fixes * qsv fixes * cleanup * nvidia fixes * vaapi fixes * test nvidia by defaultpull/664/head
16 changed files with 247 additions and 47 deletions
@ -1,26 +1,39 @@ |
|||||||
using ErsatzTV.FFmpeg.Format; |
using ErsatzTV.FFmpeg.Format; |
||||||
|
using LanguageExt; |
||||||
|
|
||||||
namespace ErsatzTV.FFmpeg.Encoder.Vaapi; |
namespace ErsatzTV.FFmpeg.Encoder.Vaapi; |
||||||
|
|
||||||
public class EncoderH264Vaapi : EncoderBase |
public class EncoderH264Vaapi : EncoderBase |
||||||
{ |
{ |
||||||
private readonly FrameState _currentState; |
private readonly FrameState _currentState; |
||||||
|
private readonly Option<WatermarkInputFile> _maybeWatermarkInputFile; |
||||||
|
|
||||||
public EncoderH264Vaapi(FrameState currentState) |
public EncoderH264Vaapi(FrameState currentState, Option<WatermarkInputFile> maybeWatermarkInputFile) |
||||||
{ |
{ |
||||||
_currentState = currentState; |
_currentState = currentState; |
||||||
|
_maybeWatermarkInputFile = maybeWatermarkInputFile; |
||||||
} |
} |
||||||
|
|
||||||
public override FrameState NextState(FrameState currentState) => currentState with |
public override FrameState NextState(FrameState currentState) => currentState with |
||||||
{ |
{ |
||||||
VideoFormat = VideoFormat.H264, |
VideoFormat = VideoFormat.H264, |
||||||
FrameDataLocation = FrameDataLocation.Hardware |
// don't change the frame data location
|
||||||
}; |
}; |
||||||
|
|
||||||
public override string Name => "h264_vaapi"; |
public override string Name => "h264_vaapi"; |
||||||
public override StreamKind Kind => StreamKind.Video; |
public override StreamKind Kind => StreamKind.Video; |
||||||
|
|
||||||
public override string Filter => _currentState.FrameDataLocation == FrameDataLocation.Software |
// need to upload if we're still in software unless a watermark is used
|
||||||
? "format=nv12|vaapi,hwupload" |
public override string Filter |
||||||
: string.Empty; |
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (_maybeWatermarkInputFile.IsNone && _currentState.FrameDataLocation == FrameDataLocation.Software) |
||||||
|
{ |
||||||
|
return "format=nv12|vaapi,hwupload"; |
||||||
|
} |
||||||
|
|
||||||
|
return string.Empty; |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,26 +1,39 @@ |
|||||||
using ErsatzTV.FFmpeg.Format; |
using ErsatzTV.FFmpeg.Format; |
||||||
|
|
||||||
namespace ErsatzTV.FFmpeg.Encoder.Vaapi; |
namespace ErsatzTV.FFmpeg.Encoder.Vaapi; |
||||||
|
using LanguageExt; |
||||||
|
|
||||||
public class EncoderHevcVaapi : EncoderBase |
public class EncoderHevcVaapi : EncoderBase |
||||||
{ |
{ |
||||||
private readonly FrameState _currentState; |
private readonly FrameState _currentState; |
||||||
|
private readonly Option<WatermarkInputFile> _maybeWatermarkInputFile; |
||||||
|
|
||||||
public EncoderHevcVaapi(FrameState currentState) |
public EncoderHevcVaapi(FrameState currentState, Option<WatermarkInputFile> maybeWatermarkInputFile) |
||||||
{ |
{ |
||||||
_currentState = currentState; |
_currentState = currentState; |
||||||
|
_maybeWatermarkInputFile = maybeWatermarkInputFile; |
||||||
} |
} |
||||||
|
|
||||||
public override FrameState NextState(FrameState currentState) => currentState with |
public override FrameState NextState(FrameState currentState) => currentState with |
||||||
{ |
{ |
||||||
VideoFormat = VideoFormat.Hevc, |
VideoFormat = VideoFormat.Hevc |
||||||
FrameDataLocation = FrameDataLocation.Hardware |
// don't change the frame data location
|
||||||
}; |
}; |
||||||
|
|
||||||
public override string Name => "hevc_vaapi"; |
public override string Name => "hevc_vaapi"; |
||||||
public override StreamKind Kind => StreamKind.Video; |
public override StreamKind Kind => StreamKind.Video; |
||||||
|
|
||||||
public override string Filter => _currentState.FrameDataLocation == FrameDataLocation.Software |
// need to upload if we're still in software unless a watermark is used
|
||||||
? "format=nv12|vaapi,hwupload" |
public override string Filter |
||||||
: string.Empty; |
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (_maybeWatermarkInputFile.IsNone && _currentState.FrameDataLocation == FrameDataLocation.Software) |
||||||
|
{ |
||||||
|
return "format=nv12|vaapi,hwupload"; |
||||||
|
} |
||||||
|
|
||||||
|
return string.Empty; |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue