Source: acoustid-fingerprinter
Version: 0.6-3
Severity: wishlist
Tags: patch
Usertags: reintroducing-ffmpeg

Dear maintainer,

I am working on reintroducing FFmpeg to Debian [1-2].

In order to make FFmpeg co-installable with Libav, the libraries were
renamed to lib*-ffmpeg. Thus using linker flags like '-lavcodec' doesn't
work with the FFmpeg packages.

To get the correct linking flags for both FFmpeg and Libav, one can
(and should) use pkg-config.

Attached patch achieves that for this package. Please apply it to
facilitate building your package with FFmpeg in Debian.

If you want to facilitate this even further, you can also add
lib*-ffmpeg-dev alternatives to the Libav build-dependencies.

While the FFmpeg package is still waiting in the NEW queue [3], it can
already be built from the git repository [4].

The other patch is necessary to fix building against FFmpeg.

Best regards,
Andreas


1: https://lists.debian.org/debian-devel/2014/07/msg01010.html
2: https://bugs.debian.org/729203
3: https://ftp-master.debian.org/new/ffmpeg_7:2.3.1-1.html
4: https://anonscm.debian.org/cgit/collab-maint/ffmpeg.git

diff --git a/debian/patches/02-CodecID.patch b/debian/patches/02-CodecID.patch
new file mode 100644
index 0000000..995766d
--- /dev/null
+++ b/debian/patches/02-CodecID.patch
@@ -0,0 +1,34 @@
+Description: Replace removed macros
+ Rename CodecID to AVCodecID and replace AVCODEC_MAX_AUDIO_FRAME_SIZE
+ with its last value 192000.
+
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2014-05-13>
+
+--- acoustid-fingerprinter-0.6.orig/decoder.h
++++ acoustid-fingerprinter-0.6/decoder.h
+@@ -116,7 +116,7 @@ inline Decoder::Decoder(const std::strin
+ #endif
+ {
+ #ifdef HAVE_AV_AUDIO_CONVERT
+-	m_buffer2 = (uint8_t *)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE * 2 + 16);
++	m_buffer2 = (uint8_t *)av_malloc(192000 * 2 + 16);
+ #endif
+ 
+ #if NEW_AVFRAME_API
+--- acoustid-fingerprinter-0.6.orig/ffmpeg/audioconvert.h
++++ acoustid-fingerprinter-0.6/ffmpeg/audioconvert.h
+@@ -75,11 +75,11 @@ int avcodec_channel_layout_num_channels(
+ /**
+  * Guess the channel layout
+  * @param nb_channels
+- * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown
++ * @param codec_id Codec identifier, or AV_CODEC_ID_NONE if unknown
+  * @param fmt_name Format name, or NULL if unknown
+  * @return Channel layout mask
+  */
+-uint64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
++uint64_t avcodec_guess_channel_layout(int nb_channels, enum AVCodecID codec_id, const char *fmt_name);
+ 
+ struct AVAudioConvert;
+ typedef struct AVAudioConvert AVAudioConvert;
diff --git a/debian/patches/series b/debian/patches/series
index 78d84b9..3d35796 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 01-Fix-build-with-upcoming-Libav-10-release.patch
+02-CodecID.patch

diff --git a/debian/control b/debian/control
index a7d58ec..6c60f3d 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: acoustid-fingerprinter
 Section: sound
 Priority: optional
 Maintainer: Jerome Charaoui <jer...@riseup.net>
-Build-Depends: debhelper (>= 8.0.0), cmake, cdbs, libavformat-dev, libavcodec-dev, libchromaprint-dev, libqt4-dev, libtag1-dev
+Build-Depends: debhelper (>= 8.0.0), cmake, cdbs, libavformat-dev, libavcodec-dev, libchromaprint-dev, libqt4-dev, libtag1-dev, pkg-config
 Standards-Version: 3.9.5
 Homepage: http://wiki.acoustid.org/wiki/Fingerprinter
 
diff --git a/debian/patches/03-pkg-config.patch b/debian/patches/03-pkg-config.patch
new file mode 100644
index 0000000..a6daff5
--- /dev/null
+++ b/debian/patches/03-pkg-config.patch
@@ -0,0 +1,48 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2014-07-27>
+
+--- acoustid-fingerprinter-0.6.orig/CMakeLists.txt
++++ acoustid-fingerprinter-0.6/CMakeLists.txt
+@@ -12,6 +12,7 @@ set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_
+ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+ 
+ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
++find_package(PkgConfig REQUIRED)
+ find_package(FFmpeg REQUIRED)
+ find_package(Taglib REQUIRED)
+ find_package(Chromaprint REQUIRED)
+--- acoustid-fingerprinter-0.6.orig/cmake/modules/FindFFmpeg.cmake
++++ acoustid-fingerprinter-0.6/cmake/modules/FindFFmpeg.cmake
+@@ -47,29 +47,7 @@ MACRO(FFMPEG_FIND varname shortname head
+ 		DOC "Location of FFMPEG Headers"
+ 	)
+ 
+-    FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
+-        NAMES ${shortname}
+-        PATHS
+-        ${FFMPEG_ROOT}/lib
+-        $ENV{FFMPEG_DIR}/lib
+-        ~/Library/Frameworks
+-        /Library/Frameworks
+-        /usr/local/lib
+-        /usr/local/lib64
+-        /usr/lib
+-        /usr/lib64
+-        /sw/lib
+-        /opt/local/lib
+-        /opt/csw/lib
+-        /opt/lib
+-        /usr/freeware/lib64
+-		NO_DEFAULT_PATH
+-        DOC "Location of FFMPEG Libraries"
+-    )
+-    FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
+-        NAMES ${shortname}
+-        DOC "Location of FFMPEG Libraries"
+-    )
++	pkg_check_modules(FFMPEG_${varname} lib${shortname})
+ 
+     IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
+         SET(FFMPEG_${varname}_FOUND 1)
diff --git a/debian/patches/series b/debian/patches/series
index 3d35796..90dad45 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01-Fix-build-with-upcoming-Libav-10-release.patch
 02-CodecID.patch
+03-pkg-config.patch

Reply via email to