summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/chromaprint')
-rw-r--r--media-libs/chromaprint/Manifest1
-rw-r--r--media-libs/chromaprint/chromaprint-1.4.3.ebuild50
-rw-r--r--media-libs/chromaprint/files/chromaprint-1.4.3-test-bigendian.patch60
3 files changed, 111 insertions, 0 deletions
diff --git a/media-libs/chromaprint/Manifest b/media-libs/chromaprint/Manifest
index 7cd57c19a745..2dda794d0e04 100644
--- a/media-libs/chromaprint/Manifest
+++ b/media-libs/chromaprint/Manifest
@@ -2,4 +2,5 @@ DIST chromaprint-1.2.tar.gz 529646 BLAKE2B a45b88edfe7e37bc09d960a385f8b7303705d
DIST chromaprint-1.3.2.tar.gz 538395 BLAKE2B b08d6ff106c3728d91352e694d39722390500480bb5049298150de198593116def213445d5cd96772d3956508df80b92ce3b440c14606aeff8eeca934aa402de SHA512 7f89eb09f293a3691efcb01544da612cf674a00af1c188db3f1075db44fee0a8e0aeff3ca6eccd0731ae6bbff9eb0fd51b22128fa927fdbd21638e2832f76e95
DIST chromaprint-1.4.1.tar.gz 611014 BLAKE2B 139a3d58392f442feab1d955b03accb5ec81df3cb3de43a9a1d53d7ce061cee94aaad4ce66a860326fa84f155eba39e50e34a7055522e0637cacee8c91e7f7e7 SHA512 9d414ba01be87f973df877afc600c761bf338292680d2626baa2a483f0bb681b506d02baa8f9de297489459ba1ebae9005202bfe7ba661b7bd4d60d4a2463ede
DIST chromaprint-1.4.2.tar.gz 613367 BLAKE2B ffec54c952a35f8f5bf6bc74b5d58339af3f0ffc0a0c0e88ee5e864e9112ad96cced629dcb8422f5e74aca3c48f93f7fa153cc6aabf0659a4e90416c34f34e43 SHA512 69449adf1c95c1395a5545d36877afe95b409d045357cc675e9ac58aee2955b3a9a245f37805192804a9b7fddc792b9e9289bf6448fa3393131048d28e06d7e2
+DIST chromaprint-1.4.3.tar.gz 613741 BLAKE2B 728f08e14c46a36d98c3a32a7c7a221a48b51561b623a403d9bee6aeea5cb5254866da26d50db0dbc5b0b4ceddb8312d52a8aab4c2979709bd2c8221b9e84d0f SHA512 101360bd643d2410fafcdd4aef8fe4c716ec728f0e4b9b3a62ba125fe010b0315e55a1839a2ca8c29d9abfbf8171560b23d68b732e75632ce8f4a4698f77ea72
DIST gtest-1.8.0.tar.gz 1281617 BLAKE2B ac052b4d0eb0d8ded03a8c7dff05177818627b8a51f2dbc2c162b2ee2a5d1323539e7d0d02236d9ebb799995e018f0171c2fdaeb4de3bb339548265e50de79e6 SHA512 1dbece324473e53a83a60601b02c92c089f5d314761351974e097b2cf4d24af4296f9eb8653b6b03b1e363d9c5f793897acae1f0c7ac40149216035c4d395d9d
diff --git a/media-libs/chromaprint/chromaprint-1.4.3.ebuild b/media-libs/chromaprint/chromaprint-1.4.3.ebuild
new file mode 100644
index 000000000000..c1ac357af584
--- /dev/null
+++ b/media-libs/chromaprint/chromaprint-1.4.3.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit cmake-multilib
+
+GTEST_VERSION="1.8.0"
+
+DESCRIPTION="A client-side library that implements a custom algorithm for extracting fingerprints"
+HOMEPAGE="http://acoustid.org/chromaprint"
+SRC_URI="https://github.com/acoustid/${PN}/releases/download/v${PV}/${P}.tar.gz
+ test? ( https://github.com/google/googletest/archive/release-${GTEST_VERSION}.tar.gz -> gtest-${GTEST_VERSION}.tar.gz )
+"
+
+LICENSE="LGPL-2.1"
+SLOT="0/1"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd"
+IUSE="libav test tools"
+
+# note: use ffmpeg or libav instead of fftw because it's recommended and required for tools
+RDEPEND="
+ libav? ( >=media-video/libav-11:0=[${MULTILIB_USEDEP}] )
+ !libav? ( >=media-video/ffmpeg-2.6:0=[${MULTILIB_USEDEP}] )
+"
+DEPEND="${RDEPEND}
+ test? (
+ dev-cpp/gtest[${MULTILIB_USEDEP}]
+ dev-libs/boost[${MULTILIB_USEDEP}]
+ )"
+
+PATCHES=( "${FILESDIR}"/chromaprint-1.4.3-test-bigendian.patch )
+
+DOCS="NEWS.txt README.md"
+
+S=${WORKDIR}/${PN}-v${PV}
+
+multilib_src_configure() {
+ export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VERSION}/googletest/"
+ local mycmakeargs=(
+ "-DBUILD_TOOLS=$(multilib_native_usex tools ON OFF)"
+ "-DBUILD_TESTS=$(usex test ON OFF)"
+ -DFFT_LIB=avfft
+ -DAUDIO_PROCESSOR_LIB=$(usex libav avresample swresample)
+ )
+ cmake-utils_src_configure
+}
+
+multilib_src_test() {
+ emake check
+}
diff --git a/media-libs/chromaprint/files/chromaprint-1.4.3-test-bigendian.patch b/media-libs/chromaprint/files/chromaprint-1.4.3-test-bigendian.patch
new file mode 100644
index 000000000000..dc080bb98470
--- /dev/null
+++ b/media-libs/chromaprint/files/chromaprint-1.4.3-test-bigendian.patch
@@ -0,0 +1,60 @@
+From 8d5f2ca81db8fae6b59b6b9b8bda91526507dbd1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= <lukas@oxygene.sk>
+Date: Sat, 10 Feb 2018 06:52:10 +0100
+Subject: [PATCH] Change LoadAudioFile to not depend on little-endian CPU
+
+Fixes https://github.com/acoustid/chromaprint/issues/46
+---
+ tests/test_utils.cpp | 9 +++++++++
+ tests/test_utils.h | 14 +++++++++-----
+ 2 files changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp
+index fc8bb86..536f46e 100644
+--- a/tests/test_utils.cpp
++++ b/tests/test_utils.cpp
+@@ -2,6 +2,7 @@
+ #include <algorithm>
+ #include <limits>
+ #include "utils.h"
++#include "test_utils.h"
+
+ using namespace chromaprint;
+
+@@ -92,3 +93,11 @@ TEST(Utils, CountSetBits64) {
+ EXPECT_EQ(64, CountSetBits(0xFFFFFFFFFFFFFFFFU));
+ EXPECT_EQ(8, CountSetBits(0x0101010101010101U));
+ }
++
++TEST(Utils, LoadAudioFile) {
++ std::vector<short> data = LoadAudioFile("data/test_mono_44100.raw");
++ ASSERT_EQ(data.size(), 176400/2);
++ EXPECT_EQ(data[1000], 0);
++ EXPECT_EQ(data[2000], 107);
++ EXPECT_EQ(data[3000], 128);
++}
+diff --git a/tests/test_utils.h b/tests/test_utils.h
+index 3631007..d01e9e3 100644
+--- a/tests/test_utils.h
++++ b/tests/test_utils.h
+@@ -31,11 +31,15 @@ inline std::vector<short> LoadAudioFile(const std::string &file_name)
+ {
+ std::string path = TESTS_DIR + file_name;
+ std::ifstream file(path.c_str(), std::ifstream::in | std::ifstream::binary);
+- file.seekg(0, std::ios::end);
+- int length = file.tellg();
+- file.seekg(0, std::ios::beg);
+- std::vector<short> data(length / 2);
+- file.read((char *)&data[0], length);
++ uint8_t buf[4096];
++ std::vector<int16_t> data;
++ while (!file.eof()) {
++ file.read((char *) buf, 4096);
++ size_t nread = file.gcount();
++ for (size_t i = 0; i < nread - 1; i += 2) {
++ data.push_back((int16_t) (((uint16_t) buf[i+1] << 8) | ((uint16_t) buf[i])));
++ }
++ }
+ file.close();
+ return data;
+ }