summaryrefslogtreecommitdiff
path: root/libavcodec/cinepak.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/cinepak.c
parent4de339e219908ff44cbb1d823edeeead3b8facda (diff)
make containers pass palette change in AVPacket
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/cinepak.c')
-rw-r--r--libavcodec/cinepak.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index f325bdb0ce..4bda2a74eb 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -67,6 +67,7 @@ typedef struct CinepakContext {
int sega_film_skip_bytes;
+ uint32_t pal[256];
} CinepakContext;
static void cinepak_decode_codebook (cvid_codebook *codebook,
@@ -395,7 +396,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
s->sega_film_skip_bytes = -1; /* uninitialized state */
// check for paletted data
- if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
+ if (avctx->bits_per_coded_sample != 8) {
s->palette_video = 0;
avctx->pix_fmt = PIX_FMT_YUV420P;
} else {
@@ -427,17 +428,19 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
return -1;
}
- cinepak_decode(s);
-
if (s->palette_video) {
- memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
- if (avctx->palctrl->palette_changed) {
+ const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+ if (pal) {
s->frame.palette_has_changed = 1;
- avctx->palctrl->palette_changed = 0;
- } else
- s->frame.palette_has_changed = 0;
+ memcpy(s->pal, pal, AVPALETTE_SIZE);
+ }
}
+ cinepak_decode(s);
+
+ if (s->palette_video)
+ memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE);
+
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->frame;