1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avfilter/vf_libplacebo: use the first visible input for metadata

Instead of undconditionally using the first input. This covers the case of
one layer fully obscuring another layer, in which case that should become
the new "base" layer.
This commit is contained in:
Niklas Haas
2025-08-07 22:25:32 +02:00
committed by Niklas Haas
parent 62893fb94e
commit d69ccbfc18

View File

@@ -940,7 +940,11 @@ static int output_frame(AVFilterContext *ctx, int64_t pts)
if (!cropped && cur->repr.alpha == PL_ALPHA_NONE) {
idx_start = i;
nb_visible = 0;
ref = NULL;
}
/* Use first visible input as overall reference */
if (!ref)
ref = ref_frame(&in->mix);
nb_visible++;
}
@@ -948,15 +952,6 @@ static int output_frame(AVFilterContext *ctx, int64_t pts)
* valid nonempty frame mix */
av_assert1(nb_visible > 0);
/* Use the first active input as metadata reference */
for (int i = 0; i < s->nb_inputs; i++) {
const LibplaceboInput *in = &s->inputs[i];
if (in->qstatus == PL_QUEUE_OK && (ref = ref_frame(&in->mix)))
break;
}
if (!ref)
return 0;
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
return AVERROR(ENOMEM);