mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 10:05:44 +00:00
26 lines
815 B
C#
26 lines
815 B
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FFMpegCore.Pipes
|
|
{
|
|
/// <summary>
|
|
/// Implementation of <see cref="IPipeDataWriter"/> used for stream redirection
|
|
/// </summary>
|
|
public class StreamPipeDataWriter : IPipeDataWriter
|
|
{
|
|
public System.IO.Stream Source { get; }
|
|
public int BlockSize { get; } = 4096;
|
|
public string StreamFormat { get; } = string.Empty;
|
|
|
|
public StreamPipeDataWriter(System.IO.Stream stream)
|
|
{
|
|
Source = stream;
|
|
}
|
|
|
|
public void WriteData(System.IO.Stream pipe) => Source.CopyTo(pipe, BlockSize);
|
|
|
|
public Task WriteDataAsync(System.IO.Stream pipe, CancellationToken token) => Source.CopyToAsync(pipe, BlockSize, token);
|
|
|
|
public string GetFormat() => StreamFormat;
|
|
}
|
|
}
|