summaryrefslogtreecommitdiff
path: root/libavcodec/cdgraphics.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-09-10 00:39:47 +0200
committerPaul B Mahol <onemda@gmail.com>2020-09-13 16:05:01 +0200
commite1da139a331de753867dc3af2da0d8341f9d2ed5 (patch)
treec6d434094819b5a666ddaf419a31d5da4ffbbfc8 /libavcodec/cdgraphics.c
parent55af1807f7606225616e0a64a2142aa560232887 (diff)
avcodec/cdgraphics: fix decoded output when seeking to start of file
Also in cdg demuxer do not skip packets data, and remove private context which is not really needed.
Diffstat (limited to 'libavcodec/cdgraphics.c')
-rw-r--r--libavcodec/cdgraphics.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index 469128964c..965f43684a 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -365,6 +365,15 @@ static int cdg_decode_frame(AVCodecContext *avctx,
return avpkt->size;
}
+static void cdg_decode_flush(AVCodecContext *avctx)
+{
+ CDGraphicsContext *cc = avctx->priv_data;
+
+ memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);
+ if (!avctx->frame_number)
+ memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
+}
+
static av_cold int cdg_decode_end(AVCodecContext *avctx)
{
CDGraphicsContext *cc = avctx->priv_data;
@@ -383,5 +392,6 @@ AVCodec ff_cdgraphics_decoder = {
.init = cdg_decode_init,
.close = cdg_decode_end,
.decode = cdg_decode_frame,
+ .flush = cdg_decode_flush,
.capabilities = AV_CODEC_CAP_DR1,
};