Fix CS
This commit is contained in:
parent
634e67d7ec
commit
3a080613e6
8 changed files with 12 additions and 23 deletions
|
|
@ -12,8 +12,6 @@
|
||||||
namespace FFMpeg;
|
namespace FFMpeg;
|
||||||
|
|
||||||
use Doctrine\Common\Cache\ArrayCache;
|
use Doctrine\Common\Cache\ArrayCache;
|
||||||
use FFMpeg\FFMpeg;
|
|
||||||
use FFMpeg\FFProbe;
|
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace FFMpeg\Filters\Audio;
|
namespace FFMpeg\Filters\Audio;
|
||||||
|
|
||||||
use FFMpeg\Media\Audio;
|
use FFMpeg\Media\Audio;
|
||||||
use FFMpeg\Filters\Audio\AudioResamplableFilter;
|
|
||||||
|
|
||||||
class AudioFilters
|
class AudioFilters
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class CustomFilter implements VideoFilterInterface
|
||||||
* A custom filter, useful if you want to build complex filters
|
* A custom filter, useful if you want to build complex filters
|
||||||
*
|
*
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
* @param int $priority
|
* @param int $priority
|
||||||
*/
|
*/
|
||||||
public function __construct($filter, $priority = 0)
|
public function __construct($filter, $priority = 0)
|
||||||
{
|
{
|
||||||
|
|
@ -46,6 +46,7 @@ class CustomFilter implements VideoFilterInterface
|
||||||
public function apply(Video $video, VideoInterface $format)
|
public function apply(Video $video, VideoInterface $format)
|
||||||
{
|
{
|
||||||
$commands = array('-vf', $this->filter);
|
$commands = array('-vf', $this->filter);
|
||||||
|
|
||||||
return $commands;
|
return $commands;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class VideoFilters extends AudioFilters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $imagePath
|
* @param string $imagePath
|
||||||
* @param array $coordinates
|
* @param array $coordinates
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ namespace FFMpeg\Filters\Video;
|
||||||
|
|
||||||
use FFMpeg\Format\VideoInterface;
|
use FFMpeg\Format\VideoInterface;
|
||||||
use FFMpeg\Media\Video;
|
use FFMpeg\Media\Video;
|
||||||
use FFMpeg\Coordinate\TimeCode;
|
|
||||||
|
|
||||||
class WatermarkFilter implements VideoFilterInterface
|
class WatermarkFilter implements VideoFilterInterface
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +23,6 @@ class WatermarkFilter implements VideoFilterInterface
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
private $priority;
|
private $priority;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($watermarkPath, array $coordinates = array(), $priority = 0)
|
public function __construct($watermarkPath, array $coordinates = array(), $priority = 0)
|
||||||
{
|
{
|
||||||
$this->watermarkPath = $watermarkPath;
|
$this->watermarkPath = $watermarkPath;
|
||||||
|
|
@ -47,25 +45,21 @@ class WatermarkFilter implements VideoFilterInterface
|
||||||
{
|
{
|
||||||
$position = isset($this->coordinates['position']) ? $this->coordinates['position'] : 'absolute';
|
$position = isset($this->coordinates['position']) ? $this->coordinates['position'] : 'absolute';
|
||||||
|
|
||||||
switch($position) {
|
switch ($position) {
|
||||||
case 'relative':
|
case 'relative':
|
||||||
if (isset($this->coordinates['top'])) {
|
if (isset($this->coordinates['top'])) {
|
||||||
$y = $this->coordinates['top'];
|
$y = $this->coordinates['top'];
|
||||||
}
|
} elseif (isset($this->coordinates['bottom'])) {
|
||||||
elseif (isset($this->coordinates['bottom'])) {
|
|
||||||
$y = sprintf('main_h - %d - overlay_h', $this->coordinates['bottom']);
|
$y = sprintf('main_h - %d - overlay_h', $this->coordinates['bottom']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$y = 0;
|
$y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->coordinates['left'])) {
|
if (isset($this->coordinates['left'])) {
|
||||||
$x = $this->coordinates['left'];
|
$x = $this->coordinates['left'];
|
||||||
}
|
} elseif (isset($this->coordinates['right'])) {
|
||||||
elseif (isset($this->coordinates['right'])) {
|
|
||||||
$x = sprintf('main_w - %d - overlay_w', $this->coordinates['right']);
|
$x = sprintf('main_w - %d - overlay_w', $this->coordinates['right']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$x = 0;
|
$x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ namespace FFMpeg\Media;
|
||||||
use FFMpeg\Driver\FFMpegDriver;
|
use FFMpeg\Driver\FFMpegDriver;
|
||||||
use FFMpeg\FFProbe;
|
use FFMpeg\FFProbe;
|
||||||
use FFMpeg\Filters\FiltersCollection;
|
use FFMpeg\Filters\FiltersCollection;
|
||||||
use FFMpeg\Media\MediaTypeInterface;
|
|
||||||
|
|
||||||
abstract class AbstractMediaType implements MediaTypeInterface
|
abstract class AbstractMediaType implements MediaTypeInterface
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ use FFMpeg\Driver\FFMpegDriver;
|
||||||
use FFMpeg\FFProbe;
|
use FFMpeg\FFProbe;
|
||||||
use FFMpeg\Exception\RuntimeException;
|
use FFMpeg\Exception\RuntimeException;
|
||||||
use FFMpeg\Coordinate\TimeCode;
|
use FFMpeg\Coordinate\TimeCode;
|
||||||
use FFMpeg\Media\Video;
|
|
||||||
|
|
||||||
class Frame extends AbstractMediaType
|
class Frame extends AbstractMediaType
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ use FFMpeg\Format\FormatInterface;
|
||||||
use FFMpeg\Format\ProgressableInterface;
|
use FFMpeg\Format\ProgressableInterface;
|
||||||
use FFMpeg\Format\AudioInterface;
|
use FFMpeg\Format\AudioInterface;
|
||||||
use FFMpeg\Format\VideoInterface;
|
use FFMpeg\Format\VideoInterface;
|
||||||
use FFMpeg\Media\Frame;
|
|
||||||
use Neutron\TemporaryFilesystem\Manager as FsManager;
|
use Neutron\TemporaryFilesystem\Manager as FsManager;
|
||||||
|
|
||||||
class Video extends Audio
|
class Video extends Audio
|
||||||
|
|
@ -69,12 +68,12 @@ class Video extends Audio
|
||||||
if ($this->driver->getConfiguration()->has('ffmpeg.threads')) {
|
if ($this->driver->getConfiguration()->has('ffmpeg.threads')) {
|
||||||
$filters->add(new SimpleFilter(array('-threads', $this->driver->getConfiguration()->get('ffmpeg.threads'))));
|
$filters->add(new SimpleFilter(array('-threads', $this->driver->getConfiguration()->get('ffmpeg.threads'))));
|
||||||
}
|
}
|
||||||
if ($format instanceOf VideoInterface) {
|
if ($format instanceof VideoInterface) {
|
||||||
if (null !== $format->getVideoCodec()) {
|
if (null !== $format->getVideoCodec()) {
|
||||||
$filters->add(new SimpleFilter(array('-vcodec', $format->getVideoCodec())));
|
$filters->add(new SimpleFilter(array('-vcodec', $format->getVideoCodec())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($format instanceOf AudioInterface) {
|
if ($format instanceof AudioInterface) {
|
||||||
if (null !== $format->getAudioCodec()) {
|
if (null !== $format->getAudioCodec()) {
|
||||||
$filters->add(new SimpleFilter(array('-acodec', $format->getAudioCodec())));
|
$filters->add(new SimpleFilter(array('-acodec', $format->getAudioCodec())));
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +83,7 @@ class Video extends Audio
|
||||||
$commands = array_merge($commands, $filter->apply($this, $format));
|
$commands = array_merge($commands, $filter->apply($this, $format));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format instanceOf VideoInterface) {
|
if ($format instanceof VideoInterface) {
|
||||||
$commands[] = '-b:v';
|
$commands[] = '-b:v';
|
||||||
$commands[] = $format->getKiloBitrate() . 'k';
|
$commands[] = $format->getKiloBitrate() . 'k';
|
||||||
$commands[] = '-refs';
|
$commands[] = '-refs';
|
||||||
|
|
@ -109,7 +108,7 @@ class Video extends Audio
|
||||||
$commands[] = '1';
|
$commands[] = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format instanceOf AudioInterface) {
|
if ($format instanceof AudioInterface) {
|
||||||
if (null !== $format->getAudioKiloBitrate()) {
|
if (null !== $format->getAudioKiloBitrate()) {
|
||||||
$commands[] = '-b:a';
|
$commands[] = '-b:a';
|
||||||
$commands[] = $format->getAudioKiloBitrate() . 'k';
|
$commands[] = $format->getAudioKiloBitrate() . 'k';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue