From 9073f49e6e0403a6709d0daa93e9b978c3c15a2b Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 23 Mar 2024 16:53:14 +0100 Subject: [PATCH] avcodec/dovi_rpu: attach ext blocks to frames --- libavcodec/dovi_rpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 499d8bab4f..9f7a6b0066 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -95,7 +95,7 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) AVFrameSideData *sd; AVBufferRef *buf; AVDOVIMetadata *dovi; - size_t dovi_size; + size_t dovi_size, ext_sz; if (!s->mapping || !s->color) return 0; /* incomplete dovi metadata */ @@ -121,6 +121,10 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) COPY(AVDOVIRpuDataHeader, av_dovi_get_header(dovi), &s->header, disable_residual_flag); COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq_pivots); COPY(AVDOVIColorMetadata, av_dovi_get_color(dovi), s->color, source_diagonal); + ext_sz = FFMIN(sizeof(AVDOVIDmData), dovi->ext_block_size); + for (int i = 0; i < s->num_ext_blocks; i++) + memcpy(av_dovi_get_ext(dovi, i), &s->ext_blocks[i], ext_sz); + dovi->num_ext_blocks = s->num_ext_blocks; return 0; }