summaryrefslogtreecommitdiff
path: root/libavcodec/rawdec.c
diff options
context:
space:
mode:
authorMats Peterson <matsp888@yahoo.com>2016-02-16 11:44:50 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-16 14:49:12 +0100
commitb86ba37096dd5c3c45d10fcd994128f973bfee7f (patch)
tree4e859d2b3121f395ceea553450bd76a8fd0b116f /libavcodec/rawdec.c
parentd0962160e0767f3fefe5a00b8e16bb3753efa0ad (diff)
lavc/rawdec: Retrieve nut palette from packets
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 287be96955..3a2fac3ae4 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -384,7 +384,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
NULL);
-
if (pal) {
av_buffer_unref(&context->palette);
context->palette = av_buffer_alloc(AVPALETTE_SIZE);
@@ -394,6 +393,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
memcpy(context->palette->data, pal, AVPALETTE_SIZE);
frame->palette_has_changed = 1;
+ } else if (context->is_nut_pal8) {
+ int vid_size = avctx->width * avctx->height;
+ if (avpkt->size - vid_size) {
+ pal = avpkt->data + vid_size;
+ memcpy(context->palette->data, pal, avpkt->size - vid_size);
+ frame->palette_has_changed = 1;
+ }
}
}