mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Minor adjustment
This commit is contained in:
parent
ef64263899
commit
82fc6e92c9
2 changed files with 8 additions and 8 deletions
|
@ -643,7 +643,7 @@ public async Task Video_Cancel_Async()
|
|||
{
|
||||
await using var resStream = new MemoryStream();
|
||||
var reader = new StreamPipeDataReader(resStream);
|
||||
var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(256, System.Drawing.Imaging.PixelFormat.Format24bppRgb, 128, 128));
|
||||
var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(512, System.Drawing.Imaging.PixelFormat.Format24bppRgb, 128, 128));
|
||||
|
||||
var task = FFMpegArguments
|
||||
.FromPipe(writer)
|
||||
|
@ -653,7 +653,7 @@ public async Task Video_Cancel_Async()
|
|||
.CancellableThrough(out var cancel)
|
||||
.ProcessAsynchronously(false);
|
||||
|
||||
await Task.Delay(100);
|
||||
await Task.Delay(300);
|
||||
cancel();
|
||||
|
||||
var result = await task;
|
||||
|
|
|
@ -26,7 +26,7 @@ internal FFMpegArgumentProcessor(FFMpegArguments ffMpegArguments)
|
|||
|
||||
public string Arguments => _ffMpegArguments.Text;
|
||||
|
||||
private event EventHandler _cancelEvent;
|
||||
private event EventHandler CancelEvent = null!;
|
||||
|
||||
public FFMpegArgumentProcessor NotifyOnProgress(Action<double> onPercentageProgress, TimeSpan totalTimeSpan)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public FFMpegArgumentProcessor NotifyOnProgress(Action<TimeSpan> onTimeProgress)
|
|||
}
|
||||
public FFMpegArgumentProcessor CancellableThrough(out Action cancel)
|
||||
{
|
||||
cancel = () => _cancelEvent?.Invoke(this, EventArgs.Empty);
|
||||
cancel = () => CancelEvent?.Invoke(this, EventArgs.Empty);
|
||||
return this;
|
||||
}
|
||||
public bool ProcessSynchronously(bool throwOnError = true)
|
||||
|
@ -53,7 +53,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
|||
instance?.SendInput("q");
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
_cancelEvent += OnCancelEvent;
|
||||
CancelEvent += OnCancelEvent;
|
||||
|
||||
_ffMpegArguments.Pre();
|
||||
try
|
||||
|
@ -70,7 +70,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
|||
}
|
||||
finally
|
||||
{
|
||||
_cancelEvent -= OnCancelEvent;
|
||||
CancelEvent -= OnCancelEvent;
|
||||
_ffMpegArguments.Post();
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
|||
instance?.SendInput("q");
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
_cancelEvent += OnCancelEvent;
|
||||
CancelEvent += OnCancelEvent;
|
||||
|
||||
_ffMpegArguments.Pre();
|
||||
try
|
||||
|
@ -109,7 +109,7 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
|
|||
}
|
||||
finally
|
||||
{
|
||||
_cancelEvent -= OnCancelEvent;
|
||||
CancelEvent -= OnCancelEvent;
|
||||
_ffMpegArguments.Post();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue