diff mbox series

[FFmpeg-devel,17/46] avcodec/exrenc: Allow user-supplied buffers

Message ID HE1PR0301MB21540DCAB16D018CC254D8EF8F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit bc40cd621440107ee7fbe6ec6cab2397acc3874b
Headers show
Series [FFmpeg-devel,01/46] avcodec/a64multienc: Avoid intermediate buffer | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 29, 2021, 11:56 p.m. UTC
Trivial for an encoder that knows the size of the output packet in
advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/exrenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index b2cb9c4205..60a9948b79 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,