Hello community, here is the log from the commit of package chromaprint for openSUSE:Factory checked in at 2020-08-14 09:30:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/chromaprint (Old) and /work/SRC/openSUSE:Factory/.chromaprint.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "chromaprint" Fri Aug 14 09:30:13 2020 rev:18 rq:825420 version:1.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/chromaprint/chromaprint.changes 2018-01-26 13:55:56.319235247 +0100 +++ /work/SRC/openSUSE:Factory/.chromaprint.new.3399/chromaprint.changes 2020-08-14 09:30:16.724304617 +0200 @@ -1,0 +2,18 @@ +Mon Jul 27 20:37:40 UTC 2020 - Matthias Eliasson <[email protected]> + +- Update to 1.5.0: + * Added support for fpcalc -raw -signed, which helps with easier PostgreSQL + integration + * Added support for using libavresample instead of libswresample + * Fixed possible crash in chromaprint_decode_fingerprint + * Fixed unit tests on big endian CPUs +- Run spec-cleaner + * Remove package groups + * Use license macro + +------------------------------------------------------------------- +Fri Mar 8 19:07:45 UTC 2019 - [email protected] + +- Remove bcond_without and use ffmpeg unconditional + +------------------------------------------------------------------- Old: ---- chromaprint-1.4.3.tar.gz New: ---- chromaprint-1.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ chromaprint.spec ++++++ --- /var/tmp/diff_new_pack.Szk310/_old 2020-08-14 09:30:17.724305130 +0200 +++ /var/tmp/diff_new_pack.Szk310/_new 2020-08-14 09:30:17.728305132 +0200 @@ -1,7 +1,7 @@ # # spec file for package chromaprint # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # Copyright (c) 2012 Pascal Bleser <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -13,19 +13,17 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define soname 1 -%bcond_without ffmpeg Name: chromaprint -Version: 1.4.3 +Version: 1.5.0 Release: 0 Summary: Audio Fingerprinting Library -License: MIT AND LGPL-2.1 -Group: Development/Libraries/C and C++ -Url: https://acoustid.org/chromaprint +License: MIT AND LGPL-2.1-only +URL: https://acoustid.org/chromaprint Source0: https://github.com/acoustid/chromaprint/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: baselibs.conf BuildRequires: cmake @@ -33,13 +31,11 @@ BuildRequires: gcc-c++ BuildRequires: libtag-devel BuildRequires: pkgconfig -%if %{with ffmpeg} BuildRequires: pkgconfig(libavcodec) BuildRequires: pkgconfig(libavformat) BuildRequires: pkgconfig(libavresample) BuildRequires: pkgconfig(libavutil) BuildRequires: pkgconfig(libswresample) -%endif %description Chromaprint is the core component of the Acoustid project. It's a client-side @@ -48,8 +44,7 @@ %package -n libchromaprint%{soname} Summary: Audio Fingerprinting Library -License: LGPL-2.1+ -Group: System/Libraries +License: LGPL-2.1-or-later %description -n libchromaprint%{soname} Chromaprint is the core component of the Acoustid project. It's a client-side @@ -58,8 +53,7 @@ %package -n libchromaprint-devel Summary: Audio Fingerprinting Library -License: LGPL-2.1+ -Group: Development/Libraries/C and C++ +License: LGPL-2.1-or-later Requires: fftw3-devel Requires: libchromaprint%{soname} = %{version} Requires: libtag-devel @@ -69,11 +63,9 @@ library that implements a custom algorithm for extracting fingerprints from any audio source. -%if %{with ffmpeg} %package fpcalc Summary: Chromaprint Audio Fingerprinting Command Line Tool -License: GPL-2.0+ -Group: Productivity/Multimedia/Sound/Utilities +License: GPL-2.0-or-later Requires: libchromaprint%{soname} = %{version} Provides: fpcalc = %{version} @@ -83,21 +75,18 @@ audio source. This package contains fpcalc, a command-line tool to perform Chromaprint fingerprinting. -%endif %prep -%setup -qn %{name}-v%{version} +%setup -q -n %{name}-v%{version} %build %cmake \ -DCMAKE_SKIP_RPATH=TRUE \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE \ -%if %{with ffmpeg} -DUSE_AVFFT=ON \ -DBUILD_TOOLS=ON -%endif -make %{?_smp_mflags} +%make_build %install %cmake_install @@ -106,7 +95,8 @@ %postun -n libchromaprint%{soname} -p /sbin/ldconfig %files -n libchromaprint%{soname} -%doc LICENSE.md NEWS.txt README.md +%license LICENSE.md +%doc NEWS.txt README.md %{_libdir}/libchromaprint.so.%{soname} %{_libdir}/libchromaprint.so.%{soname}.* @@ -115,9 +105,7 @@ %{_libdir}/libchromaprint.so %{_libdir}/pkgconfig/libchromaprint.pc -%if %{with ffmpeg} %files fpcalc %{_bindir}/fpcalc -%endif %changelog ++++++ chromaprint-1.4.3.tar.gz -> chromaprint-1.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/.editorconfig new/chromaprint-v1.5.0/.editorconfig --- old/chromaprint-v1.4.3/.editorconfig 1970-01-01 01:00:00.000000000 +0100 +++ new/chromaprint-v1.5.0/.editorconfig 2020-04-15 06:08:10.000000000 +0200 @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.{c,h,cpp,hpp}] +indent_style = space +indent_size = 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/.editorconfig.vim new/chromaprint-v1.5.0/.editorconfig.vim --- old/chromaprint-v1.4.3/.editorconfig.vim 1970-01-01 01:00:00.000000000 +0100 +++ new/chromaprint-v1.5.0/.editorconfig.vim 2020-04-15 06:08:10.000000000 +0200 @@ -0,0 +1,6 @@ +" autocmd BufNewFile,BufRead /path/to/chromaprint/* source /path/to/chromaprint/.editorconfig.vim + +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal softtabstop=4 +setlocal noexpandtab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/.github/FUNDING.yml new/chromaprint-v1.5.0/.github/FUNDING.yml --- old/chromaprint-v1.4.3/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/chromaprint-v1.5.0/.github/FUNDING.yml 2020-04-15 06:08:10.000000000 +0200 @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: acoustid +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: https://acoustid.org/donate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/.github/workflows/build.yml new/chromaprint-v1.5.0/.github/workflows/build.yml --- old/chromaprint-v1.4.3/.github/workflows/build.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/chromaprint-v1.5.0/.github/workflows/build.yml 2020-04-15 06:08:10.000000000 +0200 @@ -0,0 +1,179 @@ +name: Test and package + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + fft: + - avfft + - fftw3 + - fftw3f + - kissfft + env: + FFT_LIB: ${{ matrix.fft }} + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install yasm cmake libavcodec-dev libavformat-dev libavutil-dev \ + libavresample-dev libfftw3-dev libgtest-dev + - name: Test with ${{ env.FFT_LIB }} + run: | + mkdir build.test.$FFT_LIB + cd build.test.$FFT_LIB + cmake -DCMAKE_BUILD_TYPE=Release -DFFT_LIB=$FFT_LIB -DBUILD_TESTS=ON -DBUILD_TOOLS=ON .. + make VERBOSE=1 + make check VERBOSE=1 + + test-macos: + runs-on: macos-latest + env: + FFT_LIB: vdsp + steps: + - uses: actions/checkout@v1 + - name: Download googletest sources + run: | + git clone https://github.com/google/googletest.git "$GITHUB_WORKSPACE/googletest" + echo "::set-env name=GTEST_ROOT::$GITHUB_WORKSPACE/googletest/googletest" + - name: Test with ${{ env.FFT_LIB }} + run: | + mkdir build.test.$FFT_LIB + cd build.test.$FFT_LIB + cmake -DCMAKE_BUILD_TYPE=Release -DFFT_LIB=$FFT_LIB -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS='-stdlib=libc++' .. + make VERBOSE=1 + make check VERBOSE=1 + + package: + runs-on: ubuntu-latest + strategy: + matrix: + os: + - linux + - windows + arch: + - x86_64 + - i686 + - armv7-a + - armv8-a + exclude: + - os: windows + arch: armv7-a + - os: windows + arch: armv8-a + env: + ARCH: ${{ matrix.arch }} + OS: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Install multilib dependencies + if: matrix.arch == 'i686' + run: sudo apt-get install gcc-multilib g++-multilib + - name: Install Windows cross-compile dependencies + if: matrix.os == 'windows' + run: sudo apt-get install mingw-w64 + - name: Install armhf cross-compile dependencies + if: startsWith(matrix.arch, 'arm') + run: sudo apt-get install gcc-multilib-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabihf + - name: Set TAG variable + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "::set-env name=TAG::${GITHUB_REF##*/}" + - name: Package ${{ env.ARCH }} ${{ env.OS }} + run: | + export BRANCH=${GITHUB_REF##*/} + ./package/build.sh + - name: Archive artifacts + uses: actions/upload-artifact@v1 + with: + name: chromaprint-fpcalc-${{ env.OS }}-${{ env.ARCH }} + path: chromaprint-${{ env.OS }}-${{ env.ARCH }}/bin/ + + package-macos: + runs-on: macos-latest + env: + ARCH: x86_64 + OS: macos + steps: + - uses: actions/checkout@v1 + - name: Set TAG variable + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "::set-env name=TAG::${GITHUB_REF##*/}" + - name: Package ${{ env.ARCH }} ${{ env.OS }} + run: | + export BRANCH=${GITHUB_REF##*/} + ./package/build.sh + - name: Archive artifacts + uses: actions/upload-artifact@v1 + with: + name: chromaprint-fpcalc-${{ env.OS }}-${{ env.ARCH }} + path: chromaprint-${{ env.OS }}-${{ env.ARCH }}/bin/ + + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + needs: + - package + - package-macos + steps: + - uses: actions/checkout@v1 + - name: Set version + run: | + TAG=${GITHUB_REF##*/} + echo "::set-env name=TAG::$TAG" + echo "::set-env name=VERSION::$(echo $TAG | sed 's/^v//')" + - uses: actions/download-artifact@v1 + with: + name: chromaprint-fpcalc-linux-x86_64 + path: artifacts/chromaprint-fpcalc-${{ env.VERSION }}-linux-x86_64/ + - uses: actions/download-artifact@v1 + with: + name: chromaprint-fpcalc-linux-i686 + path: artifacts/chromaprint-fpcalc-${{ env.VERSION }}-linux-i686/ + - uses: actions/download-artifact@v1 + with: + name: chromaprint-fpcalc-windows-x86_64 + path: artifacts/chromaprint-fpcalc-${{ env.VERSION }}-windows-x86_64/ + - uses: actions/download-artifact@v1 + with: + name: chromaprint-fpcalc-windows-i686 + path: artifacts/chromaprint-fpcalc-${{ env.VERSION }}-windows-i686/ + - uses: actions/download-artifact@v1 + with: + name: chromaprint-fpcalc-macos-x86_64 + path: artifacts/chromaprint-fpcalc-${{ env.VERSION }}-macos-x86_64/ + - name: Make source tarball + run: | + mkdir artifacts/release/ + git archive --format=tar.gz --prefix=chromaprint-$TAG/ $TAG > artifacts/release/chromaprint-$VERSION.tar.gz + - name: Make tarballs + run: | + cd artifacts/ + dirs=$(find . -name 'chromaprint-fpcalc-*-macos-*' -o -name 'chromaprint-fpcalc-*-linux-*' -type d) + for dir in $dirs + do + name=$(basename $dir) + chmod +x $dir/fpcalc + tar cvzf release/$name.tar.gz $dir + done + - name: Make zips + run: | + cd artifacts/ + dirs=$(find . -name 'chromaprint-fpcalc-*-windows-*' -type d) + for dir in $dirs + do + name=$(basename $dir) + zip release/$name.zip $dir/* + done + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: artifacts/release/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/.gitlab-ci.yml new/chromaprint-v1.5.0/.gitlab-ci.yml --- old/chromaprint-v1.4.3/.gitlab-ci.yml 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/.gitlab-ci.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,83 +0,0 @@ -image: docker.oxygene.sk/acoustid/chromaprint-build - -stages: - - test - - package - -.test: &test - stage: test - script: - - JOB_NAME=($CI_BUILD_NAME) - - mkdir build.test.${JOB_NAME[1]} - - cd build.test.${JOB_NAME[1]} - - cmake -DCMAKE_BUILD_TYPE=Release -DFFT_LIB=${JOB_NAME[1]} -DBUILD_TESTS=ON $EXTRA_CMAKE_ARGS .. - - make VERBOSE=1 - - make check VERBOSE=1 - -test avfft: - <<: *test - variables: - EXTRA_CMAKE_ARGS: -DBUILD_TOOLS=ON - -test fftw3: - <<: *test - variables: - EXTRA_CMAKE_ARGS: -DBUILD_TOOLS=ON - -test fftw3f: - <<: *test - variables: - EXTRA_CMAKE_ARGS: -DBUILD_TOOLS=ON - -test kissfft: - <<: *test - variables: - EXTRA_CMAKE_ARGS: -DBUILD_TOOLS=ON - -test vdsp: - <<: *test - variables: - EXTRA_CMAKE_ARGS: -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DGTEST_ROOT=/usr/local/src/googletest/googletest/ - tags: - - osx - -.package: &package - stage: package - script: - - JOB_NAME=($CI_BUILD_NAME) - - export OS=${JOB_NAME[1]} - - export ARCH=${JOB_NAME[2]} - - export TAG=$CI_BUILD_TAG - - export BRANCH=$CI_BUILD_REF_NAME - - ./package/build.sh - artifacts: - paths: - - chromaprint-*.zip - - chromaprint-*.tar.gz - expire_in: 7d - -.package-macos: &package-macos - <<: *package - tags: - - osx - -.package-linux-armhf: &package-linux-armhf - <<: *package - tags: - - linux - - armhf - -package linux i686: *package -package linux x86_64: *package -package linux armhf: *package-linux-armhf -package windows i686: *package -package windows x86_64: *package -package macos x86_64: *package-macos - -package src: - <<: *package - script: - - VERSION=$(echo $CI_BUILD_TAG | sed 's/^v//') - - git archive --format=tar.gz --prefix=chromaprint-$CI_BUILD_TAG/ $CI_BUILD_TAG >chromaprint-$VERSION.tar.gz - only: - - tags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/CMakeLists.txt new/chromaprint-v1.5.0/CMakeLists.txt --- old/chromaprint-v1.4.3/CMakeLists.txt 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/CMakeLists.txt 2020-04-15 06:08:10.000000000 +0200 @@ -1,21 +1,11 @@ -cmake_minimum_required(VERSION 2.8.12) - -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif() - -if(POLICY CMP0048) - cmake_policy(SET CMP0048 OLD) -endif() - -project(chromaprint C CXX) +cmake_minimum_required(VERSION 3.3) set(chromaprint_VERSION_MAJOR 1) -set(chromaprint_VERSION_MINOR 4) -set(chromaprint_VERSION_PATCH 3) +set(chromaprint_VERSION_MINOR 5) +set(chromaprint_VERSION_PATCH 0) set(chromaprint_VERSION "${chromaprint_VERSION_MAJOR}.${chromaprint_VERSION_MINOR}.${chromaprint_VERSION_PATCH}") -set(PROJECT_VERSION "${chromaprint_VERSION}") +project(chromaprint LANGUAGES C CXX VERSION "${chromaprint_VERSION}") set(chromaprint_SOVERSION 1) @@ -31,14 +21,14 @@ find_package(Threads) -check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif() +option(BUILD_SHARED_LIBS "Build shared libraries" ON) -if(CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") +set(CMAKE_CXX_STANDARD 11) + +if(BUILD_SHARED_LIBS) + set(CMAKE_C_VISIBILITY_PRESET hidden) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) endif() if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -70,7 +60,6 @@ set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to") endif() -option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(BUILD_TOOLS "Build command line tools" OFF) option(BUILD_TESTS "Build test suite" OFF) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/NEWS.txt new/chromaprint-v1.5.0/NEWS.txt --- old/chromaprint-v1.4.3/NEWS.txt 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/NEWS.txt 2020-04-15 06:08:10.000000000 +0200 @@ -1,4 +1,12 @@ -Version 1.4.3 -- January 21, 2017 +Version 1.5.0 -- April 15, 2020 +=============================== + + - Added support for fpcalc -raw -signed, which helps with easier PostgreSQL integration + - Added support for using libavresample instead of libswresample + - Fixed possible crash in chromaprint_decode_fingerprint + - Fixed unit tests on big endian CPUs + +Version 1.4.3 -- January 21, 2018 ================================== - Allow one packet to have decoding error diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/README.md new/chromaprint-v1.5.0/README.md --- old/chromaprint-v1.4.3/README.md 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/README.md 2020-04-15 06:08:10.000000000 +0200 @@ -1,7 +1,5 @@ # Chromaprint -[](https://code.oxygene.sk/acoustid/chromaprint/commits/master) - Chromaprint is an audio fingerprint library developed for the [AcoustID][acoustid] project. It's designed to identify near-identical audio and the fingerprints it generates are as compact as possible to achieve that. It's not a general purpose audio fingerprinting solution. It trades precision and robustness for search performance. The target use cases are full audio file identifcation, @@ -91,7 +89,9 @@ * [C#](https://github.com/wo80/AcoustID.NET) (reimplementation) * [C#](https://github.com/protyposis/Aurio/tree/master/Aurio/Aurio/Matching/Chromaprint) (reimplementation) * [Pascal](https://github.com/CMCHTPC/ChromaPrint) (reimplementation) + * [Scala/JVM](https://github.com/mgdigital/Chromaprint.scala) (reimplementation) * [C++/CLI](https://github.com/CyberSinh/Luminescence.Audio) + * [Vala](https://github.com/GNOME/vala-extra-vapis/blob/master/libchromaprint.vapi) Integrations: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/cmake/modules/FindFFmpeg.cmake new/chromaprint-v1.5.0/cmake/modules/FindFFmpeg.cmake --- old/chromaprint-v1.4.3/cmake/modules/FindFFmpeg.cmake 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/cmake/modules/FindFFmpeg.cmake 2020-04-15 06:08:10.000000000 +0200 @@ -18,7 +18,7 @@ #and search the path which contain the libname/header.h (usefull for new version) #Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code) -# (in new version case, use by ffmpeg header) +# (in new version case, use by ffmpeg header) #and ${FFMPEG_libname_INCLUDE_DIRS/libname} (in new version case, use by osg plugin code) # Macro to find header and lib directories @@ -124,6 +124,6 @@ ELSE () -# MESSAGE(STATUS "Could not find FFMPEG") + MESSAGE(STATUS "Could not find FFMPEG") ENDIF() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/package/build-in-docker.sh new/chromaprint-v1.5.0/package/build-in-docker.sh --- old/chromaprint-v1.4.3/package/build-in-docker.sh 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/package/build-in-docker.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -BASE_DIR=$(cd $(dirname $0)/.. && pwd) - -exec docker run --rm=true -v $BASE_DIR:/builds/chromaprint -e OS=$OS -e ARCH=$ARCH \ - docker.oxygene.sk/acoustid/chromaprint-build \ - /builds/chromaprint/package/build.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/package/build.sh new/chromaprint-v1.5.0/package/build.sh --- old/chromaprint-v1.4.3/package/build.sh 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/package/build.sh 2020-04-15 06:08:10.000000000 +0200 @@ -14,8 +14,7 @@ cd $TMP_BUILD_DIR -curl -s -L "https://code.oxygene.sk/acoustid/ffmpeg-build/builds/artifacts/master/download?job=$OS+$ARCH" > artifacts.zip -unzip artifacts.zip +curl -s -L "https://github.com/acoustid/ffmpeg-build/releases/download/v4.2.2-3/ffmpeg-4.2.2-audio-$OS-$ARCH.tar.gz" | tar xz export FFMPEG_DIR=$TMP_BUILD_DIR/$(ls -d ffmpeg-* | tail) CMAKE_ARGS=( @@ -35,6 +34,9 @@ -DCMAKE_TOOLCHAIN_FILE=$TMP_BUILD_DIR/toolchain.cmake -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++' -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++' + -DHAVE_AV_PACKET_UNREF=1 + -DHAVE_AV_FRAME_ALLOC=1 + -DHAVE_AV_FRAME_FREE=1 ) STRIP=$ARCH-w64-mingw32-strip ;; @@ -51,12 +53,21 @@ -DCMAKE_CXX_FLAGS='-m32 -static -static-libgcc -static-libstdc++' ) ;; - x86_64|armhf) + x86_64) CMAKE_ARGS+=( -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++' -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++' ) ;; + arm*) + perl -pe "s!{EXTRA_PATHS}!$FFMPEG_DIR!g" $BASE_DIR/package/toolchain-armhf.cmake.in | perl -pe "s!{ARCH}!$ARCH!g" >toolchain.cmake + CMAKE_ARGS+=( + -DCMAKE_TOOLCHAIN_FILE=$TMP_BUILD_DIR/toolchain.cmake + -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++' + -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++' + ) + STRIP=arm-linux-gnueabihf-strip + ;; *) echo "unsupported architecture ($ARCH)" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/package/toolchain-armhf.cmake.in new/chromaprint-v1.5.0/package/toolchain-armhf.cmake.in --- old/chromaprint-v1.4.3/package/toolchain-armhf.cmake.in 1970-01-01 01:00:00.000000000 +0100 +++ new/chromaprint-v1.5.0/package/toolchain-armhf.cmake.in 2020-04-15 06:08:10.000000000 +0200 @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR {ARCH}) +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf {EXTRA_PATHS}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_processor_avresample.h new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_processor_avresample.h --- old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_processor_avresample.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_processor_avresample.h 2020-04-15 06:08:10.000000000 +0200 @@ -51,8 +51,8 @@ av_opt_set_int(m_resample_ctx, "out_sample_fmt", sample_rate, 0); } - bool Init() { - return avresample_open(m_resample_ctx) >= 0; + int Init() { + return avresample_open(m_resample_ctx); } int Convert(uint8_t **out, int out_count, const uint8_t **in, int in_count) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_processor_swresample.h new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_processor_swresample.h --- old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_processor_swresample.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_processor_swresample.h 2020-04-15 06:08:10.000000000 +0200 @@ -54,8 +54,8 @@ av_opt_set_int(m_swr_ctx, "osr", sample_rate, 0); } - bool Init() { - return swr_init(m_swr_ctx) >= 0; + int Init() { + return swr_init(m_swr_ctx); } int Convert(uint8_t **out, int out_count, const uint8_t **in, int in_count) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_reader.h new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_reader.h --- old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_reader.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_reader.h 2020-04-15 06:08:10.000000000 +0200 @@ -213,8 +213,9 @@ m_converter->SetOutputSampleFormat(AV_SAMPLE_FMT_S16); m_converter->SetOutputSampleRate(m_output_sample_rate); m_converter->SetOutputChannelLayout(av_get_default_channel_layout(m_output_channels)); - if (!m_converter->Init()) { - SetError("Could not create an audio converter instance"); + auto ret = m_converter->Init(); + if (ret != 0) { + SetError("Could not create an audio converter instance", ret); return false; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_reader_test.cpp new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_reader_test.cpp --- old/chromaprint-v1.4.3/src/audio/ffmpeg_audio_reader_test.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/audio/ffmpeg_audio_reader_test.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -12,7 +12,7 @@ ASSERT_TRUE(reader.SetInputChannels(2)); ASSERT_TRUE(reader.SetInputSampleRate(44100)); - ASSERT_TRUE(reader.Open(TESTS_DIR "/data/test_stereo_44100.raw")); + ASSERT_TRUE(reader.Open(TESTS_DIR "/data/test_stereo_44100.raw")) << reader.GetError(); ASSERT_TRUE(reader.IsOpen()); ASSERT_EQ(2, reader.GetChannels()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/chromaprint.cpp new/chromaprint-v1.5.0/src/chromaprint.cpp --- old/chromaprint-v1.4.3/src/chromaprint.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/chromaprint.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -183,9 +183,22 @@ if (base64) { encoded = Base64Decode(encoded); } - std::vector<uint32_t> uncompressed = DecompressFingerprint(encoded, algorithm); + std::vector<uint32_t> uncompressed; + int algo; + auto ok = DecompressFingerprint(encoded, uncompressed, algo); + if (!ok) { + *fp = nullptr; + *size = 0; + if (algorithm) { + *algorithm = 0; + } + return 0; + } *fp = (uint32_t *) malloc(sizeof(uint32_t) * uncompressed.size()); *size = uncompressed.size(); + if (algorithm) { + *algorithm = algo; + } std::copy(uncompressed.begin(), uncompressed.end(), *fp); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/chromaprint.h new/chromaprint-v1.5.0/src/chromaprint.h --- old/chromaprint-v1.4.3/src/chromaprint.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/chromaprint.h 2020-04-15 06:08:10.000000000 +0200 @@ -83,8 +83,8 @@ typedef struct ChromaprintMatcherContextPrivate ChromaprintMatcherContext; #define CHROMAPRINT_VERSION_MAJOR 1 -#define CHROMAPRINT_VERSION_MINOR 4 -#define CHROMAPRINT_VERSION_PATCH 3 +#define CHROMAPRINT_VERSION_MINOR 5 +#define CHROMAPRINT_VERSION_PATCH 0 enum ChromaprintAlgorithm { CHROMAPRINT_ALGORITHM_TEST1 = 0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/cmd/CMakeLists.txt new/chromaprint-v1.5.0/src/cmd/CMakeLists.txt --- old/chromaprint-v1.4.3/src/cmd/CMakeLists.txt 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/cmd/CMakeLists.txt 2020-04-15 06:08:10.000000000 +0200 @@ -19,11 +19,15 @@ set(fpcalc_LINK_FLAGS) if(APPLE) - set(fpcalc_LIBS ${fpcalc_LIBS} -lz) + set(fpcalc_LIBS ${fpcalc_LIBS} -lz) set(fpcalc_LINK_FLAGS "${fpcalc_LINK_FLAGS} -sectcreate __TEXT __info_plist ${CMAKE_CURRENT_BINARY_DIR}/fpcalc.Info.plist") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fpcalc.Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/fpcalc.Info.plist) endif() +if(WIN32) + set(fpcalc_LIBS ${fpcalc_LIBS} bcrypt) +endif() + add_library(fpcalc_libs INTERFACE) target_link_libraries(fpcalc_libs INTERFACE ${fpcalc_LIBS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/cmd/fpcalc.cpp new/chromaprint-v1.5.0/src/cmd/fpcalc.cpp --- old/chromaprint-v1.4.3/src/cmd/fpcalc.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/cmd/fpcalc.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -27,6 +27,7 @@ static double g_max_chunk_duration = 0; static bool g_overlap = false; static bool g_raw = false; +static bool g_signed = false; static bool g_abs_ts = false; static bool g_ignore_errors = false; static ChromaprintAlgorithm g_algorithm = CHROMAPRINT_ALGORITHM_DEFAULT; @@ -47,6 +48,7 @@ " -overlap Overlap the chunks slightly to make sure audio on the edges is fingerprinted\n" " -ts Output UNIX timestamps for chunked results, useful when fingerprinting real-time audio stream\n" " -raw Output fingerprints in the uncompressed format\n" + " -signed Change the uncompressed format from unsigned integers to signed (for pg_acoustid compatibility)\n" " -json Print the output in JSON format\n" " -text Print the output in text format\n" " -plain Print the just the fingerprint in text format\n" @@ -119,10 +121,17 @@ g_abs_ts = true; } else if (!strcmp(argv[i], "-raw")) { g_raw = true; + } else if (!strcmp(argv[i], "-signed")) { + g_signed = true; } else if (!strcmp(argv[i], "-ignore-errors")) { g_ignore_errors = true; } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version")) { - fprintf(stdout, "fpcalc version %s\n", chromaprint_get_version()); +#if defined(USE_SWRESAMPLE) +#define RESAMPLE_LIB_IDENT_IDENT LIBSWRESAMPLE_IDENT +#else +#define RESAMPLE_LIB_IDENT_IDENT LIBAVRESAMPLE_IDENT +#endif + fprintf(stdout, "fpcalc version %s (FFmpeg %s %s %s)\n", chromaprint_get_version(), LIBAVCODEC_IDENT, LIBAVFORMAT_IDENT, RESAMPLE_LIB_IDENT_IDENT); exit(0); } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) { fprintf(stdout, g_help, argv[0]); @@ -175,7 +184,11 @@ if (i > 0) { ss << ','; } - ss << raw_fp_data[i]; + if (g_signed) { + ss << static_cast<int32_t>(raw_fp_data[i]); + } else { + ss << raw_fp_data[i]; + } } tmp_fp = ss.str(); fp = tmp_fp.c_str(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/fingerprint_decompressor.cpp new/chromaprint-v1.5.0/src/fingerprint_decompressor.cpp --- old/chromaprint-v1.4.3/src/fingerprint_decompressor.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/fingerprint_decompressor.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -25,7 +25,7 @@ for (size_t j = 0; j < m_bits.size(); j++) { int bit = m_bits[j]; if (bit == 0) { - m_result[i] = (i > 0) ? value ^ m_result[i - 1] : value; + m_output[i] = (i > 0) ? value ^ m_output[i - 1] : value; value = 0; last_bit = 0; i++; @@ -37,25 +37,23 @@ } } -std::vector<uint32_t> FingerprintDecompressor::Decompress(const std::string &data, int *algorithm) +bool FingerprintDecompressor::Decompress(const std::string &input) { - if (data.size() < 4) { + if (input.size() < 4) { DEBUG("FingerprintDecompressor::Decompress() -- Invalid fingerprint (shorter than 4 bytes)"); - return std::vector<uint32_t>(); + return false; } - if (algorithm) { - *algorithm = data[0]; - } + m_algorithm = input[0]; const size_t num_values = - ((unsigned char)(data[1]) << 16) | - ((unsigned char)(data[2]) << 8) | - ((unsigned char)(data[3]) ); + ((size_t)((unsigned char)(input[1])) << 16) | + ((size_t)((unsigned char)(input[2])) << 8) | + ((size_t)((unsigned char)(input[3])) ); size_t offset = 4; - m_bits.resize(GetUnpackedInt3ArraySize(data.size() - offset)); - UnpackInt3Array(data.begin() + offset, data.end(), m_bits.begin()); + m_bits.resize(GetUnpackedInt3ArraySize(input.size() - offset)); + UnpackInt3Array(input.begin() + offset, input.end(), m_bits.begin()); size_t found_values = 0, num_exceptional_bits = 0; for (size_t i = 0; i < m_bits.size(); i++) { @@ -71,19 +69,19 @@ } if (found_values != num_values) { - DEBUG("FingerprintDecompressor::Decompress() -- Invalid fingerprint (too short, not enough data for normal bits)"); - return std::vector<uint32_t>(); + DEBUG("FingerprintDecompressor::Decompress() -- Invalid fingerprint (too short, not enough input for normal bits)"); + return false; } offset += GetPackedInt3ArraySize(m_bits.size()); - if (data.size() < offset + GetPackedInt5ArraySize(num_exceptional_bits)) { - DEBUG("FingerprintDecompressor::Decompress() -- Invalid fingerprint (too short, not enough data for exceptional bits)"); - return std::vector<uint32_t>(); + if (input.size() < offset + GetPackedInt5ArraySize(num_exceptional_bits)) { + DEBUG("FingerprintDecompressor::Decompress() -- Invalid fingerprint (too short, not enough input for exceptional bits)"); + return false; } if (num_exceptional_bits) { m_exceptional_bits.resize(GetUnpackedInt5ArraySize(GetPackedInt5ArraySize(num_exceptional_bits))); - UnpackInt5Array(data.begin() + offset, data.end(), m_exceptional_bits.begin()); + UnpackInt5Array(input.begin() + offset, input.end(), m_exceptional_bits.begin()); for (size_t i = 0, j = 0; i < m_bits.size(); i++) { if (m_bits[i] == kMaxNormalValue) { m_bits[i] += m_exceptional_bits[j++]; @@ -91,10 +89,10 @@ } } - m_result.assign(num_values, -1); + m_output.assign(num_values, -1); UnpackBits(); - return m_result; + return true; } }; // namespace chromaprint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/fingerprint_decompressor.h new/chromaprint-v1.5.0/src/fingerprint_decompressor.h --- old/chromaprint-v1.4.3/src/fingerprint_decompressor.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/fingerprint_decompressor.h 2020-04-15 06:08:10.000000000 +0200 @@ -14,19 +14,28 @@ { public: FingerprintDecompressor(); - std::vector<uint32_t> Decompress(const std::string &fingerprint, int *algorithm = 0); + bool Decompress(const std::string &fingerprint); + + std::vector<uint32_t> GetOutput() const { return m_output; } + int GetAlgorithm() const { return m_algorithm; } private: void UnpackBits(); - std::vector<uint32_t> m_result; + std::vector<uint32_t> m_output; + int m_algorithm { -1 }; std::vector<unsigned char> m_bits; std::vector<unsigned char> m_exceptional_bits; }; -inline std::vector<uint32_t> DecompressFingerprint(const std::string &data, int *algorithm = 0) +inline bool DecompressFingerprint(const std::string &input, std::vector<uint32_t> &output, int &algorithm) { FingerprintDecompressor decompressor; - return decompressor.Decompress(data, algorithm); + auto ok = decompressor.Decompress(input); + if (ok) { + output = decompressor.GetOutput(); + algorithm = decompressor.GetAlgorithm(); + } + return ok; } }; // namespace chromaprint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/src/fingerprinter_configuration.cpp new/chromaprint-v1.5.0/src/fingerprinter_configuration.cpp --- old/chromaprint-v1.4.3/src/fingerprinter_configuration.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/src/fingerprinter_configuration.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -92,6 +92,7 @@ set_classifiers(kClassifiersTest3, 16); set_filter_coefficients(kChromaFilterCoefficients, kChromaFilterSize); set_interpolate(true); + set_frame_size(kDefaultFrameSize); } FingerprinterConfigurationTest4::FingerprinterConfigurationTest4() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/tests/test_api.cpp new/chromaprint-v1.5.0/tests/test_api.cpp --- old/chromaprint-v1.4.3/tests/test_api.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/tests/test_api.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -137,14 +137,14 @@ TEST(API, TestHashFingerprint) { uint32_t fingerprint[] = { 19681, 22345, 312312, 453425 }; - uint32_t hash; + uint32_t hash; - ASSERT_EQ(0, chromaprint_hash_fingerprint(NULL, 4, &hash)); - ASSERT_EQ(0, chromaprint_hash_fingerprint(fingerprint, -1, &hash)); - ASSERT_EQ(0, chromaprint_hash_fingerprint(fingerprint, 4, NULL)); + ASSERT_EQ(0, chromaprint_hash_fingerprint(NULL, 4, &hash)); + ASSERT_EQ(0, chromaprint_hash_fingerprint(fingerprint, -1, &hash)); + ASSERT_EQ(0, chromaprint_hash_fingerprint(fingerprint, 4, NULL)); - ASSERT_EQ(1, chromaprint_hash_fingerprint(fingerprint, 4, &hash)); - ASSERT_EQ(17249, hash); + ASSERT_EQ(1, chromaprint_hash_fingerprint(fingerprint, 4, &hash)); + ASSERT_EQ(17249, hash); } TEST(API, TestDecodeFingerprintOutOfRange) @@ -157,4 +157,43 @@ chromaprint_decode_fingerprint(encoded, strlen(encoded), &fp, &length, &algorithm, 1); } +TEST(API, TestDecodeFingerprintEmpty) +{ + uint32_t *fp; + int length, algorithm; + + const char *encoded = "AQAAAA"; + + auto ret = chromaprint_decode_fingerprint(encoded, strlen(encoded), &fp, &length, &algorithm, 1); + ASSERT_EQ(1, ret); + ASSERT_EQ(0, length); + ASSERT_EQ(1, algorithm); +} + +TEST(API, TestDecodeFingerprintNull) +{ + uint32_t *fp; + int length, algorithm; + + const char *encoded = "null"; + + auto ret = chromaprint_decode_fingerprint(encoded, strlen(encoded), &fp, &length, &algorithm, 1); + ASSERT_EQ(0, ret); + ASSERT_EQ(0, length); + ASSERT_EQ(0, algorithm); +} + +TEST(API, TestDecodeFingerprintCoustidFingerprint) +{ + uint32_t *fp; + int length, algorithm; + + const char *encoded = "coustid Fingerprint"; + + auto ret = chromaprint_decode_fingerprint(encoded, strlen(encoded), &fp, &length, &algorithm, 1); + ASSERT_EQ(0, ret); + ASSERT_EQ(0, length); + ASSERT_EQ(0, algorithm); +} + }; // namespace chromaprint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/tests/test_fingerprint_decompressor.cpp new/chromaprint-v1.5.0/tests/test_fingerprint_decompressor.cpp --- old/chromaprint-v1.4.3/tests/test_fingerprint_decompressor.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/tests/test_fingerprint_decompressor.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -14,7 +14,8 @@ char data[] = { 0, 0, 0, 1, 1 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -26,7 +27,8 @@ char data[] = { 0, 0, 0, 1, 73, 0 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -37,7 +39,8 @@ char data[] = { 0, 0, 0, 1, 7, 0 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -48,7 +51,8 @@ char data[] = { 0, 0, 0, 1, 7, 2 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -59,7 +63,8 @@ char data[] = { 0, 0, 0, 2, 65, 0 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -70,7 +75,8 @@ char data[] = { 0, 0, 0, 2, 1, 0 }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, NELEMS(expected)); ASSERT_EQ(0, algorithm); } @@ -81,9 +87,10 @@ char data[] = { 0, char(255), char(255), char(255) }; int algorithm = 1; - std::vector<uint32_t> value = DecompressFingerprint(std::string(data, NELEMS(data)), &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(false, DecompressFingerprint(std::string(data, NELEMS(data)), value, algorithm)); CheckFingerprints(value, expected, 0); - ASSERT_EQ(0, algorithm); + ASSERT_EQ(1, algorithm); } TEST(FingerprintDecompressor, Long) @@ -92,7 +99,8 @@ std::string data = Base64Decode("AQAAEwkjrUmSJQpUHflR9mjSJMdZpcO_Imdw9dCO9Clu4_wQPvhCB01w6xAtXNcAp5RASgDBhDSCGGIAcwA"); int algorithm = 2; - std::vector<uint32_t> value = DecompressFingerprint(data, &algorithm); + std::vector<uint32_t> value; + ASSERT_EQ(true, DecompressFingerprint(data, value, algorithm)); CheckFingerprints(value, (uint32_t *) expected, NELEMS(expected)); ASSERT_EQ(1, algorithm); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/tests/test_utils.cpp new/chromaprint-v1.5.0/tests/test_utils.cpp --- old/chromaprint-v1.4.3/tests/test_utils.cpp 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/tests/test_utils.cpp 2020-04-15 06:08:10.000000000 +0200 @@ -2,6 +2,7 @@ #include <algorithm> #include <limits> #include "utils.h" +#include "test_utils.h" using namespace chromaprint; @@ -92,3 +93,11 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chromaprint-v1.4.3/tests/test_utils.h new/chromaprint-v1.5.0/tests/test_utils.h --- old/chromaprint-v1.4.3/tests/test_utils.h 2018-01-21 17:41:56.000000000 +0100 +++ new/chromaprint-v1.5.0/tests/test_utils.h 2020-04-15 06:08:10.000000000 +0200 @@ -31,11 +31,15 @@ { 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; }
