1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
From: =?utf-8?q?Fran=C3=A7ois_Cartegnie?= <fcvlcdev@free.fr>
Date: Tue, 24 Sep 2024 18:53:11 +0700
Subject: codec: x265: handle 4.0 encoding API change
refs #28799
(cherry picked from commit 83e2c3955a563b60f74f05cea57e3ab5f447c8fb)
---
modules/codec/x265.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/codec/x265.c b/modules/codec/x265.c
index 2943ea6..50fe328 100644
--- a/modules/codec/x265.c
+++ b/modules/codec/x265.c
@@ -74,6 +74,11 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
x265_picture pic;
x265_picture_init(&p_sys->param, &pic);
+#ifdef MAX_SCALABLE_LAYERS
+ /* Handle API changes for scalable layers output in x265 4.0 */
+ x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL};
+ pics[0] = &pic;
+#endif
if (likely(p_pict)) {
pic.pts = p_pict->date;
@@ -92,8 +97,13 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
x265_nal *nal;
uint32_t i_nal = 0;
+#ifdef MAX_SCALABLE_LAYERS
+ x265_encoder_encode(p_sys->h, &nal, &i_nal,
+ likely(p_pict) ? &pic : NULL, pics);
+#else
x265_encoder_encode(p_sys->h, &nal, &i_nal,
likely(p_pict) ? &pic : NULL, &pic);
+#endif
if (!i_nal)
return NULL;
|