avfilter/vf_zscale: strip metadata on change

Required for both size changes and color volume changes (as a result of
changing primaries/transfer).
This commit is contained in:
Niklas Haas 2024-04-26 12:59:37 +02:00
parent f22965b882
commit d1eadc43b9

View file

@ -781,7 +781,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
const AVPixFmtDescriptor *odesc = av_pix_fmt_desc_get(outlink->format);
char buf[32];
int ret = 0;
int ret = 0, changed = 0;
AVFrame *out = NULL;
ThreadData td;
@ -875,6 +875,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
(int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
INT_MAX);
if (out->width != in->width || out->height != in->height)
changed |= AV_SIDE_DATA_PROP_SIZE_DEPENDENT;
if (out->color_trc != in->color_trc || out->color_primaries != in->color_primaries)
changed |= AV_SIDE_DATA_PROP_COLOR_DEPENDENT;
av_frame_side_data_remove_by_props(&out->side_data, &out->nb_side_data, changed);
td.in = in;
td.out = out;
td.desc = desc;