From 2d8591c27e2dc582a7020e2580e16278dbfbddff Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Apr 2011 15:49:51 +0200 Subject: make containers pass palette change in AVPacket Signed-off-by: Luca Barbato --- libavcodec/qpeg.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'libavcodec/qpeg.c') diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index ccd634ae80..c96184ff38 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -30,6 +30,7 @@ typedef struct QpegContext{ AVCodecContext *avctx; AVFrame pic; uint8_t *refdata; + uint32_t pal[256]; } QpegContext; static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size, @@ -256,6 +257,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p= (AVFrame*)&a->pic; uint8_t* outdata; int delta; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if(p->data[0]) avctx->release_buffer(avctx, p); @@ -274,11 +276,11 @@ static int decode_frame(AVCodecContext *avctx, } /* make the palette available on the way out */ - memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE); - if (a->avctx->palctrl->palette_changed) { + if (pal) { a->pic.palette_has_changed = 1; - a->avctx->palctrl->palette_changed = 0; + memcpy(a->pal, pal, AVPALETTE_SIZE); } + memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE); *data_size = sizeof(AVFrame); *(AVFrame*)data = a->pic; @@ -289,10 +291,6 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx){ QpegContext * const a = avctx->priv_data; - if (!avctx->palctrl) { - av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n"); - return -1; - } a->avctx = avctx; avctx->pix_fmt= PIX_FMT_PAL8; a->refdata = av_malloc(avctx->width * avctx->height); -- cgit v1.2.3