Instead of hard-coding input 0, pass the per-input structure and use the link contained inside it.
Unified · Split
| @@ -715,19 +715,18 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix) · 714 unmodified lines | ||
| 715 | 715 | return NULL; |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | −static void update_crops(AVFilterContext *ctx, | |
| 719 | − struct pl_frame_mix *mix, struct pl_frame *target, | |
| 720 | − double target_pts) | |
| 718 | +static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, | |
| 719 | + struct pl_frame *target, double target_pts) | |
| 721 | 720 | { |
| 722 | 721 | LibplaceboContext *s = ctx->priv; |
| 723 | − const AVFrame *ref = ref_frame(mix); | |
| 722 | + const AVFrame *ref = ref_frame(&in->mix); | |
| 724 | 723 | |
| 725 | − for (int i = 0; i < mix->num_frames; i++) { | |
| 724 | + for (int i = 0; i < in->mix.num_frames; i++) { | |
| 726 | 725 | // Mutate the `pl_frame.crop` fields in-place. This is fine because we |
| 727 | 726 | // own the entire pl_queue, and hence, the pointed-at frames. |
| 728 | − struct pl_frame *image = (struct pl_frame *) mix->frames[i]; | |
| 727 | + struct pl_frame *image = (struct pl_frame *) in->mix.frames[i]; | |
| 729 | 728 | const AVFrame *src = pl_get_mapped_avframe(image); |
| 730 | − double image_pts = src->pts * av_q2d(ctx->inputs[0]->time_base); | |
| 729 | + double image_pts = src->pts * av_q2d(in->link->time_base); | |
| 731 | 730 | |
| 732 | 731 | /* Update dynamic variables */ |
| 733 | 732 | 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) · 117 unmodified lines | ||
| 851 | 850 | goto fail; |
| 852 | 851 | } |
| 853 | 852 | |
| 854 | − update_crops(ctx, &in->mix, &target, out->pts * av_q2d(outlink->time_base)); | |
| 853 | + update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base)); | |
| 855 | 854 | pl_render_image_mix(in->renderer, &in->mix, &target, &s->params); |
| 856 | 855 | |
| 857 | 856 | if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) { |