mirror of https://github.com/ErsatzTV/ErsatzTV.git
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.4 KiB
38 lines
1.4 KiB
using ErsatzTV.FFmpeg.Environment; |
|
|
|
namespace ErsatzTV.FFmpeg.InputOption; |
|
|
|
public class InfiniteLoopInputOption : IInputOption |
|
{ |
|
private readonly HardwareAccelerationMode _hardwareAccelerationMode; |
|
|
|
public InfiniteLoopInputOption(HardwareAccelerationMode hardwareAccelerationMode) => |
|
_hardwareAccelerationMode = hardwareAccelerationMode; |
|
|
|
public EnvironmentVariable[] EnvironmentVariables => Array.Empty<EnvironmentVariable>(); |
|
public string[] GlobalOptions => Array.Empty<string>(); |
|
|
|
public string[] InputOptions(InputFile inputFile) |
|
{ |
|
// loop 1 for still images |
|
if (inputFile.Streams.OfType<VideoStream>().Any(s => s.StillImage)) |
|
{ |
|
return ["-loop", "1"]; |
|
} |
|
|
|
// stream_loop for looped video i.e. filler |
|
return ["-stream_loop", "-1"]; |
|
} |
|
|
|
public string[] FilterOptions => Array.Empty<string>(); |
|
|
|
public string[] OutputOptions => |
|
_hardwareAccelerationMode is HardwareAccelerationMode.Qsv or HardwareAccelerationMode.Vaapi |
|
? new[] { "-noautoscale" } |
|
: Array.Empty<string>(); |
|
|
|
public FrameState NextState(FrameState currentState) => currentState with { Realtime = true }; |
|
public bool AppliesTo(AudioInputFile audioInputFile) => true; |
|
public bool AppliesTo(VideoInputFile videoInputFile) => true; |
|
public bool AppliesTo(ConcatInputFile concatInputFile) => true; |
|
}
|
|
|