Fix #44 : throw an exception in case of older ffprobe

This commit is contained in:
Romain Neutron 2013-07-03 20:53:12 +02:00
commit 3bdb341abb
2 changed files with 26 additions and 1 deletions

View file

@ -11,8 +11,10 @@
namespace FFMpeg\FFProbe;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Doctrine\Common\Cache\Cache;
use FFMpeg\Driver\FFProbeDriver;
use FFMpeg\Exception\RuntimeException;
class OptionsTester implements OptionsTesterInterface
{
@ -55,7 +57,11 @@ class OptionsTester implements OptionsTesterInterface
return $this->cache->fetch($id);
}
$output = $this->ffprobe->command(array('-help', '-loglevel', 'quiet'));
try {
$output = $this->ffprobe->command(array('-help', '-loglevel', 'quiet'));
} catch (ExecutionFailureException $e) {
throw new RuntimeException('Your FFProbe version is too old and does not support `-help` option, please upgrade.', $e->getCode(), $e);
}
$this->cache->save($id, $output);