Commit 21eafa18 authored by Michael Niedermayer's avatar Michael Niedermayer

msrle: fix extradata palette handling

Fixes Ticket1273
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d74ade7d
...@@ -50,6 +50,7 @@ typedef struct MsrleContext { ...@@ -50,6 +50,7 @@ typedef struct MsrleContext {
static av_cold int msrle_decode_init(AVCodecContext *avctx) static av_cold int msrle_decode_init(AVCodecContext *avctx)
{ {
MsrleContext *s = avctx->priv_data; MsrleContext *s = avctx->priv_data;
int i;
s->avctx = avctx; s->avctx = avctx;
...@@ -72,6 +73,10 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx) ...@@ -72,6 +73,10 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&s->frame); avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
if (avctx->extradata_size >= AVPALETTE_SIZE)
for (i = 0; i < AVPALETTE_SIZE/4; i++)
s->pal[i] = 0xFF<<24 | AV_RL32(avctx->extradata+4*i);
return 0; return 0;
} }
...@@ -101,11 +106,11 @@ static int msrle_decode_frame(AVCodecContext *avctx, ...@@ -101,11 +106,11 @@ static int msrle_decode_frame(AVCodecContext *avctx,
s->frame.palette_has_changed = 1; s->frame.palette_has_changed = 1;
memcpy(s->pal, pal, AVPALETTE_SIZE); memcpy(s->pal, pal, AVPALETTE_SIZE);
} }
/* make the palette available */
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
} }
/* make the palette available */
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
/* FIXME how to correctly detect RLE ??? */ /* FIXME how to correctly detect RLE ??? */
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
......
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