mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2026-01-15 01:15:45 +00:00
Update FFProbe URI overload to handle file based URIs
This commit is contained in:
parent
c66ad474e0
commit
68d359b57e
2 changed files with 14 additions and 2 deletions
|
|
@ -43,6 +43,18 @@ public class FFProbeTests
|
||||||
Assert.IsTrue(frameAnalysis.Frames.All(f => f.MediaType == "video"));
|
Assert.IsTrue(frameAnalysis.Frames.All(f => f.MediaType == "video"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void FrameAnalysis_FromUri_Sync()
|
||||||
|
{
|
||||||
|
var frameAnalysis = FFProbe.GetFrames(new Uri(Path.GetFullPath(TestResources.WebmVideo)));
|
||||||
|
|
||||||
|
Assert.HasCount(90, frameAnalysis.Frames);
|
||||||
|
Assert.IsTrue(frameAnalysis.Frames.All(f => f.PixelFormat == "yuv420p"));
|
||||||
|
Assert.IsTrue(frameAnalysis.Frames.All(f => f.Height == 360));
|
||||||
|
Assert.IsTrue(frameAnalysis.Frames.All(f => f.Width == 640));
|
||||||
|
Assert.IsTrue(frameAnalysis.Frames.All(f => f.MediaType == "video"));
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task FrameAnalysis_Async()
|
public async Task FrameAnalysis_Async()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public static class FFProbe
|
||||||
public static async Task<IMediaAnalysis> AnalyseAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
public static async Task<IMediaAnalysis> AnalyseAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
||||||
string? customArguments = null)
|
string? customArguments = null)
|
||||||
{
|
{
|
||||||
return await AnalyseCoreAsync(uri.AbsoluteUri, ffOptions, cancellationToken, customArguments).ConfigureAwait(false);
|
return await AnalyseCoreAsync(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri, ffOptions, cancellationToken, customArguments).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
||||||
|
|
@ -88,7 +88,7 @@ public static class FFProbe
|
||||||
public static async Task<FFProbeFrames> GetFramesAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
public static async Task<FFProbeFrames> GetFramesAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
||||||
string? customArguments = null)
|
string? customArguments = null)
|
||||||
{
|
{
|
||||||
return await GetFramesCoreAsync(uri.AbsoluteUri, ffOptions, cancellationToken, customArguments).ConfigureAwait(false);
|
return await GetFramesCoreAsync(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri, ffOptions, cancellationToken, customArguments).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<FFProbeFrames> GetFramesAsync(Stream stream, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
public static async Task<FFProbeFrames> GetFramesAsync(Stream stream, FFOptions? ffOptions = null, CancellationToken cancellationToken = default,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue