summaryrefslogtreecommitdiff
path: root/libavcodec/qpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-28 05:16:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-28 05:16:15 +0100
commit2c923983b6e545f5baae26498c73a476bc81a807 (patch)
tree07a1ca0b7678492ec3009cea28ac46e9b5ac805a /libavcodec/qpeg.c
parent2754dbb6e151732f9d27fcc483e6701f010b5451 (diff)
downloadffmpeg-2c923983b6e545f5baae26498c73a476bc81a807.tar.gz
qpeg: reset palette on seeks
Fixes Ticket1921 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qpeg.c')
-rw-r--r--libavcodec/qpeg.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index 4d8781e762..0a7c788077 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -301,6 +301,18 @@ static int decode_frame(AVCodecContext *avctx,
return avpkt->size;
}
+static void decode_flush(AVCodecContext *avctx){
+ QpegContext * const a = avctx->priv_data;
+ int i, pal_size;
+ const uint8_t *pal_src;
+
+ pal_size = FFMIN(1024U, avctx->extradata_size);
+ pal_src = avctx->extradata + avctx->extradata_size - pal_size;
+
+ for (i=0; i<pal_size/4; i++)
+ a->pal[i] = 0xFFU<<24 | AV_RL32(pal_src+4*i);
+}
+
static av_cold int decode_init(AVCodecContext *avctx){
QpegContext * const a = avctx->priv_data;
@@ -309,6 +321,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
a->avctx = avctx;
avctx->pix_fmt= AV_PIX_FMT_PAL8;
+ decode_flush(avctx);
+
return 0;
}
@@ -333,6 +347,7 @@ AVCodec ff_qpeg_decoder = {
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
+ .flush = decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
};