From 0b621fdadcbbbc172c8ea175e559f330ae9b71ce Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 20 Oct 2021 08:23:11 +0200 Subject: [PATCH] Libavcodec common: copy all planes with memcpy_data This function may not be used at all but just to make sure. --- src/libavcodec_common.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libavcodec_common.c b/src/libavcodec_common.c index d8bdc6b97..dedf17364 100644 --- a/src/libavcodec_common.c +++ b/src/libavcodec_common.c @@ -1238,9 +1238,14 @@ static void memcpy_data(char * __restrict dst_buffer, AVFrame * __restrict frame { UNUSED(rgb_shift); UNUSED(width); - for (int y = 0; y < height; ++y) { - memcpy(dst_buffer + y * pitch, frame->data[0] + y * frame->linesize[0], - frame->linesize[0]); + for (int comp = 0; comp < AV_NUM_DATA_POINTERS; ++comp) { + if (frame->data[comp] == NULL) { + break; + } + for (int y = 0; y < height; ++y) { + memcpy(dst_buffer + y * pitch, frame->data[comp] + y * frame->linesize[comp], + frame->linesize[comp]); + } } }