26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using ErsatzTV.FFmpeg.Environment;
|
|
|
|
namespace ErsatzTV.FFmpeg.Option;
|
|
|
|
public class StreamSeekInputOption : IInputOption
|
|
{
|
|
private readonly TimeSpan _start;
|
|
|
|
public StreamSeekInputOption(TimeSpan start) => _start = start;
|
|
|
|
public IList<EnvironmentVariable> EnvironmentVariables => Array.Empty<EnvironmentVariable>();
|
|
public IList<string> GlobalOptions => Array.Empty<string>();
|
|
public IList<string> InputOptions(InputFile inputFile) => new List<string> { "-ss", $"{_start:c}" };
|
|
public IList<string> FilterOptions => Array.Empty<string>();
|
|
public IList<string> OutputOptions => Array.Empty<string>();
|
|
public FrameState NextState(FrameState currentState) => currentState;
|
|
|
|
public bool AppliesTo(AudioInputFile audioInputFile) => true;
|
|
|
|
// don't seek into a still image
|
|
public bool AppliesTo(VideoInputFile videoInputFile) => videoInputFile.VideoStreams.All(s => !s.StillImage);
|
|
|
|
// never seek when concatenating
|
|
public bool AppliesTo(ConcatInputFile concatInputFile) => false;
|
|
}
|