FromStream method to Video Info & added comments to FFprobe methods with stream

This commit is contained in:
Максим Багрянцев 2020-04-28 15:44:27 +03:00
parent cfda0fc9ae
commit f56ea098a5
2 changed files with 20 additions and 0 deletions

View file

@ -67,6 +67,11 @@ public async Task<VideoInfo> ParseVideoInfoAsync(VideoInfo info)
return ParseVideoInfoInternal(info, output); return ParseVideoInfoInternal(info, output);
} }
/// <summary>
/// Probes the targeted video stream and retrieves all available details.
/// </summary>
/// <param name="stream">Encoded video stream.</param>
/// <returns>A video info object containing all details necessary.</returns>
public VideoInfo ParseVideoInfo(System.IO.Stream stream) public VideoInfo ParseVideoInfo(System.IO.Stream stream)
{ {
var info = new VideoInfo(); var info = new VideoInfo();
@ -92,6 +97,11 @@ public VideoInfo ParseVideoInfo(System.IO.Stream stream)
return ParseVideoInfoInternal(info, output); return ParseVideoInfoInternal(info, output);
} }
/// <summary>
/// Probes the targeted video stream asynchronously and retrieves all available details.
/// </summary>
/// <param name="stream">Encoded video stream.</param>
/// <returns>A video info object containing all details necessary.</returns>
public async Task<VideoInfo> ParseVideoInfoAsync(System.IO.Stream stream) public async Task<VideoInfo> ParseVideoInfoAsync(System.IO.Stream stream)
{ {
var info = new VideoInfo(); var info = new VideoInfo();

View file

@ -132,6 +132,16 @@ public static VideoInfo FromPath(string path)
return new VideoInfo(path); return new VideoInfo(path);
} }
/// <summary>
/// Create a video information object from a encoded stream.
/// </summary>
/// <param name="stream">Encoded video stream.</param>
/// <returns></returns>
public static VideoInfo FromStream(System.IO.Stream stream)
{
return new FFProbe().ParseVideoInfo(stream);
}
/// <summary> /// <summary>
/// Pretty prints the video information. /// Pretty prints the video information.
/// </summary> /// </summary>