summaryrefslogtreecommitdiff
path: root/libavcodec/idcinvideo.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/idcinvideo.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/idcinvideo.c')
-rw-r--r--libavcodec/idcinvideo.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
index 569191511f..b79ec93108 100644
--- a/libavcodec/idcinvideo.c
+++ b/libavcodec/idcinvideo.c
@@ -49,6 +49,7 @@
#include <string.h>
#include "avcodec.h"
+#include "decode.h"
#include "internal.h"
#include "libavutil/internal.h"
@@ -214,8 +215,6 @@ static int idcin_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
IdcinContext *s = avctx->priv_data;
- buffer_size_t pal_size;
- const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
AVFrame *frame = data;
int ret;
@@ -228,12 +227,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
if (idcin_decode_vlcs(s, frame))
return AVERROR_INVALIDDATA;
- if (pal && pal_size == AVPALETTE_SIZE) {
- frame->palette_has_changed = 1;
- memcpy(s->pal, pal, AVPALETTE_SIZE);
- } else if (pal) {
- av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
- }
+ frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
/* make the palette available on the way out */
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);