aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/libdavs2.c
diff options
context:
space:
mode:
authorhwrenx2019-03-23 14:07:16 +0800
committerSteven Liu2019-03-23 14:07:16 +0800
commitbf05f621d583728749224a81778258f1b84bafa8 (patch)
tree8ebe4eabb79ffab7bfbb3a85b829162d0c70ec53 /libavcodec/libdavs2.c
parent2cb29a5d8de0c49a2ac2978c2cc39fde2e3a6d66 (diff)
lavc/libdavs2: add davs2_flush
Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: hwrenx <hwrenx@126.com>
Diffstat (limited to 'libavcodec/libdavs2.c')
-rw-r--r--libavcodec/libdavs2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 080872195a..b0eb4fd342 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -129,6 +129,21 @@ static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic, int *g
return 0;
}
+static void davs2_flush(AVCodecContext *avctx)
+{
+ DAVS2Context *cad = avctx->priv_data;
+ int ret = DAVS2_GOT_FRAME;
+
+ while (ret == DAVS2_GOT_FRAME) {
+ ret = davs2_decoder_flush(cad->decoder, &cad->headerset, &cad->out_frame);
+ davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
+ }
+
+ if (ret == DAVS2_ERROR) {
+ av_log(avctx, AV_LOG_WARNING, "Decoder flushing failed.\n");
+ }
+}
+
static int send_delayed_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame)
{
DAVS2Context *cad = avctx->priv_data;
@@ -205,6 +220,7 @@ AVCodec ff_libdavs2_decoder = {
.init = davs2_init,
.close = davs2_end,
.decode = davs2_decode_frame,
+ .flush = davs2_flush,
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },