mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-18 20:15:45 +00:00
Compare commits
5 commits
04dd56f2f4
...
524803c88b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
524803c88b | ||
|
|
65cbc5552c | ||
|
|
8f9930ad2a | ||
|
|
c3e80a7af6 | ||
|
|
5f906af57f |
1 changed files with 7 additions and 7 deletions
|
|
@ -84,8 +84,7 @@ public static class FFProbe
|
||||||
|
|
||||||
var instance = PrepareStreamAnalysisInstance(filePath, ffOptions ?? GlobalFFOptions.Current, customArguments);
|
var instance = PrepareStreamAnalysisInstance(filePath, ffOptions ?? GlobalFFOptions.Current, customArguments);
|
||||||
var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
ThrowIfExitCodeNotZero(result, cancellationToken);
|
||||||
ThrowIfExitCodeNotZero(result);
|
|
||||||
|
|
||||||
return ParseOutput(result);
|
return ParseOutput(result);
|
||||||
}
|
}
|
||||||
|
|
@ -124,8 +123,7 @@ public static class FFProbe
|
||||||
{
|
{
|
||||||
var instance = PrepareStreamAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current, customArguments);
|
var instance = PrepareStreamAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current, customArguments);
|
||||||
var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
ThrowIfExitCodeNotZero(result, cancellationToken);
|
||||||
ThrowIfExitCodeNotZero(result);
|
|
||||||
|
|
||||||
return ParseOutput(result);
|
return ParseOutput(result);
|
||||||
}
|
}
|
||||||
|
|
@ -152,8 +150,7 @@ public static class FFProbe
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await task.ConfigureAwait(false);
|
var result = await task.ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
ThrowIfExitCodeNotZero(result, cancellationToken);
|
||||||
ThrowIfExitCodeNotZero(result);
|
|
||||||
|
|
||||||
pipeArgument.Post();
|
pipeArgument.Post();
|
||||||
return ParseOutput(result);
|
return ParseOutput(result);
|
||||||
|
|
@ -215,10 +212,13 @@ public static class FFProbe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ThrowIfExitCodeNotZero(IProcessResult result)
|
private static void ThrowIfExitCodeNotZero(IProcessResult result, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (result.ExitCode != 0)
|
if (result.ExitCode != 0)
|
||||||
{
|
{
|
||||||
|
// if cancellation requested, then we are not interested in the exit code, just throw the cancellation exception
|
||||||
|
// to get consistent and expected behavior.
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
var message = $"ffprobe exited with non-zero exit-code ({result.ExitCode} - {string.Join("\n", result.ErrorData)})";
|
var message = $"ffprobe exited with non-zero exit-code ({result.ExitCode} - {string.Join("\n", result.ErrorData)})";
|
||||||
throw new FFMpegException(FFMpegExceptionType.Process, message, null, string.Join("\n", result.ErrorData));
|
throw new FFMpegException(FFMpegExceptionType.Process, message, null, string.Join("\n", result.ErrorData));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue