mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Cancel on exit
This commit is contained in:
parent
26f5b0f4f4
commit
31685da18a
1 changed files with 1 additions and 1 deletions
|
@ -55,6 +55,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
||||||
cancellationTokenSource.Cancel();
|
cancellationTokenSource.Cancel();
|
||||||
}
|
}
|
||||||
CancelEvent += OnCancelEvent;
|
CancelEvent += OnCancelEvent;
|
||||||
|
instance.Exited += delegate { cancellationTokenSource.Cancel(); };
|
||||||
|
|
||||||
_ffMpegArguments.Pre();
|
_ffMpegArguments.Pre();
|
||||||
try
|
try
|
||||||
|
@ -128,7 +129,6 @@ private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSo
|
||||||
FFMpegHelper.RootExceptionCheck();
|
FFMpegHelper.RootExceptionCheck();
|
||||||
FFMpegHelper.VerifyFFMpegExists();
|
FFMpegHelper.VerifyFFMpegExists();
|
||||||
var instance = new Instance(FFMpegOptions.Options.FFmpegBinary(), _ffMpegArguments.Text);
|
var instance = new Instance(FFMpegOptions.Options.FFmpegBinary(), _ffMpegArguments.Text);
|
||||||
instance.DataReceived += OutputData;
|
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))
|
if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))
|
||||||
|
|
Loading…
Reference in a new issue