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