FFMpegCore/FFMpegCore/FFMpeg/Arguments/InputArgument.cs
2025-10-16 12:38:57 +02:00

35 lines
836 B
C#

namespace FFMpegCore.Arguments;
/// <summary>
/// Represents input parameter
/// </summary>
public class InputArgument : IInputArgument
{
public readonly string FilePath;
public readonly bool VerifyExists;
public InputArgument(bool verifyExists, string filePaths)
{
VerifyExists = verifyExists;
FilePath = filePaths;
}
public InputArgument(string path, bool verifyExists) : this(verifyExists, path) { }
public void Pre()
{
if (VerifyExists && !File.Exists(FilePath))
{
throw new FileNotFoundException("Input file not found", FilePath);
}
}
public Task During(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
public void Post() { }
public string Text => $"-i \"{FilePath}\"";
}