mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-16 11:05:44 +00:00
27 lines
686 B
C#
27 lines
686 B
C#
using System.IO.Pipes;
|
|
using FFMpegCore.Pipes;
|
|
|
|
namespace FFMpegCore.Arguments;
|
|
|
|
public class OutputPipeArgument : PipeArgument, IOutputArgument
|
|
{
|
|
public readonly IPipeSink Reader;
|
|
|
|
public OutputPipeArgument(IPipeSink reader) : base(PipeDirection.In)
|
|
{
|
|
Reader = reader;
|
|
}
|
|
|
|
public override string Text => $"\"{PipePath}\" -y";
|
|
|
|
protected override async Task ProcessDataAsync(CancellationToken token)
|
|
{
|
|
await Pipe.WaitForConnectionAsync(token).ConfigureAwait(false);
|
|
if (!Pipe.IsConnected)
|
|
{
|
|
throw new TaskCanceledException();
|
|
}
|
|
|
|
await Reader.ReadAsync(Pipe, token).ConfigureAwait(false);
|
|
}
|
|
}
|