summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-03-12 03:35:38 +0000
committerSam James <sam@gentoo.org>2024-03-12 03:36:54 +0000
commit0b5305498974c036f83c71adc8fb4a40106858c7 (patch)
tree9792290562cf38440d7922b5878508a23b5bc249 /media-video
parentnet-wireless/libxtrxll: mark as LTO-unsafe, strict-aliasing unsafe (diff)
downloadgentoo-0b5305498974c036f83c71adc8fb4a40106858c7.tar.gz
gentoo-0b5305498974c036f83c71adc8fb4a40106858c7.tar.bz2
gentoo-0b5305498974c036f83c71adc8fb4a40106858c7.zip
media-video/ffmpeg: fix build w/ newer libjxl
Closes: https://bugs.gentoo.org/924431 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-video')
-rw-r--r--media-video/ffmpeg/ffmpeg-6.0.1-r3.ebuild1
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch112
2 files changed, 113 insertions, 0 deletions
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