Merge pull request #370 from jeroenvanderschoot/master

Add Uri support for Frame Analysis,

Former-commit-id: 1b883f7da9
This commit is contained in:
Malte Rosenbjerg 2023-01-31 20:44:00 +01:00 committed by GitHub
commit efe96428a8

View file

@ -89,6 +89,15 @@ public static async Task<IMediaAnalysis> AnalyseAsync(string filePath, FFOptions
return ParseOutput(result);
}
public static FFProbeFrames GetFrames(Uri uri, FFOptions? ffOptions = null)
{
var instance = PrepareFrameAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current);
var result = instance.StartAndWaitForExit();
ThrowIfExitCodeNotZero(result);
return ParseFramesOutput(result);
}
public static async Task<FFProbeFrames> GetFramesAsync(string filePath, FFOptions? ffOptions = null, CancellationToken cancellationToken = default)
{
ThrowIfInputFileDoesNotExist(filePath);
@ -141,6 +150,13 @@ public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, FFOptions?
return ParseOutput(result);
}
public static async Task<FFProbeFrames> GetFramesAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default)
{
var instance = PrepareFrameAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current);
var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false);
return ParseFramesOutput(result);
}
private static IMediaAnalysis ParseOutput(IProcessResult instance)
{
var json = string.Join(string.Empty, instance.OutputData);