aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qpeg.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/qpeg.c
parentab5803553b3932da3227647ae27f2e2795cc5752 (diff)
downloadffmpeg-7b100839330ace3b4846ee4a1fc5caf4b8f8a34e.tar.gz
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/qpeg.c')
-rw-r--r--libavcodec/qpeg.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index f4edc4b16f..2e66d3bf8a 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "decode.h"
#include "internal.h"
typedef struct QpegContext{
@@ -274,8 +275,6 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame * const ref = a->ref;
uint8_t* outdata;
int delta, intra, ret;
- buffer_size_t pal_size;
- const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
if (avpkt->size < 0x86) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
@@ -300,12 +299,7 @@ static int decode_frame(AVCodecContext *avctx,
}
/* make the palette available on the way out */
- if (pal && pal_size == AVPALETTE_SIZE) {
- p->palette_has_changed = 1;
- memcpy(a->pal, pal, AVPALETTE_SIZE);
- } else if (pal) {
- av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
- }
+ p->palette_has_changed = ff_copy_palette(a->pal, avpkt, avctx);
memcpy(p->data[1], a->pal, AVPALETTE_SIZE);
av_frame_unref(ref);