Commit b86ba370 authored by Mats Peterson's avatar Mats Peterson Committed by Michael Niedermayer

lavc/rawdec: Retrieve nut palette from packets

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d0962160
...@@ -384,7 +384,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -384,7 +384,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
NULL); NULL);
if (pal) { if (pal) {
av_buffer_unref(&context->palette); av_buffer_unref(&context->palette);
context->palette = av_buffer_alloc(AVPALETTE_SIZE); context->palette = av_buffer_alloc(AVPALETTE_SIZE);
...@@ -394,6 +393,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -394,6 +393,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
} }
memcpy(context->palette->data, pal, AVPALETTE_SIZE); memcpy(context->palette->data, pal, AVPALETTE_SIZE);
frame->palette_has_changed = 1; 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;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment