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 <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\Filters\Audio;
13  
14 use FFMpeg\Filters\Audio\AddMetadataFilter;
15 use FFMpeg\Media\Audio;
16 use FFMpeg\Coordinate\TimeCode;
17  
18 class AudioFilters
19 {
20 protected $media;
21  
22 public function __construct(Audio $media)
23 {
24 $this->media = $media;
25 }
26  
27 /**
28 * Resamples the audio file.
29 *
30 * @param Integer $rate
31 *
32 * @return AudioFilters
33 */
34 public function resample($rate)
35 {
36 $this->media->addFilter(new AudioResamplableFilter($rate));
37  
38 return $this;
39 }
40  
41 /**
42 * Add metadata to an audio file. If no arguments are given then filter
43 * will remove all metadata from the audio file
44 * @param Array|Null $data If array must contain one of these key/value pairs:
45 * - "title": Title metadata
46 * - "artist": Artist metadata
47 * - "composer": Composer metadata
48 * - "album": Album metadata
49 * - "track": Track metadata
50 * - "artwork": Song artwork. String of file path
51 * - "year": Year metadata
52 * - "genre": Genre metadata
53 * - "description": Description metadata
54 */
55 public function addMetadata($data = null)
56 {
57 $this->media->addFilter(new AddMetadataFilter($data));
58  
59 return $this;
60 }
61  
62 /**
63 * Cuts the audio at `$start`, optionally define the end
64 *
65 * @param TimeCode $start Where the clipping starts(seek to time)
66 * @param TimeCode $duration How long the clipped audio should be
67 * @return AudioFilters
68 */
69 public function clip($start, $duration = null) {
70 $this->media->addFilter(new AudioClipFilter($start, $duration));
71  
72 return $this;
73 }
74 }