Apply frame filters on Frame::save

This commit is contained in:
Romain Neutron 2013-09-04 19:52:24 +02:00
commit bcf3e5f65a
3 changed files with 10 additions and 5 deletions

View file

@ -13,9 +13,8 @@ namespace FFMpeg\Filters\Frame;
use FFMpeg\Filters\FilterInterface;
use FFMpeg\Media\Frame;
use FFMpeg\Format\FrameInterface;
interface FrameFilterInterface extends FilterInterface
{
public function apply(Frame $frame, FrameInterface $format);
public function apply(Frame $frame);
}

View file

@ -97,16 +97,22 @@ class Frame extends AbstractMediaType
'-y', '-ss', (string) $this->timecode,
'-i', $this->pathfile,
'-vframes', '1',
'-f', 'image2', $pathfile
'-f', 'image2'
);
} else {
$commands = array(
'-y', '-i', $this->pathfile,
'-vframes', '1', '-ss', (string) $this->timecode,
'-f', 'image2', $pathfile
'-f', 'image2'
);
}
foreach ($this->filters as $filter) {
$commands = array_merge($commands, $filter->apply($this));
}
$commands = array_merge($commands, array($pathfile));
try {
$this->driver->command($commands);
} catch (ExecutionFailureException $e) {

View file

@ -11,7 +11,7 @@ class FrameTest extends AbstractMediaTestCase
*/
public function testWithInvalidFile()
{
new Frame('/No/file', $this->getFFMpegDriverMock(), $this->getFFProbeMock(), $this->getTimeCodeMock());
new Frame($this->getVideoMock('/No/file'), $this->getFFMpegDriverMock(), $this->getFFProbeMock(), $this->getTimeCodeMock());
}
public function testGetTimeCode()