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", };