Skip to content

Commit

Permalink
WIP DO NOT MERGE
Browse files Browse the repository at this point in the history
- fix attributes access in twig : use `"{{ attr.myfield }}"` where `myfield` is the *slugified* attribute name
  • Loading branch information
jygaulier committed Nov 18, 2024
1 parent bb8e419 commit 33f9791
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,8 @@ private function doVideo(array $options, InputFileInterface $inputFile, Transfor
/** @var Video $video */
$video = $commonArgs->getFFMpeg()->open($inputFile->getPath());

$resolverContext = [
'metadata' => $transformationContext->getTemplatingContext(),
'input' => $video->getStreams()->videos()->first()->all(),
];
$resolverContext = $transformationContext->getTemplatingContext();
$resolverContext['input'] = $video->getStreams()->videos()->first()->all();

if ($videoCodec = $this->optionsResolver->resolveOption($options['video_codec'] ?? null, $resolverContext)) {
if (!in_array($videoCodec, $FFMpegFormat->getAvailableVideoCodecs())) {
Expand Down Expand Up @@ -424,9 +422,7 @@ function ($filter) use ($resolverContext) {
*/
private function doAudio(array $options, InputFileInterface $inputFile, TransformationContextInterface $context, ModuleCommonArgs $commonArgs): OutputFileInterface
{
$resolverContext = [
'metadata' => $context->getTemplatingContext(),
];
$resolverContext = $context->getTemplatingContext();

$format = $commonArgs->getOutputFormat()->getFormat();
if (!method_exists($commonArgs->getOutputFormat(), 'getFFMpegFormat')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public function __construct(
TransformationContextInterface $context,
ModuleOptionsResolver $optionsResolver)
{
$resolverContext = [
'metadata' => $context->getTemplatingContext(),
];
$resolverContext = $context->getTemplatingContext();

$format = $optionsResolver->resolveOption($options['format'] ?? null, $resolverContext);
if (!$format) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ public function transform(InputFileInterface $inputFile, array $options, Transfo
/** @var FFMpeg\Media\Video $video */
$video = $commonArgs->getFFMpeg()->open($inputFile->getPath());

$resolverContext = [
'metadata' => $context->getTemplatingContext(),
'input' => $video->getStreams()->videos()->first()->all(),
];

$resolverContext = $context->getTemplatingContext();
$resolverContext['input'] = $video->getStreams()->videos()->first()->all();

$period = $this->optionsResolver->resolveOption($options['period'] ?? 0, $resolverContext);
$periodAsTimecode = FFMpegHelper::optionAsTimecode($period);
if (null === $periodAsTimecode || ($period = FFMpegHelper::timecodeToseconds($periodAsTimecode)) <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ public function transform(InputFileInterface $inputFile, array $options, Transfo
/** @var FFMpeg\Media\Video $video */
$video = $commonArgs->getFFMpeg()->open($inputFile->getPath());

$resolverContext = [
'metadata' => $context->getTemplatingContext(),
'input' => $video->getStreams()->videos()->first()->all(),
];
$resolverContext = $context->getTemplatingContext();
$resolverContext['input'] = $video->getStreams()->videos()->first()->all();

$start = $this->optionsResolver->resolveOption($options['start'] ?? 0, $resolverContext);
$startAsTimecode = FFMpegHelper::optionAsTimecode($start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ public function transform(InputFileInterface $inputFile, array $options, Transfo
/** @var Video $video */
$video = $commonArgs->getFFMpeg()->open($inputFile->getPath());

$resolverContext = [
'metadata' => $context->getTemplatingContext(),
'input' => $video->getStreams()->videos()->first()->all(),
];
$resolverContext = $context->getTemplatingContext();
$resolverContext['input'] = $video->getStreams()->videos()->first()->all();

$start = $this->optionsResolver->resolveOption($options['start'] ?? 0, $resolverContext);
$startAsTimecode = FFMpegHelper::optionAsTimecode($start);
Expand Down

0 comments on commit 33f9791

Please sign in to comment.