mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-11-04 10:21:36 +01:00 
			
		
		
		
	community/chromaprint: build with ffmpeg-5
This commit is contained in:
		
							parent
							
								
									502961e928
								
							
						
					
					
						commit
						fb2be62e77
					
				@ -2,15 +2,17 @@
 | 
				
			|||||||
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 | 
					# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 | 
				
			||||||
pkgname=chromaprint
 | 
					pkgname=chromaprint
 | 
				
			||||||
pkgver=1.5.1
 | 
					pkgver=1.5.1
 | 
				
			||||||
pkgrel=1
 | 
					pkgrel=2
 | 
				
			||||||
pkgdesc="C library for generating audio fingerprints used by AcoustID"
 | 
					pkgdesc="C library for generating audio fingerprints used by AcoustID"
 | 
				
			||||||
url="https://acoustid.org/chromaprint"
 | 
					url="https://acoustid.org/chromaprint"
 | 
				
			||||||
arch="all"
 | 
					arch="all"
 | 
				
			||||||
license="MIT"
 | 
					license="MIT"
 | 
				
			||||||
makedepends="cmake fftw-dev ffmpeg4-dev samurai"
 | 
					makedepends="cmake fftw-dev ffmpeg-dev samurai"
 | 
				
			||||||
options="!check"
 | 
					options="!check"
 | 
				
			||||||
subpackages="$pkgname-dev"
 | 
					subpackages="$pkgname-dev"
 | 
				
			||||||
source="$pkgname-$pkgver.tar.gz::https://github.com/acoustid/chromaprint/archive/v$pkgver.tar.gz"
 | 
					source="$pkgname-$pkgver.tar.gz::https://github.com/acoustid/chromaprint/archive/v$pkgver.tar.gz
 | 
				
			||||||
 | 
						ffmpeg5.patch
 | 
				
			||||||
 | 
						"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build() {
 | 
					build() {
 | 
				
			||||||
	cmake -B build -G Ninja \
 | 
						cmake -B build -G Ninja \
 | 
				
			||||||
@ -26,4 +28,5 @@ package() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
sha512sums="
 | 
					sha512sums="
 | 
				
			||||||
ea16e4d2b879c15b1d9b9ec93878da8b893f1834c70942663e1d2d106c2e0a661094fe2dd3bae7a6c2a1f9d5d8fab5e0b0ba493561090cf57b2228606fad1e66  chromaprint-1.5.1.tar.gz
 | 
					ea16e4d2b879c15b1d9b9ec93878da8b893f1834c70942663e1d2d106c2e0a661094fe2dd3bae7a6c2a1f9d5d8fab5e0b0ba493561090cf57b2228606fad1e66  chromaprint-1.5.1.tar.gz
 | 
				
			||||||
 | 
					a45ee894ce5c9227d79f77f644076b4cf7528bc74e9d4ce5382a5ef77d39922130bfce26805ca3101d2de182ecb4702918cebf55b4476ae7496f370ba23d94c4  ffmpeg5.patch
 | 
				
			||||||
"
 | 
					"
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										77
									
								
								community/chromaprint/ffmpeg5.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								community/chromaprint/ffmpeg5.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					Patch-Source: https://github.com/archlinux/svntogit-packages/blob/62e92f1f1c87d766797ffcfc140c3c9b3a0c0694/trunk/ffmpeg5.patch
 | 
				
			||||||
 | 
					From 6d938d70b1d52634f8b0d88cb29da87f8d5b35a2 Mon Sep 17 00:00:00 2001
 | 
				
			||||||
 | 
					From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
 | 
				
			||||||
 | 
					Date: Mon, 17 Jan 2022 04:41:33 +0100
 | 
				
			||||||
 | 
					Subject: [PATCH] Port to ffmpeg 5.0
 | 
				
			||||||
 | 
					MIME-Version: 1.0
 | 
				
			||||||
 | 
					Content-Type: text/plain; charset=UTF-8
 | 
				
			||||||
 | 
					Content-Transfer-Encoding: 8bit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Replace removed functionality like accessing the codec context
 | 
				
			||||||
 | 
					from an AVStream and avcodec_decode_audio4()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					 src/audio/ffmpeg_audio_reader.h | 24 ++++++++++++++++++++++--
 | 
				
			||||||
 | 
					 1 file changed, 22 insertions(+), 2 deletions(-)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/src/audio/ffmpeg_audio_reader.h b/src/audio/ffmpeg_audio_reader.h
 | 
				
			||||||
 | 
					index 5550164..a3b8de7 100644
 | 
				
			||||||
 | 
					--- a/src/audio/ffmpeg_audio_reader.h
 | 
				
			||||||
 | 
					+++ b/src/audio/ffmpeg_audio_reader.h
 | 
				
			||||||
 | 
					@@ -74,7 +74,7 @@ class FFmpegAudioReader {
 | 
				
			||||||
 | 
					 	uint8_t *m_convert_buffer[1] = { nullptr };
 | 
				
			||||||
 | 
					 	int m_convert_buffer_nb_samples = 0;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					-	AVInputFormat *m_input_fmt = nullptr;
 | 
				
			||||||
 | 
					+	const AVInputFormat *m_input_fmt = nullptr;
 | 
				
			||||||
 | 
					 	AVDictionary *m_input_opts = nullptr;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 	AVFormatContext *m_format_ctx = nullptr;
 | 
				
			||||||
 | 
					@@ -153,7 +153,7 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) {
 | 
				
			||||||
 | 
					 		return false;
 | 
				
			||||||
 | 
					 	}
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					-	AVCodec *codec;
 | 
				
			||||||
 | 
					+	const AVCodec *codec;
 | 
				
			||||||
 | 
					 	ret = av_find_best_stream(m_format_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0);
 | 
				
			||||||
 | 
					 	if (ret < 0) {
 | 
				
			||||||
 | 
					 		SetError("Could not find any audio stream in the file", ret);
 | 
				
			||||||
 | 
					@@ -161,7 +161,13 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) {
 | 
				
			||||||
 | 
					 	}
 | 
				
			||||||
 | 
					 	m_stream_index = ret;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+#if LIBAVCODEC_VERSION_MAJOR >= 59
 | 
				
			||||||
 | 
					+	const AVCodec *streamcodec = avcodec_find_decoder(m_format_ctx->streams[m_stream_index]->codecpar->codec_id);
 | 
				
			||||||
 | 
					+	m_codec_ctx = avcodec_alloc_context3(streamcodec);
 | 
				
			||||||
 | 
					+	avcodec_parameters_to_context(m_codec_ctx, m_format_ctx->streams[m_stream_index]->codecpar);
 | 
				
			||||||
 | 
					+#else
 | 
				
			||||||
 | 
					 	m_codec_ctx = m_format_ctx->streams[m_stream_index]->codec;
 | 
				
			||||||
 | 
					+#endif
 | 
				
			||||||
 | 
					 	m_codec_ctx->request_sample_fmt = AV_SAMPLE_FMT_S16;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 	ret = avcodec_open2(m_codec_ctx, codec, nullptr);
 | 
				
			||||||
 | 
					@@ -278,7 +284,23 @@ inline bool FFmpegAudioReader::Read(const int16_t **data, size_t *size) {
 | 
				
			||||||
 | 
					 			}
 | 
				
			||||||
 | 
					 		}
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+#if LIBAVCODEC_VERSION_MAJOR < 59
 | 
				
			||||||
 | 
					 		ret = avcodec_decode_audio4(m_codec_ctx, m_frame, &m_got_frame, &m_packet);
 | 
				
			||||||
 | 
					+#else
 | 
				
			||||||
 | 
					+		m_got_frame = 0;
 | 
				
			||||||
 | 
					+		ret = avcodec_send_packet(m_codec_ctx, &m_packet);
 | 
				
			||||||
 | 
					+		if(ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 | 
				
			||||||
 | 
					+			ret = 0;
 | 
				
			||||||
 | 
					+		if(ret >= 0) {
 | 
				
			||||||
 | 
					+			ret = avcodec_receive_frame(m_codec_ctx, m_frame);
 | 
				
			||||||
 | 
					+			if (ret == 0) {
 | 
				
			||||||
 | 
					+				m_got_frame = 1;
 | 
				
			||||||
 | 
					+				ret = m_packet.size;
 | 
				
			||||||
 | 
					+			}
 | 
				
			||||||
 | 
					+		}
 | 
				
			||||||
 | 
					+		if(ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 | 
				
			||||||
 | 
					+			ret = 0;
 | 
				
			||||||
 | 
					+#endif
 | 
				
			||||||
 | 
					 		if (ret < 0) {
 | 
				
			||||||
 | 
					 			if (m_decode_error) {
 | 
				
			||||||
 | 
					 				SetError("Error decoding audio frame", m_decode_error);
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user