Skip to content

Commit

Permalink
revert PS-670-rendition-video_enhance1 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Oct 15, 2024
1 parent ef7c6ea commit 2e07842
Show file tree
Hide file tree
Showing 17 changed files with 150 additions and 491 deletions.
32 changes: 0 additions & 32 deletions lib/php/rendition-factory-bundle/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ services:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\TransformerModuleInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\VideoToFrameTransformerModule:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\TransformerModuleInterface::TAG }

Alchemy\RenditionFactory\Transformer\Document\DocumentToPdfTransformerModule:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\TransformerModuleInterface::TAG }
Expand All @@ -40,35 +36,7 @@ services:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\TransformerModuleInterface::TAG }

# FFMpeg "formats"
Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\JpegFormat:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\MkvFormat:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\Mpeg4Format:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\MpegFormat:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\QuicktimeFormat:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }

Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\WebmFormat:
tags:
- { name: !php/const Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface::TAG }


Imagine\Imagick\Imagine: ~
Imagine\Image\ImagineInterface: '@Imagine\Imagick\Imagine'

Alchemy\RenditionFactory\MimeType\MimeTypeGuesser: ~
Alchemy\RenditionFactory\Format\FormatGuesser: ~
Alchemy\RenditionFactory\Format\FormatFactory: ~
6 changes: 3 additions & 3 deletions lib/php/rendition-factory/src/Command/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function configure(): void

$this->addArgument('src', InputArgument::REQUIRED, 'The source file');
$this->addArgument('build-config', InputArgument::REQUIRED, 'The build config YAML file');
$this->addOption('type', 't', InputOption::VALUE_REQUIRED, 'Force the MIME type of file');
$this->addOption('type', 't', InputOption::VALUE_OPTIONAL, 'Force the MIME type of file');
$this->addOption('working-dir', 'w', InputOption::VALUE_REQUIRED, 'The working directory. Defaults to system temp directory');
$this->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'The output file name WITHOUT extension');
$this->addOption('debug', 'd', InputOption::VALUE_NONE, 'set to debug mode (keep files in working directory)');
Expand Down Expand Up @@ -72,8 +72,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$buildConfig,
$options
);
$output->writeln(sprintf('Rendition created: %s', $outputFile->getPath()));

} catch (\InvalidArgumentException $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));

Expand All @@ -93,6 +91,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

$output->writeln(sprintf('Rendition created: %s', $outputFile->getPath()));

if (!$input->getOption('debug')) {
$this->renditionCreator->cleanUp();
}
Expand Down
1 change: 0 additions & 1 deletion lib/php/rendition-factory/src/Config/YamlLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ private function parseTransformation(array $transformation): Transformation
{
return new Transformation(
$transformation['module'],
$transformation['enabled'] ?? true,
$transformation['options'] ?? [],
$transformation['description'] ?? null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ public function __construct(

public function getTransformations(): array
{
return array_filter(
$this->transformations,
fn (Transformation $transformation) => $transformation->isEnabled()
);
return $this->transformations;
}

public function getNormalization(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{
public function __construct(
private string $module,
private bool $enabled,
private array $options,
private ?string $description,
) {
Expand All @@ -26,9 +25,4 @@ public function getOptions(): array
{
return $this->options;
}

public function isEnabled(): bool
{
return $this->enabled;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\Video;

class WebM extends \FFMpeg\Format\Video\WebM
{
protected $videoCodecs = [];

public function __construct($audioCodec = 'libvorbis', $videoCodec = 'libvpx')
{
$this->videoCodecs = parent::getAvailableVideoCodecs();
if (!in_array('copy', $this->videoCodecs)) {
$this->videoCodecs[] = 'copy';
}
parent::__construct($audioCodec, $videoCodec);
}

public function getAvailableVideoCodecs()
{
return $this->videoCodecs;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\Video;

class X264 extends \FFMpeg\Format\Video\X264
{
protected $videoCodecs = [];

public function __construct($audioCodec = 'aac', $videoCodec = 'libx264')
{
$this->videoCodecs = parent::getAvailableVideoCodecs();
if (!in_array('copy', $this->videoCodecs)) {
$this->videoCodecs[] = 'copy';
}
parent::__construct($audioCodec, $videoCodec);
}

public function getAvailableVideoCodecs()
{
return $this->videoCodecs;
}
}
Loading

0 comments on commit 2e07842

Please sign in to comment.