-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS-670-rendition-video_enhance2 (#472)
* WIP twig * allow dynamic options (twig), e.g. `width: "{{ input.width / 5 }}"` * cs * use existing TemplateResolver ; Avoid compiling "not-twig" templates * cleanup ; filter now logs resolved options values * commit forgotten files... * commit forgotten files... * remove state from ModuleOptionsResolver * call template resolver only for _strings_ containing "{" * resolve options one by one ; factorize common code * remove state from service(s) ; set "projection" * add log ; check input file family * turn base class abstract * rename classes
- Loading branch information
Showing
10 changed files
with
382 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/php/rendition-factory/src/Config/ModuleOptionsResolver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Alchemy\RenditionFactory\Config; | ||
|
||
use Alchemy\RenditionFactory\Templating\TemplateResolverInterface; | ||
|
||
class ModuleOptionsResolver | ||
{ | ||
public function __construct(private TemplateResolverInterface $templateResolver) | ||
{ | ||
} | ||
|
||
public function resolveOption(mixed $option, array $context): mixed | ||
{ | ||
return is_string($option) ? $this->templateResolver->resolve($option, $context) : $option; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
lib/php/rendition-factory/src/Transformer/Video/AbstractVideoTransformer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Alchemy\RenditionFactory\Transformer\Video; | ||
|
||
use Alchemy\RenditionFactory\Config\ModuleOptionsResolver; | ||
use Alchemy\RenditionFactory\Transformer\Video\FFMpeg\Format\FormatInterface; | ||
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; | ||
use Symfony\Component\DependencyInjection\ServiceLocator; | ||
|
||
abstract readonly class AbstractVideoTransformer | ||
{ | ||
public function __construct(#[AutowireLocator(FormatInterface::TAG, defaultIndexMethod: 'getFormat')] protected ServiceLocator $formats, | ||
protected ModuleOptionsResolver $optionsResolver, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.