From bc40cd621440107ee7fbe6ec6cab2397acc3874b Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 27 Apr 2021 16:58:16 +0200 Subject: [PATCH] avcodec/exrenc: Allow user-supplied buffers Trivial for an encoder that has a good estimate of the size of the output packet in advance. Signed-off-by: Andreas Rheinhardt --- libavcodec/exrenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c index 207a335f44..a594cf5a8d 100644 --- a/libavcodec/exrenc.c +++ b/libavcodec/exrenc.c @@ -33,6 +33,7 @@ #include "libavutil/pixdesc.h" #include "avcodec.h" #include "bytestream.h" +#include "encode.h" #include "internal.h" #include "float2half.h" @@ -352,7 +353,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, avctx->width, avctx->height, 64) * 3LL / 2; - if ((ret = ff_alloc_packet2(avctx, pkt, out_size, out_size)) < 0) + if ((ret = ff_get_encode_buffer(avctx, pkt, out_size, 0)) < 0) return ret; bytestream2_init_writer(pb, pkt->data, pkt->size); @@ -541,10 +542,10 @@ const AVCodec ff_exr_encoder = { .priv_class = &exr_class, .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_EXR, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, .init = encode_init, .encode2 = encode_frame, .close = encode_close, - .capabilities = AV_CODEC_CAP_FRAME_THREADS, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32,