Merge branch 'master' into spectrumpic
This commit is contained in:
commit
839207457f
8 changed files with 62 additions and 17 deletions
|
|
@ -10,22 +10,22 @@ class AudioConcatenationTest extends FunctionalTestCase
|
|||
public function testSimpleAudioFileConcatTest()
|
||||
{
|
||||
$ffmpeg = $this->getFFMpeg();
|
||||
|
||||
|
||||
$files = [
|
||||
__DIR__ . '/../files/Jahzzar_-_05_-_Siesta.mp3',
|
||||
__DIR__ . '/../files/02_-_Favorite_Secrets.mp3',
|
||||
realpath(__DIR__ . '/../files/Jahzzar_-_05_-_Siesta.mp3'),
|
||||
realpath(__DIR__ . '/../files/02_-_Favorite_Secrets.mp3'),
|
||||
];
|
||||
|
||||
$audio = $ffmpeg->open(reset($files));
|
||||
|
||||
$this->assertInstanceOf('FFMpeg\Media\Audio', $audio);
|
||||
|
||||
|
||||
clearstatcache();
|
||||
$filename = __DIR__ . '/output/concat-output.mp3';
|
||||
|
||||
$audio->concat($files)->saveFromSameCodecs($filename, TRUE);
|
||||
|
||||
|
||||
$this->assertFileExists($filename);
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,16 @@ abstract class VideoTestCase extends AudioTestCase
|
|||
$this->assertEquals(2560, $format->getKiloBitrate());
|
||||
}
|
||||
|
||||
public function testSetKiloBitrateBelowZero()
|
||||
{
|
||||
$this->expectException('FFMpeg\Exception\InvalidArgumentException');
|
||||
$format = $this->getFormat();
|
||||
$format->setKiloBitrate(-1);
|
||||
}
|
||||
|
||||
public function testSetInvalidVideoCodec()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->expectException('FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setVideoCodec('invalid-random-video-codec');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Tests\FFMpeg\Unit\Media;
|
|||
|
||||
use FFMpeg\Exception\RuntimeException;
|
||||
use FFMpeg\Media\Video;
|
||||
use FFMpeg\Format\Video\X264;
|
||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
||||
use FFMpeg\Format\VideoInterface;
|
||||
|
||||
|
|
@ -677,6 +678,35 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testCaseWhereKiloBitRateIsEqualToZero()
|
||||
{
|
||||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
$pathfile = '/target/destination';
|
||||
$outputPathfile = '/target/file';
|
||||
|
||||
$format = new X264();
|
||||
$format->setKiloBitrate(0);
|
||||
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
->will($this->returnValue($configuration));
|
||||
|
||||
$driver->expects($this->exactly(1))
|
||||
->method('command')
|
||||
->with($this->isType('array'), false, $this->anything())
|
||||
->will($this->returnCallback(function ($commands, $errors, $listeners) {
|
||||
var_dump($commands);
|
||||
$this->assertTrue(!in_array('-b:v', $commands));
|
||||
}));
|
||||
|
||||
$video = new Video(__FILE__, $driver, $ffprobe);
|
||||
$video->save($format, $outputPathfile);
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return 'FFMpeg\Media\Video';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue