diff mbox series

[FFmpeg-devel,08/46] avcodec/avuienc: Allow user-supplied buffers

Message ID HE1PR0301MB2154F55EF3FBA931D509CA948F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
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 given that this encoder knows the size of the output buffer
in advance.

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

Patch

diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c
index e9e30fe7f4..1c67af3fb5 100644
--- a/libavcodec/avuienc.c
+++ b/libavcodec/avuienc.c
@@ -21,6 +21,7 @@ 
  */
 
 #include "avcodec.h"
+#include "encode.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 
@@ -62,7 +63,7 @@  static int avui_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         skip = 16;
     }
     size = 2 * avctx->width * (avctx->height + skip) + 8 * interlaced;
-    if ((ret = ff_alloc_packet2(avctx, pkt, size, size)) < 0)
+    if ((ret = ff_get_encode_buffer(avctx, pkt, size, 0)) < 0)
         return ret;
     dst = pkt->data;
     if (!interlaced) {
@@ -98,6 +99,6 @@  const AVCodec ff_avui_encoder = {
     .id           = AV_CODEC_ID_AVUI,
     .init         = avui_encode_init,
     .encode2      = avui_encode_frame,
-    .capabilities = AV_CODEC_CAP_EXPERIMENTAL,
+    .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_EXPERIMENTAL,
     .pix_fmts     = (const enum AVPixelFormat[]){ AV_PIX_FMT_UYVY422, AV_PIX_FMT_NONE },
 };