From 393bb2a565dc1e27812e1dd20747814892f80da2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 24 Jun 2016 18:20:36 +0200 Subject: image_writer: port to new encode API --- video/image_writer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/video/image_writer.c b/video/image_writer.c index 6c1c994f7f..5ba89c8167 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -136,9 +136,21 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp pic->color_primaries = mp_csp_prim_to_avcol_pri(image->params.primaries); pic->color_trc = mp_csp_trc_to_avcol_trc(image->params.gamma); } + +#if HAVE_AVCODEC_NEW_CODEC_API + int ret = avcodec_send_frame(avctx, pic); + if (ret < 0) + goto error_exit; + avcodec_send_frame(avctx, NULL); // send EOF + ret = avcodec_receive_packet(avctx, &pkt); + if (ret < 0) + goto error_exit; + got_output = 1; +#else int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output); if (ret < 0) goto error_exit; +#endif fwrite(pkt.data, pkt.size, 1, fp); -- cgit v1.2.3