diff options
author | wm4 <wm4@nowhere> | 2016-06-24 18:20:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-24 18:20:36 +0200 |
commit | 393bb2a565dc1e27812e1dd20747814892f80da2 (patch) | |
tree | d532a28bfa02b58d14f551b301eb4424be08300c /video | |
parent | ea098d3462ff200a9712e6552e2d2e8a46d44ebc (diff) |
image_writer: port to new encode API
Diffstat (limited to 'video')
-rw-r--r-- | video/image_writer.c | 12 |
1 files changed, 12 insertions, 0 deletions
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); |