mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 18:15:44 +00:00
25 lines
742 B
C#
25 lines
742 B
C#
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FFMpegCore.Pipes
|
|
{
|
|
/// <summary>
|
|
/// Implementation of <see cref="IPipeSource"/> used for stream redirection
|
|
/// </summary>
|
|
public class StreamPipeSource : IPipeSource
|
|
{
|
|
public Stream Source { get; }
|
|
public int BlockSize { get; } = 4096;
|
|
public string StreamFormat { get; } = string.Empty;
|
|
|
|
public StreamPipeSource(Stream source)
|
|
{
|
|
Source = source;
|
|
}
|
|
|
|
public string GetStreamArguments() => StreamFormat;
|
|
|
|
public Task WriteAsync(Stream outputStream, CancellationToken cancellationToken) => Source.CopyToAsync(outputStream, BlockSize, cancellationToken);
|
|
}
|
|
}
|