binext: improve ffmpeg check
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/653/head
parent
578b0645f4
commit
7e252fd56c
|
@ -402,20 +402,14 @@ class BinExt
|
||||||
return $ffmpegPath;
|
return $ffmpegPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function testFFmpeg(string $path, string $vername)
|
public static function testFFmpeg(string $path, string $name)
|
||||||
{
|
{
|
||||||
$version = shell_exec("{$path} -version");
|
$version = shell_exec("{$path} -version");
|
||||||
if (!preg_match("/{$vername} version\\s+([0-9\\.]+)/", $version, $matches)) {
|
if (!preg_match("/{$name} version \\S*/", $version, $matches)) {
|
||||||
throw new \Exception("failed to detect version, found {$version}");
|
throw new \Exception("failed to detect version, found {$version}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$minver = '4.0';
|
return explode(' ', $matches[0])[2];
|
||||||
$semver = $matches[1];
|
|
||||||
if (!version_compare($semver, $minver, '>=')) {
|
|
||||||
throw new \Exception("version must be >= {$minver}, found {$semver}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $semver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function testSystemPerl(string $path): string
|
public static function testSystemPerl(string $path): string
|
||||||
|
|
Loading…
Reference in New Issue