Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
5b85b6b84d
6 changed files with 85 additions and 5 deletions
|
|
@ -35,6 +35,9 @@ abstract class DefaultVideo extends DefaultAudio implements VideoInterface
|
|||
/** @var Array */
|
||||
protected $additionalParamaters;
|
||||
|
||||
/** @var Array */
|
||||
protected $initialParamaters;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -122,6 +125,31 @@ abstract class DefaultVideo extends DefaultAudio implements VideoInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getInitialParameters()
|
||||
{
|
||||
return $this->initialParamaters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets initial parameters.
|
||||
*
|
||||
* @param array $initialParamaters
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setInitialParameters($initialParamaters)
|
||||
{
|
||||
if (!is_array($initialParamaters)) {
|
||||
throw new InvalidArgumentException('Wrong initialParamaters value');
|
||||
}
|
||||
|
||||
$this->initialParamaters = $initialParamaters;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -56,9 +56,16 @@ interface VideoInterface extends AudioInterface
|
|||
public function getAvailableVideoCodecs();
|
||||
|
||||
/**
|
||||
* Returns the list of available video codecs for this format.
|
||||
* Returns the list of additional parameters for this format.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAdditionalParameters();
|
||||
|
||||
/**
|
||||
* Returns the list of initial parameters for this format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInitialParameters();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ abstract class AbstractVideo extends Audio
|
|||
*/
|
||||
protected function buildCommand(FormatInterface $format, $outputPathfile)
|
||||
{
|
||||
$commands = $this->basePartOfCommand();
|
||||
$commands = $this->basePartOfCommand($format);
|
||||
|
||||
$filters = clone $this->filters;
|
||||
$filters->add(new SimpleFilter($format->getExtraParams(), 10));
|
||||
|
|
@ -283,10 +283,25 @@ abstract class AbstractVideo extends Audio
|
|||
/**
|
||||
* Return base part of command.
|
||||
*
|
||||
* @param FormatInterface $format
|
||||
* @return array
|
||||
*/
|
||||
protected function basePartOfCommand()
|
||||
protected function basePartOfCommand(FormatInterface $format)
|
||||
{
|
||||
return array('-y', '-i', $this->pathfile);
|
||||
$commands = array('-y');
|
||||
|
||||
// If the user passed some initial parameters
|
||||
if ($format instanceof VideoInterface) {
|
||||
if (null !== $format->getInitialParameters()) {
|
||||
foreach ($format->getInitialParameters() as $initialParameter) {
|
||||
$commands[] = $initialParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$commands[] = '-i';
|
||||
$commands[] = $this->pathfile;
|
||||
|
||||
return $commands;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace FFMpeg\Media;
|
|||
use FFMpeg\Driver\FFMpegDriver;
|
||||
use FFMpeg\FFProbe;
|
||||
use FFMpeg\Coordinate\TimeCode;
|
||||
use FFMpeg\Format\FormatInterface;
|
||||
|
||||
/**
|
||||
* Video clip.
|
||||
|
|
@ -34,6 +35,7 @@ class Clip extends Video
|
|||
/**
|
||||
* Returns the video related to the frame.
|
||||
*
|
||||
* @param FormatInterface $format
|
||||
* @return Video
|
||||
*/
|
||||
public function getVideo()
|
||||
|
|
@ -46,7 +48,7 @@ class Clip extends Video
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function basePartOfCommand()
|
||||
protected function basePartOfCommand(FormatInterface $format)
|
||||
{
|
||||
$arr = array('-y', '-ss', (string) $this->start, '-i', $this->pathfile);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue