diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-06 19:34:09 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-06 19:39:11 +0200 |
commit | 21eafa18e6e0768e806eb40cbeb1e80eecbc1257 (patch) | |
tree | 0cf74d4fcc00970f27ae91c2e99a05d58fed0a89 | |
parent | d74ade7d5f4a4e23d26a68b66a51bdae1b6e6387 (diff) | |
download | ffmpeg-21eafa18e6e0768e806eb40cbeb1e80eecbc1257.tar.gz |
msrle: fix extradata palette handling
Fixes Ticket1273
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/msrle.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 0c54f9af5e..db76648a1c 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -50,6 +50,7 @@ typedef struct MsrleContext { static av_cold int msrle_decode_init(AVCodecContext *avctx) { MsrleContext *s = avctx->priv_data; + int i; s->avctx = avctx; @@ -72,6 +73,10 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx) avcodec_get_frame_defaults(&s->frame); 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; } @@ -101,11 +106,11 @@ static int msrle_decode_frame(AVCodecContext *avctx, s->frame.palette_has_changed = 1; 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 ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; |