This commit is contained in:
Romain Neutron 2013-12-17 17:39:24 +01:00
commit 197b534359
10 changed files with 15 additions and 19 deletions

View file

@ -35,7 +35,7 @@ class FFMpegServiceProvider implements ServiceProviderInterface
return array_replace($app['ffmpeg.default.configuration'], $app['ffmpeg.configuration']); return array_replace($app['ffmpeg.default.configuration'], $app['ffmpeg.configuration']);
}); });
$app['ffmpeg'] = $app['ffmpeg.ffmpeg'] = $app->share(function(Application $app) { $app['ffmpeg'] = $app['ffmpeg.ffmpeg'] = $app->share(function (Application $app) {
$configuration = $app['ffmpeg.configuration.build']; $configuration = $app['ffmpeg.configuration.build'];
if (isset($configuration['ffmpeg.timeout'])) { if (isset($configuration['ffmpeg.timeout'])) {
@ -49,7 +49,7 @@ class FFMpegServiceProvider implements ServiceProviderInterface
return new ArrayCache(); return new ArrayCache();
}); });
$app['ffmpeg.ffprobe'] = $app->share(function(Application $app) { $app['ffmpeg.ffprobe'] = $app->share(function (Application $app) {
$configuration = $app['ffmpeg.configuration.build']; $configuration = $app['ffmpeg.configuration.build'];
if (isset($configuration['ffmpeg.timeout'])) { if (isset($configuration['ffmpeg.timeout'])) {

View file

@ -53,8 +53,8 @@ abstract class AbstractData implements \Countable
/** /**
* Sets the property value given its name. * Sets the property value given its name.
* *
* @param string $property * @param string $property
* @param mixed $value * @param mixed $value
* *
* @return AbstractData * @return AbstractData
*/ */

View file

@ -24,10 +24,10 @@ class FrameFilters
/** /**
* Fixes the display ratio of the output frame. * Fixes the display ratio of the output frame.
* *
* In case the sample ratio and display ratio are different, image may be * In case the sample ratio and display ratio are different, image may be
* anamorphozed. This filter fixes this by specifying the output size. * anamorphozed. This filter fixes this by specifying the output size.
* *
* @return FrameFilters * @return FrameFilters
*/ */
public function fixDisplayRatio() public function fixDisplayRatio()

View file

@ -13,7 +13,6 @@ namespace FFMpeg\Filters\Video;
use FFMpeg\Coordinate\Dimension; use FFMpeg\Coordinate\Dimension;
use FFMpeg\Exception\InvalidArgumentException; use FFMpeg\Exception\InvalidArgumentException;
use FFMpeg\Exception\RuntimeException;
use FFMpeg\Media\Video; use FFMpeg\Media\Video;
use FFMpeg\Format\VideoInterface; use FFMpeg\Format\VideoInterface;

View file

@ -12,7 +12,6 @@
namespace FFMpeg\Media; namespace FFMpeg\Media;
use FFMpeg\Driver\FFMpegDriver; use FFMpeg\Driver\FFMpegDriver;
use FFMpeg\Exception\InvalidArgumentException;
use FFMpeg\FFProbe; use FFMpeg\FFProbe;
use FFMpeg\Filters\FiltersCollection; use FFMpeg\Filters\FiltersCollection;
use FFMpeg\Media\MediaTypeInterface; use FFMpeg\Media\MediaTypeInterface;

View file

@ -110,7 +110,7 @@ class Frame extends AbstractMediaType
foreach ($this->filters as $filter) { foreach ($this->filters as $filter) {
$commands = array_merge($commands, $filter->apply($this)); $commands = array_merge($commands, $filter->apply($this));
} }
$commands = array_merge($commands, array($pathfile)); $commands = array_merge($commands, array($pathfile));
try { try {

View file

@ -9,7 +9,7 @@ use FFMpeg\Format\Video\X264;
use FFMpeg\Media\Video; use FFMpeg\Media\Video;
class VideoTranscodeTest extends FunctionalTestCase class VideoTranscodeTest extends FunctionalTestCase
{ {
public function testSimpleTranscodeX264() public function testSimpleTranscodeX264()
{ {
$filename = __DIR__ . '/output/output-x264.mp4'; $filename = __DIR__ . '/output/output-x264.mp4';
@ -65,7 +65,7 @@ class VideoTranscodeTest extends FunctionalTestCase
if ($info['name'] === 'avconv' && version_compare($info['version'], '0.9', '<')) { if ($info['name'] === 'avconv' && version_compare($info['version'], '0.9', '<')) {
$this->markTestSkipped('This version of avconv is buggy and does not support this test.'); $this->markTestSkipped('This version of avconv is buggy and does not support this test.');
} }
$filename = __DIR__ . '/output/output-x264.mp4'; $filename = __DIR__ . '/output/output-x264.mp4';
if (is_file($filename)) { if (is_file($filename)) {
unlink(__DIR__ . '/output/output-x264.mp4'); unlink(__DIR__ . '/output/output-x264.mp4');
@ -91,7 +91,7 @@ class VideoTranscodeTest extends FunctionalTestCase
$this->assertFileExists($filename); $this->assertFileExists($filename);
unlink($filename); unlink($filename);
} }
private function getNameAndVersion() private function getNameAndVersion()
{ {
$binary = $this $binary = $this
@ -99,20 +99,20 @@ class VideoTranscodeTest extends FunctionalTestCase
->getFFMpegDriver() ->getFFMpegDriver()
->getProcessBuilderFactory() ->getProcessBuilderFactory()
->getBinary(); ->getBinary();
$output = $matches = null; $output = $matches = null;
exec($binary . ' -version 2>&1', $output); exec($binary . ' -version 2>&1', $output);
if (!isset($output[0])) { if (!isset($output[0])) {
return array('name' => null, 'version' => null); return array('name' => null, 'version' => null);
} }
preg_match('/^([a-z]+)\s+version\s+([0-9\.]+)/i', $output[0], $matches); preg_match('/^([a-z]+)\s+version\s+([0-9\.]+)/i', $output[0], $matches);
if (count($matches) > 0) { if (count($matches) > 0) {
return array('name' => $matches[1], 'version' => $matches[2]); return array('name' => $matches[1], 'version' => $matches[2]);
} }
return array('name' => null, 'version' => null); return array('name' => null, 'version' => null);
} }
} }

View file

@ -15,12 +15,12 @@ class DisplayRatioFixerFilterTest extends TestCase
{ {
$stream = new Stream(array('codec_type' => 'video', 'width' => 960, 'height' => 720)); $stream = new Stream(array('codec_type' => 'video', 'width' => 960, 'height' => 720));
$streams = new StreamCollection(array($stream)); $streams = new StreamCollection(array($stream));
$video = $this->getVideoMock(__FILE__); $video = $this->getVideoMock(__FILE__);
$video->expects($this->once()) $video->expects($this->once())
->method('getStreams') ->method('getStreams')
->will($this->returnValue($streams)); ->will($this->returnValue($streams));
$frame = new Frame($video, $this->getFFMpegDriverMock(), $this->getFFProbeMock(), new TimeCode(0, 0, 0, 0)); $frame = new Frame($video, $this->getFFMpegDriverMock(), $this->getFFProbeMock(), new TimeCode(0, 0, 0, 0));
$filter = new DisplayRatioFixerFilter(); $filter = new DisplayRatioFixerFilter();
$this->assertEquals(array('-s', '960x720'), $filter->apply($frame)); $this->assertEquals(array('-s', '960x720'), $filter->apply($frame));

View file

@ -4,7 +4,6 @@ namespace FFMpeg\Tests\Media;
use FFMpeg\Media\Audio; use FFMpeg\Media\Audio;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException; use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use FFMpeg\Format\ProgressableInterface;
use FFMpeg\Format\AudioInterface; use FFMpeg\Format\AudioInterface;
class AudioTest extends AbstractStreamableTestCase class AudioTest extends AbstractStreamableTestCase

View file

@ -4,7 +4,6 @@ namespace FFMpeg\Tests\Media;
use FFMpeg\Media\Video; use FFMpeg\Media\Video;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException; use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use FFMpeg\Format\ProgressableInterface;
use FFMpeg\Format\VideoInterface; use FFMpeg\Format\VideoInterface;
class VideoTest extends AbstractStreamableTestCase class VideoTest extends AbstractStreamableTestCase