summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-06-09 18:35:00 -0300
committerJames Almer <jamrial@gmail.com>2020-06-18 17:11:37 -0300
commit93016f5d1d280f9cb7856883af287fa66affc04c (patch)
tree4f479125115fb53b64b7afc9c6447d24ae441e6e /libavcodec/utils.c
parent827d6fe73d2f5472c1c2128eb14fab6a4db29032 (diff)
avcodec/encode: restructure the old encode API
Following the same logic as 061a0c14bb, this commit turns the old encode API into a wrapper for the new one. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0e256eabb1..b61f274ab3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -585,15 +585,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
avci->to_free = av_frame_alloc();
avci->compat_decode_frame = av_frame_alloc();
+ avci->compat_encode_packet = av_packet_alloc();
avci->buffer_frame = av_frame_alloc();
avci->buffer_pkt = av_packet_alloc();
avci->es.in_frame = av_frame_alloc();
avci->ds.in_pkt = av_packet_alloc();
avci->last_pkt_props = av_packet_alloc();
- if (!avci->to_free || !avci->compat_decode_frame ||
+ if (!avci->compat_decode_frame || !avci->compat_encode_packet ||
!avci->buffer_frame || !avci->buffer_pkt ||
!avci->es.in_frame || !avci->ds.in_pkt ||
- !avci->last_pkt_props) {
+ !avci->to_free || !avci->last_pkt_props) {
ret = AVERROR(ENOMEM);
goto free_and_end;
}
@@ -1043,6 +1044,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_frame_free(&avci->to_free);
av_frame_free(&avci->compat_decode_frame);
av_frame_free(&avci->buffer_frame);
+ av_packet_free(&avci->compat_encode_packet);
av_packet_free(&avci->buffer_pkt);
av_packet_free(&avci->last_pkt_props);
@@ -1082,6 +1084,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
avci->nb_draining_errors = 0;
av_frame_unref(avci->buffer_frame);
av_frame_unref(avci->compat_decode_frame);
+ av_packet_unref(avci->compat_encode_packet);
av_packet_unref(avci->buffer_pkt);
av_frame_unref(avci->es.in_frame);
@@ -1142,6 +1145,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->compat_decode_frame);
av_frame_free(&avctx->internal->buffer_frame);
+ av_packet_free(&avctx->internal->compat_encode_packet);
av_packet_free(&avctx->internal->buffer_pkt);
av_packet_free(&avctx->internal->last_pkt_props);