scratch – Blame information for rev 120

Subversion Repositories:
Rev:
Rev Author Line No. Line
120 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;
13  
14 use Doctrine\Common\Cache\ArrayCache;
15 use Silex\Application;
16 use Silex\ServiceProviderInterface;
17  
18 class FFMpegServiceProvider implements ServiceProviderInterface
19 {
20 public function register(Application $app)
21 {
22 $app['ffmpeg.configuration'] = array();
23 $app['ffmpeg.default.configuration'] = array(
24 'ffmpeg.threads' => 4,
25 'ffmpeg.timeout' => 300,
26 'ffmpeg.binaries' => array('avconv', 'ffmpeg'),
27 'ffprobe.timeout' => 30,
28 'ffprobe.binaries' => array('avprobe', 'ffprobe'),
29 );
30 $app['ffmpeg.logger'] = null;
31  
32 $app['ffmpeg.configuration.build'] = $app->share(function (Application $app) {
33 return array_replace($app['ffmpeg.default.configuration'], $app['ffmpeg.configuration']);
34 });
35  
36 $app['ffmpeg'] = $app['ffmpeg.ffmpeg'] = $app->share(function (Application $app) {
37 $configuration = $app['ffmpeg.configuration.build'];
38  
39 if (isset($configuration['ffmpeg.timeout'])) {
40 $configuration['timeout'] = $configuration['ffmpeg.timeout'];
41 }
42  
43 return FFMpeg::create($configuration, $app['ffmpeg.logger'], $app['ffmpeg.ffprobe']);
44 });
45  
46 $app['ffprobe.cache'] = $app->share(function () {
47 return new ArrayCache();
48 });
49  
50 $app['ffmpeg.ffprobe'] = $app->share(function (Application $app) {
51 $configuration = $app['ffmpeg.configuration.build'];
52  
53 if (isset($configuration['ffmpeg.timeout'])) {
54 $configuration['timeout'] = $configuration['ffprobe.timeout'];
55 }
56  
57 return FFProbe::create($configuration, $app['ffmpeg.logger'], $app['ffprobe.cache']);
58 });
59 }
60  
61 public function boot(Application $app)
62 {
63 }
64 }