summaryrefslogtreecommitdiff
path: root/libavcodec/msrle.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-04-09 15:49:51 +0200
committerLuca Barbato <lu_zero@gentoo.org>2011-04-15 18:02:05 +0200
commit2d8591c27e2dc582a7020e2580e16278dbfbddff (patch)
tree5e251cc6e974c0b9e2c99b3f6e622b4983e4941a /libavcodec/msrle.c
parent4de339e219908ff44cbb1d823edeeead3b8facda (diff)
make containers pass palette change in AVPacket
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/msrle.c')
-rw-r--r--libavcodec/msrle.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index a400589fde..f426b058bd 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -26,9 +26,6 @@
* http://www.pcisys.net/~melanson/codecs/
*
* The MS RLE decoder outputs PAL8 colorspace data.
- *
- * Note that this decoder expects the palette colors from the end of the
- * BITMAPINFO header passed through palctrl.
*/
#include <stdio.h>
@@ -46,6 +43,7 @@ typedef struct MsrleContext {
const unsigned char *buf;
int size;
+ uint32_t pal[256];
} MsrleContext;
static av_cold int msrle_decode_init(AVCodecContext *avctx)
@@ -91,13 +89,16 @@ static int msrle_decode_frame(AVCodecContext *avctx,
return -1;
}
- if (s->avctx->palctrl) {
- /* make the palette available */
- memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
- if (s->avctx->palctrl->palette_changed) {
+ if (avctx->bits_per_coded_sample <= 8) {
+ const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+
+ if (pal) {
s->frame.palette_has_changed = 1;
- s->avctx->palctrl->palette_changed = 0;
+ memcpy(s->pal, pal, AVPALETTE_SIZE);
}
+
+ /* make the palette available */
+ memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
}
/* FIXME how to correctly detect RLE ??? */