scratch – Blame information for rev 115

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 <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\Video;
13  
14 use FFMpeg\Format\VideoInterface;
15 use FFMpeg\Media\Video;
16 use FFMpeg\Coordinate\TimeCode;
17  
18 class ClipFilter implements VideoFilterInterface
19 {
20 /** @var TimeCode */
21 private $start;
22 /** @var TimeCode */
23 private $duration;
24 /** @var integer */
25 private $priority;
26  
27 public function __construct(TimeCode $start, TimeCode $duration = null, $priority = 0)
28 {
29 $this->start = $start;
30 $this->duration = $duration;
31 $this->priority = $priority;
32 }
33  
34 /**
35 * {@inheritdoc}
36 */
37 public function getPriority()
38 {
39 return $this->priority;
40 }
41  
42 /**
43 * @return TimeCode
44 */
45 public function getStart()
46 {
47 return $this->start;
48 }
49  
50 /**
51 * @return TimeCode
52 */
53 public function getDuration()
54 {
55 return $this->duration;
56 }
57  
58 /**
59 * {@inheritdoc}
60 */
61 public function apply(Video $video, VideoInterface $format)
62 {
63 $commands = array('-ss', (string) $this->start);
64  
65 if ($this->duration !== null) {
66 $commands[] = '-t';
67 $commands[] = (string) $this->duration;
68 }
69  
70 return $commands;
71 }
72 }