mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 00:24:14 +01:00
Support for specyfying process working directory through FFOptions (#272)
This commit is contained in:
parent
bdb12aa48a
commit
c2d28055c1
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;
|
||||
}
|
||||
|
||||
private Instance PrepareInstance(FFOptions ffMpegOptions,
|
||||
private Instance PrepareInstance(FFOptions ffOptions,
|
||||
out CancellationTokenSource cancellationTokenSource)
|
||||
{
|
||||
FFMpegHelper.RootExceptionCheck();
|
||||
FFMpegHelper.VerifyFFMpegExists(ffMpegOptions);
|
||||
FFMpegHelper.VerifyFFMpegExists(ffOptions);
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions),
|
||||
FileName = GlobalFFOptions.GetFFMpegBinaryPath(ffOptions),
|
||||
Arguments = _ffMpegArguments.Text,
|
||||
StandardOutputEncoding = ffMpegOptions.Encoding,
|
||||
StandardErrorEncoding = ffMpegOptions.Encoding,
|
||||
StandardOutputEncoding = ffOptions.Encoding,
|
||||
StandardErrorEncoding = ffOptions.Encoding,
|
||||
WorkingDirectory = ffOptions.WorkingDirectory
|
||||
};
|
||||
var instance = new Instance(startInfo);
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
|
|
|
@ -6,6 +6,11 @@ namespace FFMpegCore
|
|||
{
|
||||
public class FFOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Working directory for the ffmpeg/ffprobe instance
|
||||
/// </summary>
|
||||
public string WorkingDirectory { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Folder container ffmpeg and ffprobe binaries. Leave empty if ffmpeg and ffprobe are present in PATH
|
||||
/// </summary>
|
||||
|
|
|
@ -165,7 +165,8 @@ private static Instance PrepareInstance(string arguments, int outputCapacity, FF
|
|||
var startInfo = new ProcessStartInfo(GlobalFFOptions.GetFFProbeBinaryPath(), arguments)
|
||||
{
|
||||
StandardOutputEncoding = ffOptions.Encoding,
|
||||
StandardErrorEncoding = ffOptions.Encoding
|
||||
StandardErrorEncoding = ffOptions.Encoding,
|
||||
WorkingDirectory = ffOptions.WorkingDirectory
|
||||
};
|
||||
var instance = new Instance(startInfo) { DataBufferCapacity = outputCapacity };
|
||||
return instance;
|
||||
|
|
Loading…
Reference in a new issue