mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-16 19:15:44 +00:00
Compare commits
2 commits
1f164472c7
...
5fa92707e6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fa92707e6 | ||
|
|
a3e5042d78 |
1 changed files with 6 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ namespace FFMpegCore.Helpers
|
||||||
{
|
{
|
||||||
public static class FFMpegHelper
|
public static class FFMpegHelper
|
||||||
{
|
{
|
||||||
private static bool _ffmpegVerified;
|
private static string? _ffmpegPathVerified;
|
||||||
|
|
||||||
public static void ConversionSizeExceptionCheck(IMediaAnalysis info)
|
public static void ConversionSizeExceptionCheck(IMediaAnalysis info)
|
||||||
=> ConversionSizeExceptionCheck(info.PrimaryVideoStream!.Width, info.PrimaryVideoStream.Height);
|
=> ConversionSizeExceptionCheck(info.PrimaryVideoStream!.Width, info.PrimaryVideoStream.Height);
|
||||||
|
|
@ -37,22 +37,23 @@ namespace FFMpegCore.Helpers
|
||||||
|
|
||||||
public static void VerifyFFMpegExists(FFOptions ffMpegOptions)
|
public static void VerifyFFMpegExists(FFOptions ffMpegOptions)
|
||||||
{
|
{
|
||||||
if (_ffmpegVerified)
|
var binaryPath = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions);
|
||||||
|
if (_ffmpegPathVerified != null && _ffmpegPathVerified == binaryPath)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = Instance.Finish(GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), "-version");
|
var result = Instance.Finish(binaryPath, "-version");
|
||||||
_ffmpegVerified = result.ExitCode == 0;
|
_ffmpegPathVerified = result.ExitCode == 0 ? binaryPath : null;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system", e);
|
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_ffmpegVerified)
|
if (_ffmpegPathVerified == null)
|
||||||
{
|
{
|
||||||
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system");
|
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue