summaryrefslogtreecommitdiff
path: root/libavcodec/imx.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-17 22:43:32 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-22 02:43:04 +0100
commit7b100839330ace3b4846ee4a1fc5caf4b8f8a34e (patch)
tree5743c922bd05a372bfbe733cf7ee482153d8e55d /libavcodec/imx.c
parentab5803553b3932da3227647ae27f2e2795cc5752 (diff)
avcodec: Factor updating palette out
Because the properties of frames returned from ff_get/reget_buffer are not reset at all, lots of returned frames had palette_has_changed wrongly set to 1. This has been changed, too. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/imx.c')
-rw-r--r--libavcodec/imx.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/imx.c b/libavcodec/imx.c
index 0d6c99e5bf..d86c747c6d 100644
--- a/libavcodec/imx.c
+++ b/libavcodec/imx.c
@@ -21,6 +21,7 @@
#include "libavutil/common.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "decode.h"
#include "internal.h"
typedef struct SimbiosisIMXContext {
@@ -50,16 +51,13 @@ static int imx_decode_frame(AVCodecContext *avctx, void *data,
{
SimbiosisIMXContext *imx = avctx->priv_data;
int ret, x, y;
- buffer_size_t pal_size;
- const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
AVFrame *frame = imx->frame;
GetByteContext gb;
if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
return ret;
- if (pal && pal_size == AVPALETTE_SIZE) {
- memcpy(imx->pal, pal, pal_size);
+ if (ff_copy_palette(imx->pal, avpkt, avctx)) {
frame->palette_has_changed = 1;
frame->key_frame = 1;
} else {