diff mbox series

[FFmpeg-devel,36/46] avcodec/v210enc: Allow user-supplied buffers

Message ID HE1PR0301MB21543161FFBF8F230EBD0D048F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 1dc8f237872daed6bca9a2e444fd60c5bbf72b44
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:57 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/v210enc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index 020f0fffe5..ffa1cb6f4b 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -23,6 +23,7 @@ 
 
 #include "avcodec.h"
 #include "bytestream.h"
+#include "encode.h"
 #include "internal.h"
 #include "v210enc.h"
 
@@ -118,7 +119,7 @@  static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int ret;
     uint8_t *dst;
 
-    ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride, avctx->height * stride);
+    ret = ff_get_encode_buffer(avctx, pkt, avctx->height * stride, 0);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
         return ret;
@@ -156,6 +157,7 @@  const AVCodec ff_v210_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_V210,
+    .capabilities   = AV_CODEC_CAP_DR1,
     .priv_data_size = sizeof(V210EncContext),
     .init           = encode_init,
     .encode2        = encode_frame,