diff --git a/src/FFMpeg/Exception/InvalidFileArgumentException.php b/src/FFMpeg/Exception/InvalidFileArgumentException.php new file mode 100644 index 0000000..1be9889 --- /dev/null +++ b/src/FFMpeg/Exception/InvalidFileArgumentException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Exception; + +class InvalidFileArgumentException extends \InvalidArgumentException +{ + +} diff --git a/src/FFMpeg/Exception/LogicException.php b/src/FFMpeg/Exception/LogicException.php new file mode 100644 index 0000000..f70b350 --- /dev/null +++ b/src/FFMpeg/Exception/LogicException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Exception; + +class LogicException extends \LogicException +{ + +} diff --git a/src/FFMpeg/Exception/RuntimeException.php b/src/FFMpeg/Exception/RuntimeException.php new file mode 100644 index 0000000..d5a9a4a --- /dev/null +++ b/src/FFMpeg/Exception/RuntimeException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Exception; + +class RuntimeException extends \RuntimeException +{ + +} diff --git a/src/FFMpeg/FFMpeg.php b/src/FFMpeg/FFMpeg.php index d4a5a62..6b5cd09 100644 --- a/src/FFMpeg/FFMpeg.php +++ b/src/FFMpeg/FFMpeg.php @@ -51,12 +51,13 @@ class FFMpeg extends Binary * @param int $height The height of the image * @return boolean True if success * @throws Exception\RuntimeException + * @throws Exception\LogicException */ public function extractImage($time, $output, $width, $height) { if ( ! $this->pathfile) { - throw new Exception\RuntimeException('No file open'); + throw new Exception\LogicException('No file open'); } $cmd = $this->binary @@ -99,12 +100,13 @@ class FFMpeg extends Binary * @param int $threads The number of threads to use * @return boolean True if success * @throws Exception\RuntimeException + * @throws Exception\LogicException */ public function encode(Format\AudioFormat $format, $outputPathfile, $threads = 1) { if ( ! $this->pathfile) { - throw new Exception\RuntimeException('No file open'); + throw new Exception\LogicException('No file open'); } $threads = max(min($threads, 64), 1); diff --git a/src/FFMpeg/FFProbe.php b/src/FFMpeg/FFProbe.php index 3e3389a..bcaf04f 100644 --- a/src/FFMpeg/FFProbe.php +++ b/src/FFMpeg/FFProbe.php @@ -27,6 +27,7 @@ class FFProbe extends Binary * @param string $pathfile * @return string * @throws Exception\InvalidFileArgumentException + * @throws Exception\RuntimeException */ public function probeFormat($pathfile) { @@ -46,6 +47,7 @@ class FFProbe extends Binary * @param string $pathfile * @return string * @throws Exception\InvalidFileArgumentException + * @throws Exception\RuntimeException */ public function probeStreams($pathfile) { @@ -56,14 +58,7 @@ class FFProbe extends Binary $cmd = $this->binary . ' ' . $pathfile . ' -show_streams'; - try - { - return $this->executeProbe($cmd); - } - catch (Exception\RuntimeException $e) - { - - } + return $this->executeProbe($cmd); } /**