1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-01 05:45:45 +00:00

Update audio/chromaprint to 1.4.2

- Chromaprint itself is now licensed MIT, but it still includes LGPL21 code
- Add DOXYGEN option to build and install API docs
- Add TEST option to build regression tests
- API has changed, so some dependent ports needed to be patched (mostly
  taken from their respective upstream repositories)

Changes:	https://github.com/acoustid/chromaprint/blob/v1.4.2/NEWS.txt
This commit is contained in:
Jason E. Hale 2017-01-06 14:24:00 +00:00
parent 27bdaeabe6
commit 409995bd9e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=430708
10 changed files with 153 additions and 13 deletions

View File

@ -1,22 +1,45 @@
# $FreeBSD$
PORTNAME= chromaprint
PORTVERSION= 1.3.1
PORTREVISION= 1
PORTVERSION= 1.4.2
CATEGORIES= audio
MASTER_SITES= http://bitbucket.org/acoustid/${PORTNAME}/downloads/
MASTER_SITES= https://github.com/acoustid/${PORTNAME}/releases/download/v${PORTVERSION}/ \
https://bitbucket.org/acoustid/${PORTNAME}/downloads/
MAINTAINER= jhale@FreeBSD.org
COMMENT= AcoustID audio fingerprinting library
LICENSE= LGPL21
LICENSE= LGPL21 MIT
LICENSE_COMB= multi
LICENSE_FILE_MIT= ${WRKSRC}/LICENSE.md
LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg
USES= cmake:outsource pathfix
USES= cmake:outsource compiler:c++11-lib pathfix
USE_LDCONFIG= yes
CMAKE_ARGS= -DBUILD_EXAMPLES:BOOL=ON \
-DWITH_AVFFT:BOOL=ON \
CMAKE_ARGS= -DBUILD_TOOLS:BOOL=true \
-DFFT_LIB:STRING=avfft
OPTIONS_DEFINE= DOXYGEN TEST
DOXYGEN_BUILD_DEPENDS= doxygen:devel/doxygen \
dot:graphics/graphviz
DOXYGEN_PORTDOCS= *
# PORTDOCS macro won't work if NOPORTDOCS is defined or if DOCS is disabled
DOXYGEN_IMPLIES= DOCS
.undef NOPORTDOCS
TEST_BUILD_DEPENDS= ${NONEXISTENT}:devel/googletest:patch
TEST_CMAKE_BOOL= BUILD_TESTS
TEST_CMAKE_ON= -DGTEST_ROOT:PATH=`${MAKE} -C ${PORTSDIR}/devel/googletest -VWRKSRC`
TEST_TARGET= check
do-build-DOXYGEN-on:
@(cd ${BUILD_WRKSRC}; ${DO_MAKE_BUILD} docs)
do-install-DOXYGEN-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
(cd ${INSTALL_WRKSRC}/doc; ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})
.include <bsd.port.mk>

View File

@ -1,2 +1,3 @@
SHA256 (chromaprint-1.3.1.tar.gz) = 8f95a011e6fe3a75281520daa9376b7f028300e20a5be9af08ef9c851d4bb581
SIZE (chromaprint-1.3.1.tar.gz) = 538251
TIMESTAMP = 1483658531
SHA256 (chromaprint-1.4.2.tar.gz) = 989609a7e841dd75b34ee793bd1d049ce99a8f0d444b3cea39d57c3e5d26b4d4
SIZE (chromaprint-1.4.2.tar.gz) = 613367

View File

@ -0,0 +1,14 @@
--- tests/CMakeLists.txt.orig 2016-12-23 11:50:27 UTC
+++ tests/CMakeLists.txt
@@ -36,6 +36,11 @@ set(SRCS
if(BUILD_TOOLS)
set(SRCS ${SRCS} ../src/audio/ffmpeg_audio_reader_test.cpp)
link_libraries(fpcalc_libs)
+ include_directories(
+ ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
+ ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
+ ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
+ )
endif()
add_executable(all_tests ${SRCS} $<TARGET_OBJECTS:chromaprint_objs>)

View File

@ -2,5 +2,5 @@ bin/fpcalc
include/chromaprint.h
lib/libchromaprint.so
lib/libchromaprint.so.1
lib/libchromaprint.so.1.3.0
lib/libchromaprint.so.1.4.2
libdata/pkgconfig/libchromaprint.pc

View File

@ -3,7 +3,7 @@
PORTNAME= clementine
PORTVERSION= 1.3.1
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= audio
PKGNAMESUFFIX= -player

View File

@ -0,0 +1,34 @@
Add compatibility with chromaprint >= 1.4
diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp
index 9579b62..c7ad99e 100644
--- src/musicbrainz/chromaprinter.cpp.orig
+++ src/musicbrainz/chromaprinter.cpp
@@ -143,16 +143,24 @@ QString Chromaprinter::CreateFingerprint() {
ChromaprintContext* chromaprint =
chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT);
chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels);
- chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()),
+ chromaprint_feed(chromaprint, reinterpret_cast<int16_t *>(data.data()),
data.size() / 2);
chromaprint_finish(chromaprint);
- void* fprint = nullptr;
int size = 0;
+
+#if CHROMAPRINT_VERSION_MAJOR >= 1 && CHROMAPRINT_VERSION_MINOR >= 4
+ u_int32_t *fprint = nullptr;
+ char *encoded = nullptr;
+#else
+ void *fprint = nullptr;
+ void *encoded = nullptr;
+#endif
+
int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size);
+
QByteArray fingerprint;
if (ret == 1) {
- void* encoded = nullptr;
int encoded_size = 0;
chromaprint_encode_fingerprint(fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT,
&encoded, &encoded_size, 1);

View File

@ -3,7 +3,7 @@
PORTNAME= libgroove
PORTVERSION= 4.3.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= audio
MAINTAINER= ports@FreeBSD.org

View File

@ -0,0 +1,52 @@
Cast to correct types for chromaprint >= 1.4
--- groovefingerprinter/fingerprinter.c.orig 2015-05-26 01:32:01 UTC
+++ groovefingerprinter/fingerprinter.c
@@ -64,7 +64,11 @@ static int emit_track_info(struct Groove
return -1;
}
if (!chromaprint_get_raw_fingerprint(p->chroma_ctx,
+#if CHROMAPRINT_VERSION_MAJOR > 1 || CHROMAPRINT_VERSION_MINOR >= 4
+ (uint32_t**)&info->fingerprint, &info->fingerprint_size))
+#else
(void**)&info->fingerprint, &info->fingerprint_size))
+#endif
{
av_log(NULL, AV_LOG_ERROR, "unable to get fingerprint\n");
return -1;
@@ -141,7 +145,11 @@ static void *print_thread(void *arg) {
double buffer_duration = buffer->frame_count / (double)buffer->format.sample_rate;
p->track_duration += buffer_duration;
p->album_duration += buffer_duration;
+#if CHROMAPRINT_VERSION_MAJOR > 1 || CHROMAPRINT_VERSION_MINOR >= 4
+ if (!chromaprint_feed(p->chroma_ctx, (const int16_t*)buffer->data[0], buffer->frame_count * 2)) {
+#else
if (!chromaprint_feed(p->chroma_ctx, buffer->data[0], buffer->frame_count * 2)) {
+#endif
av_log(NULL, AV_LOG_ERROR, "unable to feed fingerprint\n");
}
@@ -387,7 +395,11 @@ void groove_fingerprinter_free_info(stru
int groove_fingerprinter_encode(int32_t *fp, int size, char **encoded_fp) {
int encoded_size;
+#if CHROMAPRINT_VERSION_MAJOR > 1 || CHROMAPRINT_VERSION_MINOR >= 4
+ int err = chromaprint_encode_fingerprint((const uint32_t*)fp, size,
+#else
int err = chromaprint_encode_fingerprint(fp, size,
+#endif
CHROMAPRINT_ALGORITHM_DEFAULT, (void*)encoded_fp, &encoded_size, 1);
return err == 1 ? 0 : -1;
}
@@ -395,7 +407,11 @@ int groove_fingerprinter_encode(int32_t
int groove_fingerprinter_decode(char *encoded_fp, int32_t **fp, int *size) {
int algorithm;
int encoded_size = strlen(encoded_fp);
+#if CHROMAPRINT_VERSION_MAJOR > 1 || CHROMAPRINT_VERSION_MINOR >= 4
+ int err = chromaprint_decode_fingerprint(encoded_fp, encoded_size, (uint32_t**)fp, size,
+#else
int err = chromaprint_decode_fingerprint(encoded_fp, encoded_size, (void**)fp, size,
+#endif
&algorithm, 1);
return err == 1 ? 0 : -1;
}

View File

@ -3,7 +3,7 @@
PORTNAME= leechcraft
PORTVERSION= 0.6.70
PORTREVISION= 16
PORTREVISION= 17
CATEGORIES= x11
MASTER_SITES= http://dist.leechcraft.org/LeechCraft/0.6.70/

View File

@ -1,6 +1,7 @@
https://github.com/0xd34df00d/leechcraft/commit/307be1dd37059e49eca37f77ddc4806125a8f843
https://github.com/0xd34df00d/leechcraft/commit/53d56cafd3a1d299601d9f3bfd4ee051ae9121ba
https://github.com/0xd34df00d/leechcraft/commit/875e3b43b7a91656f61180b2b2179137f18e6d71
https://github.com/0xd34df00d/leechcraft/commit/14f5f8823ec7b23fdb4409f4f689e565d8995536
--- plugins/musiczombie/chroma.cpp.orig 2014-07-28 18:35:44 UTC
+++ plugins/musiczombie/chroma.cpp
@ -32,3 +33,18 @@ https://github.com/0xd34df00d/leechcraft/commit/875e3b43b7a91656f61180b2b2179137
int gotFrame = false;
auto consumed = avcodec_decode_audio4 (codecCtx.get (), frame.get (), &gotFrame, &packet);
@@ -168,7 +167,13 @@ namespace MusicZombie
data = frame->data;
auto length = std::min (remaining, frame->nb_samples * codecCtx->channels);
- if (!chromaprint_feed (Ctx_, data [0], length))
+ if (!chromaprint_feed (Ctx_,
+#if CHROMAPRINT_VERSION_MAJOR > 1 || CHROMAPRINT_VERSION_MINOR >= 4
+ reinterpret_cast<const int16_t*> (data [0]),
+#else
+ data [0],
+#endif
+ length))
throw std::runtime_error ("cannot feed data");
bool finished = false;