avcodec/aom_film_grain: use av_frame_side_data_add() where useful

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2025-01-02 12:10:18 -03:00
parent 42e72d5c8b
commit f635f19537

View file

@ -362,18 +362,14 @@ int ff_aom_attach_film_grain_sets(const AVFilmGrainAFGS1Params *s, AVFrame *fram
return 0;
for (int i = 0; i < FF_ARRAY_ELEMS(s->sets); i++) {
AVBufferRef *buf;
if (!s->sets[i])
continue;
buf = av_buffer_ref(s->sets[i]);
if (!buf || !av_frame_new_side_data_from_buf(frame,
AV_FRAME_DATA_FILM_GRAIN_PARAMS, buf)) {
av_buffer_unref(&buf);
if (!av_frame_side_data_add(&frame->side_data, &frame->nb_side_data,
AV_FRAME_DATA_FILM_GRAIN_PARAMS, &s->sets[i],
AV_FRAME_SIDE_DATA_FLAG_NEW_REF))
return AVERROR(ENOMEM);
}
}
return 0;
}