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();
|
await using var resStream = new MemoryStream();
|
||||||
var reader = new StreamPipeDataReader(resStream);
|
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
|
var task = FFMpegArguments
|
||||||
.FromPipe(writer)
|
.FromPipe(writer)
|
||||||
|
@ -653,7 +653,7 @@ public async Task Video_Cancel_Async()
|
||||||
.CancellableThrough(out var cancel)
|
.CancellableThrough(out var cancel)
|
||||||
.ProcessAsynchronously(false);
|
.ProcessAsynchronously(false);
|
||||||
|
|
||||||
await Task.Delay(100);
|
await Task.Delay(300);
|
||||||
cancel();
|
cancel();
|
||||||
|
|
||||||
var result = await task;
|
var result = await task;
|
||||||
|
|
|
@ -26,7 +26,7 @@ internal FFMpegArgumentProcessor(FFMpegArguments ffMpegArguments)
|
||||||
|
|
||||||
public string Arguments => _ffMpegArguments.Text;
|
public string Arguments => _ffMpegArguments.Text;
|
||||||
|
|
||||||
private event EventHandler _cancelEvent;
|
private event EventHandler CancelEvent = null!;
|
||||||
|
|
||||||
public FFMpegArgumentProcessor NotifyOnProgress(Action<double> onPercentageProgress, TimeSpan totalTimeSpan)
|
public FFMpegArgumentProcessor NotifyOnProgress(Action<double> onPercentageProgress, TimeSpan totalTimeSpan)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ public FFMpegArgumentProcessor NotifyOnProgress(Action<TimeSpan> onTimeProgress)
|
||||||
}
|
}
|
||||||
public FFMpegArgumentProcessor CancellableThrough(out Action cancel)
|
public FFMpegArgumentProcessor CancellableThrough(out Action cancel)
|
||||||
{
|
{
|
||||||
cancel = () => _cancelEvent?.Invoke(this, EventArgs.Empty);
|
cancel = () => CancelEvent?.Invoke(this, EventArgs.Empty);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public bool ProcessSynchronously(bool throwOnError = true)
|
public bool ProcessSynchronously(bool throwOnError = true)
|
||||||
|
@ -53,7 +53,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
||||||
instance?.SendInput("q");
|
instance?.SendInput("q");
|
||||||
cancellationTokenSource.Cancel();
|
cancellationTokenSource.Cancel();
|
||||||
}
|
}
|
||||||
_cancelEvent += OnCancelEvent;
|
CancelEvent += OnCancelEvent;
|
||||||
|
|
||||||
_ffMpegArguments.Pre();
|
_ffMpegArguments.Pre();
|
||||||
try
|
try
|
||||||
|
@ -70,7 +70,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_cancelEvent -= OnCancelEvent;
|
CancelEvent -= OnCancelEvent;
|
||||||
_ffMpegArguments.Post();
|
_ffMpegArguments.Post();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void OnCancelEvent(object sender, EventArgs args)
|
||||||
instance?.SendInput("q");
|
instance?.SendInput("q");
|
||||||
cancellationTokenSource.Cancel();
|
cancellationTokenSource.Cancel();
|
||||||
}
|
}
|
||||||
_cancelEvent += OnCancelEvent;
|
CancelEvent += OnCancelEvent;
|
||||||
|
|
||||||
_ffMpegArguments.Pre();
|
_ffMpegArguments.Pre();
|
||||||
try
|
try
|
||||||
|
@ -109,7 +109,7 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_cancelEvent -= OnCancelEvent;
|
CancelEvent -= OnCancelEvent;
|
||||||
_ffMpegArguments.Post();
|
_ffMpegArguments.Post();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue