commit:     ab82e421dc3c06d43ab37faae5b5e0fd0d405c56
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  1 17:17:22 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Tue Apr  1 17:29:26 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab82e421

media-libs/chromaprint: backport runtime fix for ffmpeg-7

Not closing bug #953008 given still getting a test failure
with ffmpeg-7 (not really investigated, could be harmless)

Expected equality of these values:
  2
  reader.GetChannels()
    Which is: 1
[  FAILED  ] FFmpegAudioReaderTest.ReadRaw (0 ms)

Does not seem caused by the patch given tests passes when
using ffmpeg-6, the patch also fixes an issue with ffmpeg-6
so there's no reason not to add it.

(also side-fix ExcessiveLineLength warning while here)

Bug: https://bugs.gentoo.org/953008
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 ...1.5.1-r3.ebuild => chromaprint-1.5.1-r4.ebuild} | 15 +++++--
 media-libs/chromaprint/files/ffmpeg-7.patch        | 46 ++++++++++++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild 
b/media-libs/chromaprint/chromaprint-1.5.1-r4.ebuild
similarity index 80%
rename from media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild
rename to media-libs/chromaprint/chromaprint-1.5.1-r4.ebuild
index 752ca312c06d..c1b5aa0cf383 100644
--- a/media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild
+++ b/media-libs/chromaprint/chromaprint-1.5.1-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -9,8 +9,12 @@ inherit cmake-multilib
 
 DESCRIPTION="Library implementing a custom algorithm for extracting audio 
fingerprints"
 HOMEPAGE="https://acoustid.org/chromaprint";
-SRC_URI="https://github.com/acoustid/${PN}/releases/download/v${PV}/${P}.tar.gz
-       test? ( https://github.com/google/googletest/archive/v$(ver_cut 1-2 
${GTEST_VERSION}).x.tar.gz -> gtest-${GTEST_VERSION}.tar.gz )
+SRC_URI="
+       https://github.com/acoustid/${PN}/releases/download/v${PV}/${P}.tar.gz
+       test? (
+               https://github.com/google/googletest/archive/v$(ver_cut 1-2 
${GTEST_VERSION}).x.tar.gz
+                       -> gtest-${GTEST_VERSION}.tar.gz
+       )
 "
 
 LICENSE="LGPL-2.1"
@@ -27,7 +31,10 @@ DEPEND="${RDEPEND}
        test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )"
 
 DOCS=( NEWS.txt README.md )
-PATCHES=( "${FILESDIR}"/ffmpeg-5.patch )
+PATCHES=(
+       "${FILESDIR}"/ffmpeg-5.patch
+       "${FILESDIR}"/ffmpeg-7.patch
+)
 
 multilib_src_configure() {
        export 
GTEST_ROOT="${WORKDIR}/googletest-${GTEST_DIR_VERSION}/googletest/"

diff --git a/media-libs/chromaprint/files/ffmpeg-7.patch 
b/media-libs/chromaprint/files/ffmpeg-7.patch
new file mode 100644
index 000000000000..58e16564b8f6
--- /dev/null
+++ b/media-libs/chromaprint/files/ffmpeg-7.patch
@@ -0,0 +1,46 @@
+While this was to fix an occasional ffmpeg-5 issue, it fixes
+a bigger issue with ffmpeg-7.
+
+https://bugs.gentoo.org/953008
+https://github.com/acoustid/chromaprint/issues/142
+https://github.com/acoustid/chromaprint/commit/82781d02cd30
+From: Marshal Walker <[email protected]>
+Date: Thu, 8 Dec 2022 11:53:58 -0500
+Subject: [PATCH] ffmpeg5 fix for issue #122
+
+tested on Arch Linux, needs testing on win/mac/etc (should be fine tho)
+--- a/src/audio/ffmpeg_audio_processor_swresample.h
++++ b/src/audio/ffmpeg_audio_processor_swresample.h
+@@ -29,7 +29,7 @@ class FFmpegAudioProcessor {
+       }
+ 
+       void SetInputChannelLayout(AVChannelLayout *channel_layout) {
+-              av_opt_set_int(m_swr_ctx, "in_channel_layout", 
channel_layout->u.mask, 0);
++              av_opt_set_chlayout(m_swr_ctx, "in_chlayout", channel_layout, 
0);
+       }
+ 
+       void SetInputSampleFormat(AVSampleFormat sample_format) {
+@@ -41,7 +41,7 @@ class FFmpegAudioProcessor {
+       }
+ 
+       void SetOutputChannelLayout(AVChannelLayout *channel_layout) {
+-              av_opt_set_int(m_swr_ctx, "out_channel_layout", 
channel_layout->u.mask, 0);
++              av_opt_set_chlayout(m_swr_ctx, "out_chlayout", channel_layout, 
0);
+       }
+ 
+       void SetOutputSampleFormat(AVSampleFormat sample_format) {
+--- a/src/audio/ffmpeg_audio_reader.h
++++ b/src/audio/ffmpeg_audio_reader.h
+@@ -301,9 +301,10 @@ inline bool FFmpegAudioReader::Read(const int16_t **data, 
size_t *size) {
+                               } else {
+                                       m_has_more_frames = false;
+                               }
++                      } else {
++                              SetError("Error decoding the audio source", 
ret);
++                              return false;
+                       }
+-                      SetError("Error decoding the audio source", ret);
+-                      return false;
+               }
+ 
+               if (m_frame->nb_samples > 0) {

Reply via email to