mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-16 02:55:44 +00:00
* Move PosterWithAudio to FFMpegCore
* Reduce windows only tests
* Update Directory.Build.props
* Create .editorconfig
* More cleanup
* Enable implicit usings
* Remove unused method
* Apply dotnet format
* Fix unused variable in AudioGateArgument
* Fix boolean conditions in AudioGateArgument
* Merge boolean conditions into pattern
* Use target-typed new
* Add linting to CI
* Add CUDA to HardwareAccelerationDevice enum
* Increase timeout for Video_Join_Image_Sequence
* Adjust Video_Join_Image_Sequence timeout
* Fix expected seconds in Video_Join_Image_Sequence
* Increase timeout for Video_TranscodeToMemory due to macos agents
Former-commit-id: f9f7161686
37 lines
1 KiB
C#
37 lines
1 KiB
C#
using FFMpegCore.Exceptions;
|
|
|
|
namespace FFMpegCore.Arguments
|
|
{
|
|
/// <summary>
|
|
/// Represents output parameter
|
|
/// </summary>
|
|
public class OutputArgument : IOutputArgument
|
|
{
|
|
public readonly string Path;
|
|
public readonly bool Overwrite;
|
|
|
|
public OutputArgument(string path, bool overwrite = true)
|
|
{
|
|
Path = path;
|
|
Overwrite = overwrite;
|
|
}
|
|
|
|
public void Pre()
|
|
{
|
|
if (!Overwrite && File.Exists(Path))
|
|
{
|
|
throw new FFMpegException(FFMpegExceptionType.File, "Output file already exists and overwrite is disabled");
|
|
}
|
|
}
|
|
public Task During(CancellationToken cancellationToken = default) => Task.CompletedTask;
|
|
public void Post()
|
|
{
|
|
}
|
|
|
|
public OutputArgument(FileInfo value) : this(value.FullName) { }
|
|
|
|
public OutputArgument(Uri value) : this(value.AbsolutePath) { }
|
|
|
|
public string Text => $"\"{Path}\"{(Overwrite ? " -y" : string.Empty)}";
|
|
}
|
|
}
|