diff mbox series

[FFmpeg-devel] avcodec/libx265: fix build error

Message ID tencent_BB9E34F7803E343B3F9156779D74E0605B09@qq.com
State New
Headers show
Series [FFmpeg-devel] avcodec/libx265: fix build error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Zhao Zhili Nov. 3, 2022, 11:11 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

x265_sei is available since X265_BUILD 88. This fixes a regression
from commit 1f585030137.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavcodec/libx265.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

James Almer Nov. 3, 2022, 12:32 p.m. UTC | #1
On 11/3/2022 8:11 AM, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> x265_sei is available since X265_BUILD 88. This fixes a regression
> from commit 1f585030137.

How old are we talking about? Latest release is > 200, so 88 seems 
pretty old.
I'd just bump the minimum required version in configure. It's 70 right 
now, which is equally ancient.

> 
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>   libavcodec/libx265.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 4aa96e1f2d..e36f20a812 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -516,8 +516,10 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>       ctx->api->picture_init(ctx->params, &x265pic);
>   
>       if (pic) {
> +#if X265_BUILD >= 88
>           x265_sei *sei = &x265pic.userSEI;
>           sei->numPayloads = 0;
> +#endif
>           for (i = 0; i < 3; i++) {
>              x265pic.planes[i] = pic->data[i];
>              x265pic.stride[i] = pic->linesize[i];
> @@ -546,6 +548,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>               memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque));
>           }
>   
> +#if X265_BUILD >= 88
>           if (ctx->udu_sei) {
>               for (i = 0; i < pic->nb_side_data; i++) {
>                   AVFrameSideData *side_data = pic->side_data[i];
> @@ -573,6 +576,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>                   sei->numPayloads++;
>               }
>           }
> +#endif
>       }
>   
>       ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
> @@ -713,7 +717,9 @@ static const AVOption options[] = {
>       { "preset",      "set the x265 preset",                                                         OFFSET(preset),    AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
>       { "tune",        "set the x265 tune parameter",                                                 OFFSET(tune),      AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
>       { "profile",     "set the x265 profile",                                                        OFFSET(profile),   AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
> +#if X265_BUILD >= 88
>       { "udu_sei",      "Use user data unregistered SEI if available",                                OFFSET(udu_sei),   AV_OPT_TYPE_BOOL,   { .i64 = 0 }, 0, 1, VE },
> +#endif
>       { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT,   { 0 }, 0, 0, VE },
>       { NULL }
>   };
diff mbox series

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 4aa96e1f2d..e36f20a812 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -516,8 +516,10 @@  static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     ctx->api->picture_init(ctx->params, &x265pic);
 
     if (pic) {
+#if X265_BUILD >= 88
         x265_sei *sei = &x265pic.userSEI;
         sei->numPayloads = 0;
+#endif
         for (i = 0; i < 3; i++) {
            x265pic.planes[i] = pic->data[i];
            x265pic.stride[i] = pic->linesize[i];
@@ -546,6 +548,7 @@  static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
             memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque));
         }
 
+#if X265_BUILD >= 88
         if (ctx->udu_sei) {
             for (i = 0; i < pic->nb_side_data; i++) {
                 AVFrameSideData *side_data = pic->side_data[i];
@@ -573,6 +576,7 @@  static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                 sei->numPayloads++;
             }
         }
+#endif
     }
 
     ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
@@ -713,7 +717,9 @@  static const AVOption options[] = {
     { "preset",      "set the x265 preset",                                                         OFFSET(preset),    AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
     { "tune",        "set the x265 tune parameter",                                                 OFFSET(tune),      AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
     { "profile",     "set the x265 profile",                                                        OFFSET(profile),   AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
+#if X265_BUILD >= 88
     { "udu_sei",      "Use user data unregistered SEI if available",                                OFFSET(udu_sei),   AV_OPT_TYPE_BOOL,   { .i64 = 0 }, 0, 1, VE },
+#endif
     { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT,   { 0 }, 0, 0, VE },
     { NULL }
 };