aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_libplacebo.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-06-15 15:47:55 +0200
committerNiklas Haas <git@haasn.dev>2023-06-20 17:09:57 +0200
commita7775bd32c461ccb0ef314f33bf879aea1f0d2a0 (patch)
treef0734cfb187b7175828105cafc35111028250a1a /libavfilter/vf_libplacebo.c
parent93c7e8c0ae2948ba68d1b9ef7d939f96d06cbc50 (diff)
downloadffmpeg-a7775bd32c461ccb0ef314f33bf879aea1f0d2a0.tar.gz
lavfi/vf_libplacebo: use correct link in update_crops()
Instead of hard-coding input 0, pass the per-input structure and use the link contained inside it.
Diffstat (limited to 'libavfilter/vf_libplacebo.c')
-rw-r--r--libavfilter/vf_libplacebo.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index b83df24a84..408fb3918a 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -715,19 +715,18 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix)
return NULL;
}
-static void update_crops(AVFilterContext *ctx,
- struct pl_frame_mix *mix, struct pl_frame *target,
- double target_pts)
+static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
+ struct pl_frame *target, double target_pts)
{
LibplaceboContext *s = ctx->priv;
- const AVFrame *ref = ref_frame(mix);
+ const AVFrame *ref = ref_frame(&in->mix);
- for (int i = 0; i < mix->num_frames; i++) {
+ for (int i = 0; i < in->mix.num_frames; i++) {
// Mutate the `pl_frame.crop` fields in-place. This is fine because we
// own the entire pl_queue, and hence, the pointed-at frames.
- struct pl_frame *image = (struct pl_frame *) mix->frames[i];
+ struct pl_frame *image = (struct pl_frame *) in->mix.frames[i];
const AVFrame *src = pl_get_mapped_avframe(image);
- double image_pts = src->pts * av_q2d(ctx->inputs[0]->time_base);
+ double image_pts = src->pts * av_q2d(in->link->time_base);
/* Update dynamic variables */
s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts;
@@ -851,7 +850,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts)
goto fail;
}
- update_crops(ctx, &in->mix, &target, out->pts * av_q2d(outlink->time_base));
+ update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base));
pl_render_image_mix(in->renderer, &in->mix, &target, &s->params);
if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {