public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/files/, media-video/ffmpeg/
Date: Tue, 12 Mar 2024 03:37:24 +0000 (UTC)	[thread overview]
Message-ID: <1710214614.0b5305498974c036f83c71adc8fb4a40106858c7.sam@gentoo> (raw)

commit:     0b5305498974c036f83c71adc8fb4a40106858c7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 12 03:35:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 12 03:36:54 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b530549

media-video/ffmpeg: fix build w/ newer libjxl

Closes: https://bugs.gentoo.org/924431
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild          |   1 +
 .../ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch     | 112 +++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild b/media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild
index 8cf74299df2e..4393adc2906b 100644
--- a/media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild
@@ -348,6 +348,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-6.0-fix-lto-type-mismatch.patch
 	"${FILESDIR}"/${PN}-4.4.4-opencl-parallel-gmake-fix.patch
 	"${FILESDIR}"/${PN}-6.0.1-alignment.patch
+	"${FILESDIR}"/${PN}-6.0.1-libjxl-0.9.patch
 )
 
 MULTILIB_WRAPPED_HEADERS=(

diff --git a/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch b/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch
new file mode 100644
index 000000000000..10c216ec4c88
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch
@@ -0,0 +1,112 @@
+https://bugs.gentoo.org/924431
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=75b1a555a70c178a9166629e43ec2f6250219eb2
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=ac06190a5a11f2b170e7719d769d7c0d65bff3e0
+
+From 75b1a555a70c178a9166629e43ec2f6250219eb2 Mon Sep 17 00:00:00 2001
+From: Leo Izen <leo.izen@gmail.com>
+Date: Sat, 8 Jul 2023 14:43:31 -0400
+Subject: [PATCH] avcodec/libjxldec: build against libjxl 0.9
+
+Git master libjxl changed several function signatures, so this commit
+adds some #ifdefs to handle the new signatures without breaking old
+releases. Do note that old git master development versions of libjxl
+will be broken, but no releases will be.
+
+Signed-off-by: Leo Izen <leo.izen@gmail.com>
+--- a/libavcodec/libjxldec.c
++++ b/libavcodec/libjxldec.c
+@@ -210,14 +210,22 @@ static int libjxl_get_icc(AVCodecContext *avctx)
+     JxlDecoderStatus jret;
+     /* an ICC profile is present, and we can meaningfully get it,
+      * because the pixel data is not XYB-encoded */
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+     jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
++#else
++    jret = JxlDecoderGetICCProfileSize(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
++#endif
+     if (jret == JXL_DEC_SUCCESS && icc_len > 0) {
+         av_buffer_unref(&ctx->iccp);
+         ctx->iccp = av_buffer_alloc(icc_len);
+         if (!ctx->iccp)
+             return AVERROR(ENOMEM);
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+         jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA,
+-                                                ctx->iccp->data, icc_len);
++                                              ctx->iccp->data, icc_len);
++#else
++        jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, ctx->iccp->data, icc_len);
++#endif
+         if (jret != JXL_DEC_SUCCESS) {
+             av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICC Profile\n");
+             av_buffer_unref(&ctx->iccp);
+@@ -253,12 +261,21 @@ static int libjxl_color_encoding_event(AVCodecContext *avctx, AVFrame *frame)
+     /* set this flag if we need to fall back on wide gamut */
+     int fallback = 0;
+ 
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+     jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, NULL, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
++#else
++    jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
++#endif
+     if (jret == JXL_DEC_SUCCESS) {
+         /* enum values describe the colors of this image */
+         jret = JxlDecoderSetPreferredColorProfile(ctx->decoder, &jxl_color);
+         if (jret == JXL_DEC_SUCCESS)
+-            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
++            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt,
++                                                      JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#else
++            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#endif
+         /* if we couldn't successfully request the pixel data space, we fall back on wide gamut */
+         /* this code path is very unlikely to happen in practice */
+         if (jret != JXL_DEC_SUCCESS)
+-- 
+2.30.2
+
+From ac06190a5a11f2b170e7719d769d7c0d65bff3e0 Mon Sep 17 00:00:00 2001
+From: Leo Izen <leo.izen@gmail.com>
+Date: Tue, 23 Jan 2024 17:29:14 -0500
+Subject: [PATCH] avcodec/libjxl.h: include version.h
+
+This file has been exported since our minimum required version (0.7.0),
+but it wasn't documented. Instead it was transitively included by
+<jxl/decode.h> (but not jxl/encode.h), which ffmpeg relied on.
+
+libjxl broke its API in libjxl/libjxl@66b959239355aef5255 by removing
+the transitive include of version.h, and they do not plan on adding
+it back. Instead they are choosing to leave the API backwards-
+incompatible with downstream callers written for some fairly recent
+versions of their API.
+
+As a result, we include <jxl/version.h> to continue to build against
+more recent versions of libjxl. The version macros removed are also
+present in that file, so we no longer need to redefine them.
+
+Signed-off-by: Leo Izen <leo.izen@gmail.com>
+--- a/libavcodec/libjxl.h
++++ b/libavcodec/libjxl.h
+@@ -27,19 +27,8 @@
+ #ifndef AVCODEC_LIBJXL_H
+ #define AVCODEC_LIBJXL_H
+ 
+-#include <jxl/decode.h>
+ #include <jxl/memory_manager.h>
+-
+-/*
+- * libjxl version 0.7.0 and earlier doesn't contain these macros at all
+- * so to detect version 0.7.0 versus 0.8.0 we need to define them ourselves
+- */
+-#ifndef JPEGXL_COMPUTE_NUMERIC_VERSION
+-    #define JPEGXL_COMPUTE_NUMERIC_VERSION(major,minor,patch) ((major<<24) | (minor<<16) | (patch<<8) | 0)
+-#endif
+-#ifndef JPEGXL_NUMERIC_VERSION
+-    #define JPEGXL_NUMERIC_VERSION JPEGXL_COMPUTE_NUMERIC_VERSION(0, 7, 0)
+-#endif
++#include <jxl/version.h>
+ 
+ /**
+  * Transform threadcount in ffmpeg to one used by libjxl.
+-- 
+2.30.2


             reply	other threads:[~2024-03-12  3:37 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  3:37 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-28  4:27 [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/files/, media-video/ffmpeg/ Ionen Wolkens
2025-02-04 16:54 Sam James
2025-01-06  2:16 Sam James
2024-11-25 20:42 Sam James
2024-09-26  7:17 Joonas Niilola
2024-07-20  4:09 Sam James
2024-07-20  4:09 Sam James
2024-05-02  5:21 Sam James
2024-04-10  1:47 Sam James
2024-03-09 22:17 James Le Cuirot
2024-02-29  5:44 Sam James
2024-02-17 14:53 James Le Cuirot
2024-02-06  4:02 Sam James
2024-02-06  4:00 Sam James
2024-01-24 10:58 Sam James
2023-12-18  4:51 Sam James
2023-07-24  2:00 Sam James
2023-05-31 18:43 Sam James
2023-04-23  7:05 Sam James
2023-02-13 22:43 Craig Andrews
2022-07-21  2:53 Matt Turner
2022-03-26 14:20 Joonas Niilola
2020-12-25  2:35 Sam James
2019-09-02 12:00 Alexis Ballier
2019-07-07 18:58 Thomas Deutschmann
2019-02-13 15:19 Alexis Ballier
2018-11-15 16:37 Craig Andrews
2018-07-19 11:08 Alexis Ballier
2018-07-17  7:33 Alexis Ballier
2018-01-18 22:01 James Le Cuirot
2017-08-27 19:23 James Le Cuirot
2017-08-26 13:41 Alexis Ballier
2017-02-07  9:46 Alexis Ballier
2016-12-24 10:33 Alexis Ballier
2016-09-29 16:33 Alexis Ballier
2015-11-12 11:46 Alexis Ballier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1710214614.0b5305498974c036f83c71adc8fb4a40106858c7.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox