Fix using rotate and resize filters at the same time (#78)

This commit is contained in:
Romain Neutron 2013-11-29 13:25:49 +01:00
commit fca866e1d8
8 changed files with 118 additions and 7 deletions

View file

@ -55,6 +55,16 @@ class RotateFilter implements VideoFilterInterface
*/
public function apply(Video $video, VideoInterface $format)
{
if (in_array($this->angle, array(self::ROTATE_90, self::ROTATE_270), true)) {
foreach ($video->getStreams()->videos() as $stream) {
if ($stream->has('width') && $stream->has('height')) {
$width = $stream->get('width');
$stream->set('width', $stream->get('height'));
$stream->set('height', $width);
}
}
}
return array('-vf', $this->angle, '-metadata:s:v:0', 'rotate=0');
}

View file

@ -96,9 +96,9 @@ class VideoFilters extends AudioFilters
return $this;
}
public function rotate($angle, $priority = 0)
public function rotate($angle)
{
$this->media->addFilter(new RotateFilter($angle, $priority));
$this->media->addFilter(new RotateFilter($angle, 30));
return $this;
}