scratch – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 /*
4 * This file is part of PHP-FFmpeg.
5 *
6 * (c) Alchemy <info@alchemy.fr>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11  
12 namespace FFMpeg\Driver;
13  
14 use Alchemy\BinaryDriver\AbstractBinary;
15 use Alchemy\BinaryDriver\Configuration;
16 use Alchemy\BinaryDriver\ConfigurationInterface;
17 use Alchemy\BinaryDriver\Exception\ExecutableNotFoundException as BinaryDriverExecutableNotFound;
18 use FFMpeg\Exception\ExecutableNotFoundException;
19 use Psr\Log\LoggerInterface;
20  
21 class FFMpegDriver extends AbstractBinary
22 {
23 /**
24 * {@inheritdoc}
25 */
26 public function getName()
27 {
28 return 'ffmpeg';
29 }
30  
31 /**
32 * Creates an FFMpegDriver.
33 *
34 * @param LoggerInterface $logger
35 * @param array|Configuration $configuration
36 *
37 * @return FFMpegDriver
38 */
39 public static function create(LoggerInterface $logger = null, $configuration = array())
40 {
41 if (!$configuration instanceof ConfigurationInterface) {
42 $configuration = new Configuration($configuration);
43 }
44  
45 $binaries = $configuration->get('ffmpeg.binaries', array('avconv', 'ffmpeg'));
46  
47 if (!$configuration->has('timeout')) {
48 $configuration->set('timeout', 300);
49 }
50  
51 try {
52 return static::load($binaries, $logger, $configuration);
53 } catch (BinaryDriverExecutableNotFound $e) {
54 throw new ExecutableNotFoundException('Unable to load FFMpeg', $e->getCode(), $e);
55 }
56 }
57 }