[FFmpeg-cvslog] avcodec/libx265: Allow user-supplied buffers
Andreas Rheinhardt
git at videolan.org
Sun May 23 16:42:24 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Apr 25 01:43:26 2021 +0200| [a4b334327895f17211b4bbbc19ebab41a7aa35dc] | committer: Andreas Rheinhardt
avcodec/libx265: Allow user-supplied buffers
Here the packet size is known before allocating the packet,
so that supporting user-supplied buffers is trivial.
Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4b334327895f17211b4bbbc19ebab41a7aa35dc
---
libavcodec/libx265.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index a1bd205201..90658d3d9e 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -32,6 +32,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
+#include "encode.h"
#include "internal.h"
#include "packet_internal.h"
@@ -531,7 +532,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
for (i = 0; i < nnal; i++)
payload += nal[i].sizeBytes;
- ret = ff_alloc_packet2(avctx, pkt, payload, payload);
+ ret = ff_get_encode_buffer(avctx, pkt, payload, 0);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
@@ -687,6 +688,9 @@ AVCodec ff_libx265_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_OTHER_THREADS |
+ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.init = libx265_encode_init,
.init_static_data = libx265_encode_init_csp,
.encode2 = libx265_encode_frame,
@@ -694,8 +698,6 @@ AVCodec ff_libx265_encoder = {
.priv_data_size = sizeof(libx265Context),
.priv_class = &class,
.defaults = x265_defaults,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
- AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.wrapper_name = "libx265",
};
More information about the ffmpeg-cvslog
mailing list