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 <dev.team@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\Filters\Frame;
13  
14 use FFMpeg\Exception\RuntimeException;
15 use FFMpeg\Media\Frame;
16  
17 class DisplayRatioFixerFilter implements FrameFilterInterface
18 {
19 /** @var integer */
20 private $priority;
21  
22 public function __construct($priority = 0)
23 {
24 $this->priority = $priority;
25 }
26  
27 /**
28 * {@inheritdoc}
29 */
30 public function getPriority()
31 {
32 return $this->priority;
33 }
34  
35 /**
36 * {@inheritdoc}
37 */
38 public function apply(Frame $frame)
39 {
40 $dimensions = null;
41 $commands = array();
42  
43 foreach ($frame->getVideo()->getStreams() as $stream) {
44 if ($stream->isVideo()) {
45 try {
46 $dimensions = $stream->getDimensions();
47 $commands[] = '-s';
48 $commands[] = $dimensions->getWidth() . 'x' . $dimensions->getHeight();
49 break;
50 } catch (RuntimeException $e) {
51  
52 }
53 }
54 }
55  
56 return $commands;
57 }
58 }