mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Updated FFProbe
This commit is contained in:
parent
06f5c319ad
commit
11edbbea2b
1 changed files with 15 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
||||||
using Instances;
|
using Instances;
|
||||||
using FFMpegCore.FFMPEG.Argument;
|
using FFMpegCore.FFMPEG.Argument;
|
||||||
using FFMpegCore.FFMPEG.Pipes;
|
using FFMpegCore.FFMPEG.Pipes;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace FFMpegCore.FFMPEG
|
namespace FFMpegCore.FFMPEG
|
||||||
{
|
{
|
||||||
|
@ -81,18 +82,23 @@ public VideoInfo ParseVideoInfo(System.IO.Stream stream)
|
||||||
var instance = new Instance(_ffprobePath, BuildFFProbeArguments(pipeArgument.PipePath)) { DataBufferCapacity = _outputCapacity };
|
var instance = new Instance(_ffprobePath, BuildFFProbeArguments(pipeArgument.PipePath)) { DataBufferCapacity = _outputCapacity };
|
||||||
pipeArgument.OpenPipe();
|
pipeArgument.OpenPipe();
|
||||||
|
|
||||||
|
var task = instance.FinishedRunning();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var task = instance.FinishedRunning();
|
pipeArgument.ProcessDataAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
pipeArgument.FlushPipe();
|
|
||||||
pipeArgument.ClosePipe();
|
pipeArgument.ClosePipe();
|
||||||
task.Wait();
|
}
|
||||||
|
catch(IOException)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
pipeArgument.ClosePipe();
|
pipeArgument.ClosePipe();
|
||||||
}
|
}
|
||||||
|
var exitCode = task.ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
if (exitCode != 0)
|
||||||
|
throw new FFMpegException(FFMpegExceptionType.Process, "FFProbe process returned exit status " + exitCode);
|
||||||
var output = string.Join("", instance.OutputData);
|
var output = string.Join("", instance.OutputData);
|
||||||
return ParseVideoInfoInternal(info, output);
|
return ParseVideoInfoInternal(info, output);
|
||||||
}
|
}
|
||||||
|
@ -111,17 +117,20 @@ public async Task<VideoInfo> ParseVideoInfoAsync(System.IO.Stream stream)
|
||||||
var instance = new Instance(_ffprobePath, BuildFFProbeArguments(pipeArgument.PipePath)) { DataBufferCapacity = _outputCapacity };
|
var instance = new Instance(_ffprobePath, BuildFFProbeArguments(pipeArgument.PipePath)) { DataBufferCapacity = _outputCapacity };
|
||||||
pipeArgument.OpenPipe();
|
pipeArgument.OpenPipe();
|
||||||
|
|
||||||
|
var task = instance.FinishedRunning();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var task = instance.FinishedRunning();
|
await pipeArgument.ProcessDataAsync();
|
||||||
await pipeArgument.FlushPipeAsync();
|
|
||||||
pipeArgument.ClosePipe();
|
pipeArgument.ClosePipe();
|
||||||
await task;
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
pipeArgument.ClosePipe();
|
pipeArgument.ClosePipe();
|
||||||
}
|
}
|
||||||
|
var exitCode = await task;
|
||||||
|
|
||||||
var output = string.Join("", instance.OutputData);
|
var output = string.Join("", instance.OutputData);
|
||||||
return ParseVideoInfoInternal(info, output);
|
return ParseVideoInfoInternal(info, output);
|
||||||
|
|
Loading…
Reference in a new issue