scratch – Blame information for rev 115

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 namespace Tests\FFMpeg\Unit\Filters\Video;
4  
5 use FFMpeg\Filters\Video\ExtractMultipleFramesFilter;
6 use Tests\FFMpeg\Unit\TestCase;
7 use FFMpeg\FFProbe\DataMapping\Stream;
8 use FFMpeg\FFProbe\DataMapping\StreamCollection;
9  
10 class ExtractMultipleFramesFilterTest extends TestCase
11 {
12 /**
13 * @dataProvider provideFrameRates
14 */
15 public function testApply($frameRate, $destinationFolder, $duration, $modulus, $expected)
16 {
17 $video = $this->getVideoMock();
18 $pathfile = '/path/to/file'.mt_rand();
19  
20 $format = $this->getMock('FFMpeg\Format\VideoInterface');
21 $format->expects($this->any())
22 ->method('getModulus')
23 ->will($this->returnValue($modulus));
24  
25 $streams = new StreamCollection(array(
26 new Stream(array(
27 'codec_type' => 'video',
28 'duration' => $duration,
29 ))
30 ));
31  
32 $video->expects($this->once())
33 ->method('getStreams')
34 ->will($this->returnValue($streams));
35  
36 $filter = new ExtractMultipleFramesFilter($frameRate, $destinationFolder);
37 $this->assertEquals($expected, $filter->apply($video, $format));
38 }
39  
40 public function provideFrameRates()
41 {
42 return array(
43 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_SEC, '/', 100, 2, array('-vf', 'fps=1/1', '/frame-%03d.jpg')),
44 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_2SEC, '/', 100, 2, array('-vf', 'fps=1/2', '/frame-%02d.jpg')),
45 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_5SEC, '/', 100, 2, array('-vf', 'fps=1/5', '/frame-%02d.jpg')),
46 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_10SEC, '/', 100, 2, array('-vf', 'fps=1/10', '/frame-%02d.jpg')),
47 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_30SEC, '/', 100, 2, array('-vf', 'fps=1/30', '/frame-%02d.jpg')),
48 array(ExtractMultipleFramesFilter::FRAMERATE_EVERY_60SEC, '/', 100, 2, array('-vf', 'fps=1/60', '/frame-%02d.jpg')),
49 );
50 }
51 }