X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fcdgraphics.c;h=965f43684ad8e6c27e11633d3b72592ecc44d566;hb=37d742b607d47122d23d548ffd7ad9b09cbc5298;hp=cf3f01a417bb3f7b535f9b28ec3b19bc15e8f5eb;hpb=2ac399d7faa5ac80088715780769522d1141b549;p=ffmpeg diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index cf3f01a417b..965f43684ad 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -283,7 +283,7 @@ static int cdg_decode_frame(AVCodecContext *avctx, bytestream2_init(&gb, avpkt->data, avpkt->size); - if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0) + if ((ret = ff_reget_buffer(avctx, cc->frame, 0)) < 0) return ret; if (!cc->cleared) { memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height); @@ -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, };