diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-27 16:58:16 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-05-15 12:14:41 +0200 |
commit | ed8a7c25cdef1a58362471240c218a02dd903619 (patch) | |
tree | ee59168458fd2f02c5ac38ee3a997d6f6ddee72d /libavcodec/vc2enc.c | |
parent | 911806ec7562daa5ae8a84a0c0a2e1741f99cb41 (diff) | |
download | ffmpeg-ed8a7c25cdef1a58362471240c218a02dd903619.tar.gz |
avcodec/vc2enc: Allow user-supplied buffers
Trivial for an encoder that has a very good estimate of the size
of the output packet in advance.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/vc2enc.c')
-rw-r--r-- | libavcodec/vc2enc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index ca5cebb742..2de6d4b17a 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -22,6 +22,7 @@ #include "libavutil/pixdesc.h" #include "libavutil/opt.h" #include "dirac.h" +#include "encode.h" #include "put_bits.h" #include "internal.h" #include "version.h" @@ -914,9 +915,8 @@ static int encode_frame(VC2EncContext *s, AVPacket *avpkt, const AVFrame *frame, max_frame_bytes = header_size + calc_slice_sizes(s); if (field < 2) { - ret = ff_alloc_packet2(s->avctx, avpkt, - max_frame_bytes << s->interlaced, - max_frame_bytes << s->interlaced); + ret = ff_get_encode_buffer(s->avctx, avpkt, + max_frame_bytes << s->interlaced, 0); if (ret) { av_log(s->avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; @@ -1231,10 +1231,10 @@ const AVCodec ff_vc2_encoder = { .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-2"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_DIRAC, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS, .priv_data_size = sizeof(VC2EncContext), .init = vc2_encode_init, .close = vc2_encode_end, - .capabilities = AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, .encode2 = vc2_encode_frame, .priv_class = &vc2enc_class, |