diff --git a/src/MappableMedia.php b/src/MappableMedia.php index 095bab3..c2fc9c9 100644 --- a/src/MappableMedia.php +++ b/src/MappableMedia.php @@ -9,17 +9,8 @@ use FFMpeg\Driver\FFMpegDriver; use FFMpeg\Exception\RuntimeException; use FFMpeg\FFMpeg; 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\VideoProgressListener; -use FFMpeg\Format\ProgressableInterface; -use FFMpeg\Format\VideoInterface; use FFMpeg\Media\AbstractMediaType; /** @@ -57,8 +48,6 @@ class MappableMedia extends AbstractMediaType implements EventEmitterInterface public function __construct(FFMpegDriver $driver, FFProbe $ffprobe) { // 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'; parent::__construct($pathfile, $driver, $ffprobe); @@ -71,7 +60,7 @@ class MappableMedia extends AbstractMediaType implements EventEmitterInterface public function filters() { - return $this->filters; + return null; } 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->on('progress', function (...$args) use ($self) { - $self->emit('progress', array_merge([$self, null], $args)); + $self->emit('progress', array_merge([$self], $args)); }); $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 */