Fix Build PHP 5.3.2
This commit is contained in:
parent
33544e7bed
commit
26ede7fa87
4 changed files with 33 additions and 47 deletions
|
|
@ -20,6 +20,10 @@ interface AudioFormat
|
|||
|
||||
public function getKiloBitrate();
|
||||
|
||||
/**
|
||||
* Returns the list of available audio codecs for this format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAvailableAudioCodecs();
|
||||
|
||||
}
|
||||
|
|
@ -18,10 +18,9 @@ namespace FFMpeg\Format;
|
|||
*/
|
||||
abstract class DefaultAudioFormat implements AudioFormat
|
||||
{
|
||||
|
||||
protected $audioCodec;
|
||||
protected $audioSampleRate = 44100;
|
||||
protected $kiloBitrate = 128;
|
||||
protected $kiloBitrate = 128;
|
||||
|
||||
/**
|
||||
* Returns extra parameters for the encoding
|
||||
|
|
@ -52,9 +51,11 @@ abstract class DefaultAudioFormat implements AudioFormat
|
|||
*/
|
||||
public function setAudioCodec($audioCodec)
|
||||
{
|
||||
if ( ! in_array($audioCodec, $this->getAvailableAudioCodecs()))
|
||||
{
|
||||
throw new \InvalidArgumentException('Wrong audiocodec value');
|
||||
if ( ! in_array($audioCodec, $this->getAvailableAudioCodecs())) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Wrong audiocodec value for %s, available formats are %s'
|
||||
, $audioCodec, implode(', ', $this->getAvailableAudioCodecs())
|
||||
));
|
||||
}
|
||||
|
||||
$this->audioCodec = $audioCodec;
|
||||
|
|
@ -78,8 +79,7 @@ abstract class DefaultAudioFormat implements AudioFormat
|
|||
*/
|
||||
public function setAudioSampleRate($audioSampleRate)
|
||||
{
|
||||
if ($audioSampleRate < 1)
|
||||
{
|
||||
if ($audioSampleRate < 1) {
|
||||
throw new \InvalidArgumentException('Wrong audio sample rate value');
|
||||
}
|
||||
|
||||
|
|
@ -104,19 +104,10 @@ abstract class DefaultAudioFormat implements AudioFormat
|
|||
*/
|
||||
public function setKiloBitrate($kiloBitrate)
|
||||
{
|
||||
if ($kiloBitrate < 1)
|
||||
{
|
||||
if ($kiloBitrate < 1) {
|
||||
throw new \InvalidArgumentException('Wrong kiloBitrate value');
|
||||
}
|
||||
|
||||
$this->kiloBitrate = (int) $kiloBitrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available audio codecs for this format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getAvailableAudioCodecs();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@ namespace FFMpeg\Format;
|
|||
*/
|
||||
abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFormat
|
||||
{
|
||||
|
||||
protected $width;
|
||||
protected $height;
|
||||
protected $frameRate = 25;
|
||||
protected $frameRate = 25;
|
||||
protected $videoCodec;
|
||||
protected $GOPsize = 25;
|
||||
protected $GOPsize = 25;
|
||||
protected $kiloBitrate = 1000;
|
||||
|
||||
public function __construct($width, $height)
|
||||
|
|
@ -60,12 +59,10 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
*/
|
||||
public function setDimensions($width, $height)
|
||||
{
|
||||
if ($width < 1)
|
||||
{
|
||||
if ($width < 1) {
|
||||
throw new \InvalidArgumentException('Wrong width value');
|
||||
}
|
||||
if ($height < 1)
|
||||
{
|
||||
if ($height < 1) {
|
||||
throw new \InvalidArgumentException('Wrong height value');
|
||||
}
|
||||
|
||||
|
|
@ -91,8 +88,7 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
*/
|
||||
public function setFrameRate($frameRate)
|
||||
{
|
||||
if ($frameRate < 1)
|
||||
{
|
||||
if ($frameRate < 1) {
|
||||
throw new \InvalidArgumentException('Wrong framerate value');
|
||||
}
|
||||
|
||||
|
|
@ -118,9 +114,11 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
*/
|
||||
public function setVideoCodec($videoCodec)
|
||||
{
|
||||
if ( ! in_array($videoCodec, $this->getAvailableVideoCodecs()))
|
||||
{
|
||||
throw new \InvalidArgumentException('Wrong videocodec value');
|
||||
if ( ! in_array($videoCodec, $this->getAvailableVideoCodecs())) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Wrong videocodec value for %s, available formats are %s'
|
||||
, $videoCodec, implode(', ', $this->getAvailableVideoCodecs())
|
||||
));
|
||||
}
|
||||
|
||||
$this->videoCodec = $videoCodec;
|
||||
|
|
@ -144,8 +142,7 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
*/
|
||||
public function setGOPsize($GOPsize)
|
||||
{
|
||||
if ($GOPsize < 1)
|
||||
{
|
||||
if ($GOPsize < 1) {
|
||||
throw new \InvalidArgumentException('Wrong GOP size value');
|
||||
}
|
||||
|
||||
|
|
@ -167,12 +164,11 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
|
||||
$halfDistance = $multiple / 2;
|
||||
if ($modulo <= $halfDistance)
|
||||
$bound = 'bottom';
|
||||
$bound = 'bottom';
|
||||
else
|
||||
$bound = 'top';
|
||||
$bound = 'top';
|
||||
|
||||
switch ($bound)
|
||||
{
|
||||
switch ($bound) {
|
||||
default:
|
||||
case 'top':
|
||||
$ret = $value + $multiple - $modulo;
|
||||
|
|
@ -182,19 +178,10 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
break;
|
||||
}
|
||||
|
||||
if ($ret < $multiple)
|
||||
{
|
||||
if ($ret < $multiple) {
|
||||
$ret = (int) $multiple;
|
||||
}
|
||||
|
||||
return (int) $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available video codecs for this format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getAvailableVideoCodecs();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ interface VideoFormat extends AudioFormat
|
|||
|
||||
public function getGOPSize();
|
||||
|
||||
/**
|
||||
* Returns the list of available video codecs for this format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAvailableVideoCodecs();
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue