History

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.

Niklas Haas committed 3 years ago

Commit a7775bd1 parent 93c7e8c1 file · +7 −8Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_libplacebo.c+7−8
@@ -715,19 +715,18 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix) · 714 unmodified lines
715 return NULL;715 return NULL;
716}716}
717 717
718static void update_crops(AVFilterContext *ctx,718static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
719 struct pl_frame_mix *mix, struct pl_frame *target,719 struct pl_frame *target, double target_pts)
720 double target_pts)
721{720{
722 LibplaceboContext *s = ctx->priv;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 // Mutate the `pl_frame.crop` fields in-place. This is fine because we725 // Mutate the `pl_frame.crop` fields in-place. This is fine because we
727 // own the entire pl_queue, and hence, the pointed-at frames.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 const AVFrame *src = pl_get_mapped_avframe(image);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 /* Update dynamic variables */731 /* Update dynamic variables */
733 s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts;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 goto fail;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 pl_render_image_mix(in->renderer, &in->mix, &target, &s->params);854 pl_render_image_mix(in->renderer, &in->mix, &target, &s->params);
856 855
857 if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {856 if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t