Improvements in the way we deal with filters for the waveform

This commit is contained in:
Romain Biard 2016-11-16 13:15:27 -03:00
commit dab2ae5a8c
2 changed files with 5 additions and 11 deletions

View file

@ -41,19 +41,13 @@ class WaveformRatioFixerFilter implements WaveformFilterInterface
$dimensions = null;
$commands = array();
foreach ($waveform->getVideo()->getStreams() as $stream) {
if ($stream->isVideo()) {
foreach ($waveform->getAudio()->getStreams() as $stream) {
if ($stream->isAudio()) {
try {
// Get the dimensions of the video
$dimensions = $stream->getDimensions();
// If the downmix parameter is set to TRUE, we add an option to the FFMPEG command
if(!$this->downmix) {
$commands[] = '"showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"';
}
else {
$commands[] = '"aformat=channel_layouts=mono,showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"';
if($this->downmix == TRUE) {
$commands[] = '"aformat=channel_layouts=mono"';
}
break;

View file

@ -26,7 +26,7 @@ class Waveform extends AbstractMediaType
private $width;
private $height;
public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height)
public function __construct(Audio $audio, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height)
{
parent::__construct($video->getPathfile(), $driver, $ffprobe);
$this->video = $video;