mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Support for specyfying process working directory through FFOptions (#272)
Former-commit-id: c2d28055c1
This commit is contained in:
parent
8012594a81
commit
079760d044
3 changed files with 13 additions and 6 deletions
|
@ -145,17 +145,18 @@ private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList<str
|
||||||
return exitCode == 0;
|
return exitCode == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Instance PrepareInstance(FFOptions ffMpegOptions,
|
private Instance PrepareInstance(FFOptions ffOptions,
|
||||||
out CancellationTokenSource cancellationTokenSource)
|
out CancellationTokenSource cancellationTokenSource)
|
||||||
{
|
{
|
||||||
FFMpegHelper.RootExceptionCheck();
|
FFMpegHelper.RootExceptionCheck();
|
||||||
FFMpegHelper.VerifyFFMpegExists(ffMpegOptions);
|
FFMpegHelper.VerifyFFMpegExists(ffOptions);
|
||||||
var startInfo = new ProcessStartInfo
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions),
|
FileName = GlobalFFOptions.GetFFMpegBinaryPath(ffOptions),
|
||||||
Arguments = _ffMpegArguments.Text,
|
Arguments = _ffMpegArguments.Text,
|
||||||
StandardOutputEncoding = ffMpegOptions.Encoding,
|
StandardOutputEncoding = ffOptions.Encoding,
|
||||||
StandardErrorEncoding = ffMpegOptions.Encoding,
|
StandardErrorEncoding = ffOptions.Encoding,
|
||||||
|
WorkingDirectory = ffOptions.WorkingDirectory
|
||||||
};
|
};
|
||||||
var instance = new Instance(startInfo);
|
var instance = new Instance(startInfo);
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
|
@ -6,6 +6,11 @@ namespace FFMpegCore
|
||||||
{
|
{
|
||||||
public class FFOptions
|
public class FFOptions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Working directory for the ffmpeg/ffprobe instance
|
||||||
|
/// </summary>
|
||||||
|
public string WorkingDirectory { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Folder container ffmpeg and ffprobe binaries. Leave empty if ffmpeg and ffprobe are present in PATH
|
/// Folder container ffmpeg and ffprobe binaries. Leave empty if ffmpeg and ffprobe are present in PATH
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -165,7 +165,8 @@ private static Instance PrepareInstance(string arguments, int outputCapacity, FF
|
||||||
var startInfo = new ProcessStartInfo(GlobalFFOptions.GetFFProbeBinaryPath(), arguments)
|
var startInfo = new ProcessStartInfo(GlobalFFOptions.GetFFProbeBinaryPath(), arguments)
|
||||||
{
|
{
|
||||||
StandardOutputEncoding = ffOptions.Encoding,
|
StandardOutputEncoding = ffOptions.Encoding,
|
||||||
StandardErrorEncoding = ffOptions.Encoding
|
StandardErrorEncoding = ffOptions.Encoding,
|
||||||
|
WorkingDirectory = ffOptions.WorkingDirectory
|
||||||
};
|
};
|
||||||
var instance = new Instance(startInfo) { DataBufferCapacity = outputCapacity };
|
var instance = new Instance(startInfo) { DataBufferCapacity = outputCapacity };
|
||||||
return instance;
|
return instance;
|
||||||
|
|
Loading…
Reference in a new issue