mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Check for existence before analysing with ffprobe
This commit is contained in:
parent
adbd61c51d
commit
61387fa5be
1 changed files with 7 additions and 1 deletions
|
@ -14,6 +14,9 @@ public static class FFProbe
|
||||||
{
|
{
|
||||||
public static IMediaAnalysis Analyse(string filePath, int outputCapacity = int.MaxValue)
|
public static IMediaAnalysis Analyse(string filePath, int outputCapacity = int.MaxValue)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
throw new FFMpegException(FFMpegExceptionType.File, $"No file found at '{filePath}'");
|
||||||
|
|
||||||
using var instance = PrepareInstance(filePath, outputCapacity);
|
using var instance = PrepareInstance(filePath, outputCapacity);
|
||||||
instance.BlockUntilFinished();
|
instance.BlockUntilFinished();
|
||||||
return ParseOutput(filePath, instance);
|
return ParseOutput(filePath, instance);
|
||||||
|
@ -24,7 +27,7 @@ public static IMediaAnalysis Analyse(Uri uri, int outputCapacity = int.MaxValue)
|
||||||
instance.BlockUntilFinished();
|
instance.BlockUntilFinished();
|
||||||
return ParseOutput(uri.AbsoluteUri, instance);
|
return ParseOutput(uri.AbsoluteUri, instance);
|
||||||
}
|
}
|
||||||
public static IMediaAnalysis Analyse(System.IO.Stream stream, int outputCapacity = int.MaxValue)
|
public static IMediaAnalysis Analyse(Stream stream, int outputCapacity = int.MaxValue)
|
||||||
{
|
{
|
||||||
var streamPipeSource = new StreamPipeSource(stream);
|
var streamPipeSource = new StreamPipeSource(stream);
|
||||||
var pipeArgument = new InputPipeArgument(streamPipeSource);
|
var pipeArgument = new InputPipeArgument(streamPipeSource);
|
||||||
|
@ -49,6 +52,9 @@ public static IMediaAnalysis Analyse(System.IO.Stream stream, int outputCapacity
|
||||||
}
|
}
|
||||||
public static async Task<IMediaAnalysis> AnalyseAsync(string filePath, int outputCapacity = int.MaxValue)
|
public static async Task<IMediaAnalysis> AnalyseAsync(string filePath, int outputCapacity = int.MaxValue)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
throw new FFMpegException(FFMpegExceptionType.File, $"No file found at '{filePath}'");
|
||||||
|
|
||||||
using var instance = PrepareInstance(filePath, outputCapacity);
|
using var instance = PrepareInstance(filePath, outputCapacity);
|
||||||
await instance.FinishedRunning();
|
await instance.FinishedRunning();
|
||||||
return ParseOutput(filePath, instance);
|
return ParseOutput(filePath, instance);
|
||||||
|
|
Loading…
Reference in a new issue