mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 01:55:45 +00:00
Extract method for reuse
This commit is contained in:
parent
4baddaab7f
commit
670986dcb2
1 changed files with 9 additions and 10 deletions
|
|
@ -78,23 +78,22 @@ public class FFMpegArgumentProcessor
|
|||
return this;
|
||||
}
|
||||
|
||||
public FFMpegArgumentProcessor CancellableThrough(out Action cancel, int timeout = 0)
|
||||
{
|
||||
cancel = () =>
|
||||
private void Cancel(int timeout)
|
||||
{
|
||||
_cancelled = true;
|
||||
CancelEvent?.Invoke(this, timeout);
|
||||
};
|
||||
}
|
||||
|
||||
public FFMpegArgumentProcessor CancellableThrough(out Action cancel, int timeout = 0)
|
||||
{
|
||||
cancel = () => Cancel(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public FFMpegArgumentProcessor CancellableThrough(CancellationToken token, int timeout = 0)
|
||||
{
|
||||
_cancellationTokenRegistration = token.Register(() =>
|
||||
{
|
||||
_cancelled = true;
|
||||
CancelEvent?.Invoke(this, timeout);
|
||||
});
|
||||
_cancellationTokenRegistration = token.Register(() => Cancel(timeout));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue