Compare commits

..

No commits in common. "5fa92707e6278bd31b16be388608666dcac4708a" and "1f164472c70205d03fbc380e192463084e07e43a" have entirely different histories.

View file

@ -5,7 +5,7 @@ namespace FFMpegCore.Helpers
{ {
public static class FFMpegHelper public static class FFMpegHelper
{ {
private static string? _ffmpegPathVerified; private static bool _ffmpegVerified;
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,23 +37,22 @@ namespace FFMpegCore.Helpers
public static void VerifyFFMpegExists(FFOptions ffMpegOptions) public static void VerifyFFMpegExists(FFOptions ffMpegOptions)
{ {
var binaryPath = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions); if (_ffmpegVerified)
if (_ffmpegPathVerified != null && _ffmpegPathVerified == binaryPath)
{ {
return; return;
} }
try try
{ {
var result = Instance.Finish(binaryPath, "-version"); var result = Instance.Finish(GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), "-version");
_ffmpegPathVerified = result.ExitCode == 0 ? binaryPath : null; _ffmpegVerified = result.ExitCode == 0;
} }
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 (_ffmpegPathVerified == null) if (!_ffmpegVerified)
{ {
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system"); throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system");
} }