diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-02-23 11:02:11 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-02-23 20:26:26 +0100 |
commit | ff311c091854a2cf2d49b5ecfa6759084fe643a7 (patch) | |
tree | c5022ba741fed806a13f10e7c52cca6a6f078907 /libavcodec/utils.c | |
parent | 171273fec82d465e0c0d94e462f1073d5ff26cf3 (diff) | |
download | ffmpeg-ff311c091854a2cf2d49b5ecfa6759084fe643a7.tar.gz |
lavc: drop encode() support for video.
All video encoders have been converted to encode2(), all new encoders
should also use only encode2().
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index c88f379570..67c9e36bba 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1082,9 +1082,6 @@ int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf } #endif -#define MAX_CODED_FRAME_SIZE(width, height)\ - (8*(width)*(height) + FF_MIN_BUFFER_SIZE) - int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, @@ -1103,44 +1100,15 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) return AVERROR(EINVAL); - if (avctx->codec->encode2) { - *got_packet_ptr = 0; - ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); - if (!ret) { - if (!*got_packet_ptr) - avpkt->size = 0; - else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) - avpkt->pts = avpkt->dts = frame->pts; - } - } else { - /* for compatibility with encoders not supporting encode2(), we need to - allocate a packet buffer if the user has not provided one or check - the size otherwise */ - int buf_size = avpkt->size; - - if (!user_packet) - buf_size = MAX_CODED_FRAME_SIZE(avctx->width, avctx->height); - - if ((ret = ff_alloc_packet(avpkt, buf_size))) - return ret; - - /* encode the frame */ - ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size, frame); - if (ret >= 0) { - if (!ret) { - /* no output. if the packet data was allocated by libavcodec, - free it */ - if (!user_packet) - av_freep(&avpkt->data); - } else if (avctx->coded_frame) { - avpkt->pts = avctx->coded_frame->pts; - avpkt->flags |= AV_PKT_FLAG_KEY*avctx->coded_frame->key_frame; - } + av_assert0(avctx->codec->encode2); - avpkt->size = ret; - *got_packet_ptr = (ret > 0); - ret = 0; - } + *got_packet_ptr = 0; + ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); + if (!ret) { + if (!*got_packet_ptr) + avpkt->size = 0; + else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) + avpkt->pts = avpkt->dts = frame->pts; } if (!ret) |