[FFmpeg-cvslog] lavc/libx265: unbreak build for X265_BUILD >= 210
Gyan Doshi
git at videolan.org
Wed Sep 4 14:57:58 EEST 2024
ffmpeg | branch: release/6.0 | Gyan Doshi <ffmpeg at gyani.pro> | Sun Aug 11 13:09:50 2024 +0530| [6387156008c7118271c5431cf6f06611763e10f4] | committer: Timo Rothenpieler
lavc/libx265: unbreak build for X265_BUILD >= 210
x265 added support for alpha starting with build 210.
While doing so, x265_encoder_encode() changed its fifth arg to
an array of pointers to x265_picture. This broke building lavc/libx265.c
This patch simply unbreaks the build and maintains existing single-layer
non-alpha encoding support.
Fixes #11130
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6387156008c7118271c5431cf6f06611763e10f4
---
libavcodec/libx265.c | 40 ++++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 420d0953af..b52b8a1521 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -575,7 +575,13 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
{
libx265Context *ctx = avctx->priv_data;
x265_picture x265pic;
- x265_picture x265pic_out = { 0 };
+#if X265_BUILD >= 210
+ x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS];
+ x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS];
+#else
+ x265_picture x265pic_solo_out = { 0 };
+#endif
+ x265_picture* x265pic_out;
x265_nal *nal;
x265_sei *sei;
uint8_t *dst;
@@ -698,8 +704,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
+#if X265_BUILD >= 210
+ for (i = 0; i < MAX_SCALABLE_LAYERS; i++)
+ x265pic_lyrptr_out[i] = &x265pic_layers_out[i];
+
+ ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
+ pic ? &x265pic : NULL, x265pic_lyrptr_out);
+#else
ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
- pic ? &x265pic : NULL, &x265pic_out);
+ pic ? &x265pic : NULL, &x265pic_solo_out);
+#endif
for (i = 0; i < sei->numPayloads; i++)
av_free(sei->payloads[i].payload);
@@ -729,10 +743,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
pkt->flags |= AV_PKT_FLAG_KEY;
}
- pkt->pts = x265pic_out.pts;
- pkt->dts = x265pic_out.dts;
+#if X265_BUILD >= 210
+ x265pic_out = x265pic_lyrptr_out[0];
+#else
+ x265pic_out = &x265pic_solo_out;
+#endif
+
+ pkt->pts = x265pic_out->pts;
+ pkt->dts = x265pic_out->dts;
- switch (x265pic_out.sliceType) {
+ switch (x265pic_out->sliceType) {
case X265_TYPE_IDR:
case X265_TYPE_I:
pict_type = AV_PICTURE_TYPE_I;
@@ -750,16 +770,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
#if X265_BUILD >= 130
- if (x265pic_out.sliceType == X265_TYPE_B)
+ if (x265pic_out->sliceType == X265_TYPE_B)
#else
- if (x265pic_out.frameData.sliceType == 'b')
+ if (x265pic_out->frameData.sliceType == 'b')
#endif
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
- ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
+ ff_side_data_set_encoder_stats(pkt, x265pic_out->frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
- if (x265pic_out.userData) {
- int idx = (int)(intptr_t)x265pic_out.userData - 1;
+ if (x265pic_out->userData) {
+ int idx = (int)(intptr_t)x265pic_out->userData - 1;
ReorderedData *rd = &ctx->rd[idx];
#if FF_API_REORDERED_OPAQUE
More information about the ffmpeg-cvslog
mailing list