scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 114  →  ?path2? @ 115
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Waveform/WaveformDownmixFilter.php
@@ -0,0 +1,74 @@
<?php
 
/*
* This file is part of PHP-FFmpeg.
*
* (c) Strime <contact@strime.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
 
namespace FFMpeg\Filters\Waveform;
 
use FFMpeg\Exception\RuntimeException;
use FFMpeg\Media\Waveform;
 
class WaveformDownmixFilter implements WaveformFilterInterface
{
 
/** @var boolean */
private $downmix;
/** @var integer */
private $priority;
 
// By default, the downmix value is set to FALSE.
public function __construct($downmix = FALSE, $priority = 0)
{
$this->downmix = $downmix;
$this->priority = $priority;
}
 
/**
* {@inheritdoc}
*/
public function getDownmix()
{
return $this->downmix;
}
 
/**
* {@inheritdoc}
*/
public function getPriority()
{
return $this->priority;
}
 
/**
* {@inheritdoc}
*/
public function apply(Waveform $waveform)
{
$commands = array();
 
foreach ($waveform->getAudio()->getStreams() as $stream) {
if ($stream->isAudio()) {
try {
// If the downmix parameter is set to TRUE, we add an option to the FFMPEG command
if($this->downmix == TRUE) {
$commands[] = '"aformat=channel_layouts=mono"';
}
break;
 
} catch (RuntimeException $e) {
 
}
}
}
 
return $commands;
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php
@@ -0,0 +1,20 @@
<?php
 
/*
* This file is part of PHP-FFmpeg.
*
* (c) Strime <contact@strime.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
 
namespace FFMpeg\Filters\Waveform;
 
use FFMpeg\Filters\FilterInterface;
use FFMpeg\Media\Waveform;
 
interface WaveformFilterInterface extends FilterInterface
{
public function apply(Waveform $waveform);
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Waveform/WaveformFilters.php
@@ -0,0 +1,38 @@
<?php
 
/*
* This file is part of PHP-FFmpeg.
*
* (c) Strime <contact@strime.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
 
namespace FFMpeg\Filters\Waveform;
 
use FFMpeg\Media\Waveform;
 
class WaveformFilters
{
private $waveform;
 
public function __construct(Waveform $waveform)
{
$this->waveform = $waveform;
}
 
/**
* Sets the downmix of the output waveform.
*
* If you want a simpler waveform, sets the downmix to TRUE.
*
* @return WaveformFilters
*/
public function setDownmix()
{
$this->waveform->addFilter(new WaveformDownmixFilter());
 
return $this;
}
}