Renamed IPipeSource to IpipeDataWriter

This commit is contained in:
Максим Багрянцев 2020-04-28 18:42:50 +03:00
parent 8434ffbba6
commit b7099f6709
5 changed files with 20 additions and 20 deletions

View file

@ -17,11 +17,11 @@ public class InputPipeArgument : Argument
{
public string PipeName { get; private set; }
public string PipePath => PipeHelpers.GetPipePath(PipeName);
public IPipeSource Source { get; private set; }
public IPipeDataWriter Source { get; private set; }
private NamedPipeServerStream pipe;
public InputPipeArgument(IPipeSource source)
public InputPipeArgument(IPipeDataWriter source)
{
Source = source;
PipeName = PipeHelpers.GetUnqiuePipeName();
@ -49,14 +49,14 @@ public override string GetStringValue()
public void FlushPipe()
{
pipe.WaitForConnection();
Source.FlushData(pipe);
Source.WriteData(pipe);
}
public async Task FlushPipeAsync()
{
await pipe.WaitForConnectionAsync();
await Source.FlushDataAsync(pipe);
await Source.WriteDataAsync(pipe);
}
}
}

View file

@ -9,10 +9,10 @@ namespace FFMpegCore.FFMPEG.Pipes
/// <summary>
/// Interface for ffmpeg pipe source data IO
/// </summary>
public interface IPipeSource
public interface IPipeDataWriter
{
string GetFormat();
void FlushData(System.IO.Stream pipe);
Task FlushDataAsync(System.IO.Stream pipe);
void WriteData(System.IO.Stream pipe);
Task WriteDataAsync(System.IO.Stream pipe);
}
}

View file

@ -7,9 +7,9 @@
namespace FFMpegCore.FFMPEG.Pipes
{
/// <summary>
/// Implementation of <see cref="IPipeSource"/> for a raw video stream that is gathered from <see cref="IEnumerator{IVideoFrame}"/>
/// Implementation of <see cref="IPipeDataWriter"/> for a raw video stream that is gathered from <see cref="IEnumerator{IVideoFrame}"/>
/// </summary>
public class RawVideoPipeSource : IPipeSource
public class RawVideoPipeDataWriter : IPipeDataWriter
{
public string StreamFormat { get; set; }
public int Width { get; set; }
@ -17,12 +17,12 @@ public class RawVideoPipeSource : IPipeSource
public int FrameRate { get; set; } = 25;
private IEnumerator<IVideoFrame> framesEnumerator;
public RawVideoPipeSource(IEnumerator<IVideoFrame> framesEnumerator)
public RawVideoPipeDataWriter(IEnumerator<IVideoFrame> framesEnumerator)
{
this.framesEnumerator = framesEnumerator;
}
public RawVideoPipeSource(IEnumerable<IVideoFrame> framesEnumerator) : this(framesEnumerator.GetEnumerator()) { }
public RawVideoPipeDataWriter(IEnumerable<IVideoFrame> framesEnumerator) : this(framesEnumerator.GetEnumerator()) { }
public string GetFormat()
{
@ -40,7 +40,7 @@ public string GetFormat()
return $"-f rawvideo -r {FrameRate} -pix_fmt {StreamFormat} -s {Width}x{Height}";
}
public void FlushData(System.IO.Stream stream)
public void WriteData(System.IO.Stream stream)
{
if (framesEnumerator.Current != null)
{
@ -53,7 +53,7 @@ public void FlushData(System.IO.Stream stream)
}
}
public async Task FlushDataAsync(System.IO.Stream stream)
public async Task WriteDataAsync(System.IO.Stream stream)
{
if (framesEnumerator.Current != null)
{

View file

@ -5,12 +5,12 @@
namespace FFMpegCore.FFMPEG.Pipes
{
public class StreamPipedataReader : IPipeDataReader
public class StreamPipeDataReader : IPipeDataReader
{
public System.IO.Stream DestanationStream { get; private set; }
public int BlockSize { get; set; } = 4096;
public StreamPipedataReader(System.IO. Stream destanationStream)
public StreamPipeDataReader(System.IO. Stream destanationStream)
{
DestanationStream = destanationStream;
}

View file

@ -6,19 +6,19 @@
namespace FFMpegCore.FFMPEG.Pipes
{
/// <summary>
/// Implementation of <see cref="IPipeSource"/> used for stream redirection
/// Implementation of <see cref="IPipeDataWriter"/> used for stream redirection
/// </summary>
public class StreamPipeSource : IPipeSource
public class StreamPipeDataWriter : IPipeDataWriter
{
public System.IO.Stream Source { get; private set; }
public int BlockSize { get; set; } = 4096;
public StreamPipeSource(System.IO.Stream stream)
public StreamPipeDataWriter(System.IO.Stream stream)
{
Source = stream;
}
public void FlushData(System.IO.Stream pipe)
public void WriteData(System.IO.Stream pipe)
{
var buffer = new byte[BlockSize];
int read;
@ -28,7 +28,7 @@ public void FlushData(System.IO.Stream pipe)
}
}
public async Task FlushDataAsync(System.IO.Stream pipe)
public async Task WriteDataAsync(System.IO.Stream pipe)
{
var buffer = new byte[BlockSize];
int read;