Since we're creating a new frame due to the alignment requirement of 16
bytes, we'll have to retrieve the nut palette from the end of the packet
data.
Mats
--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From c5c3c84be927c8dc04708746aa725b73cf1659b5 Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Sun, 14 Feb 2016 07:13:24 +0100
Subject: [PATCH 2/2] lavc/rawdec: Retrieve nut palette in packets
---
libavcodec/rawdec.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 10bca05..b86e5c3 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -365,7 +365,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);
@@ -375,6 +374,14 @@ 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;
+ vid_size = (vid_size + 3) & ~3;
+ if (avpkt->size - vid_size) {
+ uint8_t *pal = avpkt->data + vid_size;
+ memcpy(context->palette->data, pal, avpkt->size - vid_size);
+ frame->palette_has_changed = 1;
+ }
}
}
--
1.7.10.4
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel