[FFmpeg-cvslog] avcodec/exrenc: Allow user-supplied buffers

Andreas Rheinhardt git at videolan.org
Sun May 16 01:59:16 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Apr 27 16:58:16 2021 +0200| [bc40cd621440107ee7fbe6ec6cab2397acc3874b] | committer: Andreas Rheinhardt

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 <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc40cd621440107ee7fbe6ec6cab2397acc3874b
---

 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,



More information about the ffmpeg-cvslog mailing list