Added configuration for audio channels

This commit is contained in:
Simon Schick 2014-06-25 09:55:00 +02:00
commit 7004e53399
8 changed files with 130 additions and 17 deletions

View file

@ -27,6 +27,9 @@ abstract class DefaultAudio extends EventEmitter implements AudioInterface, Prog
/** @var integer */
protected $audioKiloBitrate = 128;
/** @var integer */
protected $audioChannels = null;
/**
* {@inheritdoc}
*/
@ -90,6 +93,31 @@ abstract class DefaultAudio extends EventEmitter implements AudioInterface, Prog
return $this;
}
/**
* {@inheritdoc}
*/
public function getAudioChannels()
{
return $this->audioChannels;
}
/**
* Sets the channels value.
*
* @param integer $channels
* @throws InvalidArgumentException
*/
public function setAudioChannels($channels)
{
if ($channels < 1) {
throw new InvalidArgumentException('Wrong channels value');
}
$this->audioChannels = (int) $channels;
return $this;
}
/**
* {@inheritdoc}
*/

View file

@ -19,6 +19,13 @@ interface AudioInterface extends FormatInterface
*/
public function getAudioKiloBitrate();
/**
* Gets the audio channels value.
*
* @return integer
*/
public function getAudioChannels();
/**
* Returns the audio codec.
*

View file

@ -87,6 +87,10 @@ class Audio extends AbstractStreamableMedia
$commands[] = '-b:a';
$commands[] = $format->getAudioKiloBitrate() . 'k';
}
if (null !== $format->getAudioChannels()) {
$commands[] = '-ac';
$commands[] = $format->getAudioChannels();
}
$commands[] = $outputPathfile;
try {

View file

@ -114,6 +114,10 @@ class Video extends Audio
$commands[] = '-b:a';
$commands[] = $format->getAudioKiloBitrate() . 'k';
}
if (null !== $format->getAudioChannels()) {
$commands[] = '-ac';
$commands[] = $format->getAudioChannels();
}
}
$fs = FsManager::create();