mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
parent
f20c25d2ee
commit
4a6fb20aab
1 changed files with 11 additions and 11 deletions
|
@ -90,17 +90,6 @@ void OnCancelEvent(object sender, int timeout)
|
|||
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
|
||||
}
|
||||
|
||||
private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList<string> errorData)
|
||||
{
|
||||
if (throwOnError && exitCode != 0)
|
||||
throw new FFMpegProcessException(exitCode, string.Join("\n", errorData));
|
||||
|
||||
_onPercentageProgress?.Invoke(100.0);
|
||||
if (_totalTimespan.HasValue) _onTimeProgress?.Invoke(_totalTimespan.Value);
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> ProcessAsynchronously(bool throwOnError = true)
|
||||
{
|
||||
using var instance = PrepareInstance(out var cancellationTokenSource);
|
||||
|
@ -140,6 +129,17 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
|
|||
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
|
||||
}
|
||||
|
||||
private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList<string> errorData)
|
||||
{
|
||||
if (throwOnError && exitCode != 0)
|
||||
throw new FFMpegProcessException(exitCode, string.Join("\n", errorData));
|
||||
|
||||
_onPercentageProgress?.Invoke(100.0);
|
||||
if (_totalTimespan.HasValue) _onTimeProgress?.Invoke(_totalTimespan.Value);
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSource)
|
||||
{
|
||||
FFMpegHelper.RootExceptionCheck();
|
||||
|
|
Loading…
Reference in a new issue