1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-04-27 16:58:16 +02:00
parent ed8a7c25cd
commit bc40cd6214

View File

@ -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,