🔥 Delete unused code
This commit is contained in:
parent
18c3cbb284
commit
7baacb86a5
1 changed files with 2 additions and 59 deletions
|
|
@ -9,17 +9,8 @@ use FFMpeg\Driver\FFMpegDriver;
|
||||||
use FFMpeg\Exception\RuntimeException;
|
use FFMpeg\Exception\RuntimeException;
|
||||||
use FFMpeg\FFMpeg;
|
use FFMpeg\FFMpeg;
|
||||||
use FFMpeg\FFProbe;
|
use FFMpeg\FFProbe;
|
||||||
use FFMpeg\Filters\AdvancedMedia\ComplexCompatibleFilter;
|
|
||||||
use FFMpeg\Filters\AdvancedMedia\ComplexFilterContainer;
|
|
||||||
use FFMpeg\Filters\AdvancedMedia\ComplexFilterInterface;
|
|
||||||
use FFMpeg\Filters\AdvancedMedia\ComplexFilters;
|
|
||||||
use FFMpeg\Filters\FiltersCollection;
|
|
||||||
use FFMpeg\Format\AudioInterface;
|
|
||||||
use FFMpeg\Format\FormatInterface;
|
|
||||||
use FFMpeg\Format\ProgressListener\AbstractProgressListener;
|
use FFMpeg\Format\ProgressListener\AbstractProgressListener;
|
||||||
use FFMpeg\Format\ProgressListener\VideoProgressListener;
|
use FFMpeg\Format\ProgressListener\VideoProgressListener;
|
||||||
use FFMpeg\Format\ProgressableInterface;
|
|
||||||
use FFMpeg\Format\VideoInterface;
|
|
||||||
use FFMpeg\Media\AbstractMediaType;
|
use FFMpeg\Media\AbstractMediaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,8 +48,6 @@ class MappableMedia extends AbstractMediaType implements EventEmitterInterface
|
||||||
public function __construct(FFMpegDriver $driver, FFProbe $ffprobe)
|
public function __construct(FFMpegDriver $driver, FFProbe $ffprobe)
|
||||||
{
|
{
|
||||||
// In case of error user will see this text in the error log.
|
// In case of error user will see this text in the error log.
|
||||||
// But absence of inputs is a correct situation for some cases.
|
|
||||||
// For example, if the user will use filters such as "testsrc".
|
|
||||||
$pathfile = 'you_can_pass_empty_inputs_array_only_if_you_use_computed_inputs';
|
$pathfile = 'you_can_pass_empty_inputs_array_only_if_you_use_computed_inputs';
|
||||||
|
|
||||||
parent::__construct($pathfile, $driver, $ffprobe);
|
parent::__construct($pathfile, $driver, $ffprobe);
|
||||||
|
|
@ -71,7 +60,7 @@ class MappableMedia extends AbstractMediaType implements EventEmitterInterface
|
||||||
|
|
||||||
public function filters()
|
public function filters()
|
||||||
{
|
{
|
||||||
return $this->filters;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addInput(string $path): static
|
public function addInput(string $path): static
|
||||||
|
|
@ -178,58 +167,12 @@ class MappableMedia extends AbstractMediaType implements EventEmitterInterface
|
||||||
$listener = new VideoProgressListener($this->ffprobe, $this->getPathfile(), 1, 1, 0);
|
$listener = new VideoProgressListener($this->ffprobe, $this->getPathfile(), 1, 1, 0);
|
||||||
|
|
||||||
$listener->on('progress', function (...$args) use ($self) {
|
$listener->on('progress', function (...$args) use ($self) {
|
||||||
$self->emit('progress', array_merge([$self, null], $args));
|
$self->emit('progress', array_merge([$self], $args));
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->progressListeners[] = $listener;
|
$this->progressListeners[] = $listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $forceDisableAudio
|
|
||||||
* @param bool $forceDisableVideo
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @todo Redo it all
|
|
||||||
*/
|
|
||||||
protected function applyFormatParams(
|
|
||||||
FormatInterface $format,
|
|
||||||
$forceDisableAudio = false,
|
|
||||||
$forceDisableVideo = false
|
|
||||||
) {
|
|
||||||
// Set format params.
|
|
||||||
$commands = [];
|
|
||||||
if (!$forceDisableVideo && $format instanceof VideoInterface) {
|
|
||||||
if (null !== $format->getVideoCodec()) {
|
|
||||||
$commands[] = '-vcodec';
|
|
||||||
$commands[] = $format->getVideoCodec();
|
|
||||||
}
|
|
||||||
// If the user passed some additional format parameters.
|
|
||||||
if (null !== $format->getAdditionalParameters()) {
|
|
||||||
$commands = array_merge($commands, $format->getAdditionalParameters());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$forceDisableAudio && $format instanceof AudioInterface) {
|
|
||||||
if (null !== $format->getAudioCodec()) {
|
|
||||||
$commands[] = '-acodec';
|
|
||||||
$commands[] = $format->getAudioCodec();
|
|
||||||
}
|
|
||||||
if (null !== $format->getAudioKiloBitrate()) {
|
|
||||||
$commands[] = '-b:a';
|
|
||||||
$commands[] = $format->getAudioKiloBitrate().'k';
|
|
||||||
}
|
|
||||||
if (null !== $format->getAudioChannels()) {
|
|
||||||
$commands[] = '-ac';
|
|
||||||
$commands[] = $format->getAudioChannels();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the user passed some extra parameters.
|
|
||||||
if ($format->getExtraParams()) {
|
|
||||||
$commands = array_merge($commands, $format->getExtraParams());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $commands;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue