File 0005-Fix-compatibility-with-ffmpeg-7.0.patch of Package chromaprint

From: Sebastian Ramacher <sebastian@ramacher.at>
Date: Fri, 2 Aug 2024 23:38:21 +0200
Subject: Fix compatibility with ffmpeg 7.0

---
 src/audio/ffmpeg_audio_reader.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/audio/ffmpeg_audio_reader.h b/src/audio/ffmpeg_audio_reader.h
index 35b2934..d57d9a1 100644
--- a/src/audio/ffmpeg_audio_reader.h
+++ b/src/audio/ffmpeg_audio_reader.h
@@ -118,8 +118,13 @@ inline bool FFmpegAudioReader::SetInputSampleRate(int sample_rate) {
 
 inline bool FFmpegAudioReader::SetInputChannels(int channels) {
 	char buf[64];
-	sprintf(buf, "%d", channels);
-	return av_dict_set(&m_input_opts, "channels", buf, 0) >= 0;
+	if (channels == 1)
+		sprintf(buf, "%s", "mono");
+	else if (channels == 2)
+		sprintf(buf, "%s", "stereo");
+	else
+		sprintf(buf, "%d channels", channels);
+	return av_dict_set(&m_input_opts, "ch_layout", buf, 0) >= 0;
 }
 
 inline bool FFmpegAudioReader::Open(const std::string &file_name) {
openSUSE Build Service is sponsored by