summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2016-01-31 14:42:21 +0000
committerTim-Philipp Müller <tim@centricular.com>2016-01-31 14:42:21 +0000
commit861ca5ab7b1521572042357d2e553c669f562deb (patch)
tree39d4f272cd7f818dad08b5272c1d16f4af178b1c
parent0770fa4ed55f375cdb54bf22742a7eef6da8808e (diff)
downloadgstreamer-plugins-bad-861ca5ab7b1521572042357d2e553c669f562deb.tar.gz
faad: simplify configure check and require faad >= 2.7
Just check whether LATM is defined which is only available in 2.7 and later. Allows us to simplify the configure check a little and we can get rid of some hackish workarounds for problems with earlier version headers.
-rw-r--r--configure.ac61
-rw-r--r--ext/faad/Makefile.am4
-rw-r--r--ext/faad/gstfaad.c49
-rw-r--r--ext/faad/gstfaad.h4
4 files changed, 16 insertions, 102 deletions
diff --git a/configure.ac b/configure.ac
index 186a8c3a8..bb1e270a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2159,60 +2159,27 @@ AG_GST_CHECK_FEATURE(FAAC, [AAC encoder plug-in], faac, [
AC_SUBST(FAAC_LIBS)
])
-dnl **** Free AAC Decoder (FAAD) ****
+dnl **** Free AAC Decoder (FAAD2) ****
translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
-AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
- HAVE_FAAD="yes"
- faad_hdr=""
- AG_GST_CHECK_LIBHEADER(FAAD, faad, faacDecOpen, $LIBM, faad.h,
- FAAD_LIBS="-lfaad $LIBM", HAVE_FAAD="no")
- if test $HAVE_FAAD = "no"; then
- AG_GST_CHECK_LIBHEADER(FAAD, faad, NeAACDecOpen, $LIBM, neaacdec.h,
- [ FAAD_LIBS="-lfaad $LIBM"
- AC_DEFINE(FAAD_IS_NEAAC, 1, [Define if AAC is using new api prefix])
- faad_hdr="neaacdec.h"
- ], [
- HAVE_FAAD="no"
- ],)
- else
- faad_hdr="faad.h"
- fi
- if test $HAVE_FAAD = "yes"; then
- AC_MSG_CHECKING([Checking for FAAD >= 2.0])
+AG_GST_CHECK_FEATURE(FAAD, [FAAD2 AAC decoder plug-in], faad, [
+ AG_GST_CHECK_LIBHEADER(FAAD, faad, NeAACDecOpen, $LIBM, neaacdec.h, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <faad.h>]], [[
- #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
- #error Not faad2
- #else
- /* Release candidate of 2.0 is not good enough for us. This field
- * was added only in 2.0 final and does not exist in 2.0-RC3 */
- faacDecConfiguration conf; conf.dontUpSampleImplicitSBR = 1;
- #endif
+ #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
+ #error Not faad2
+ #elif !defined(LATM)
+ #error Not faad2 >= 2.7
+ #endif
]])],[
HAVE_FAAD="yes"
-
- AC_MSG_CHECKING([Checking FAAD2 version in $faad_hdr])
- for minor in 10 9 8 7 6 5 0; do
- if test x$faad2_minor_version = "x"; then
- AC_EGREP_CPP([\"2\.$minor\"$], [
- #include <$faad_hdr>
- FAAD2_VERSION
- ], [
- faad2_minor_version=$minor
- ])
- fi
- done
- if test x$faad2_minor_version = "x"; then
- AC_MSG_RESULT([no idea])
- else
- AC_MSG_RESULT([2.$faad2_minor_version])
- AC_DEFINE_UNQUOTED([FAAD2_MINOR_VERSION], [$faad2_minor_version], [The x in 2.x])
- fi
- ],[
+ FAAD_LIBS="-lfaad"
+ ], [
+ AC_MSG_WARN([Found libfaad, but version not recent enough. Need faad2 >= 2.7])
HAVE_FAAD="no"
])
- fi
+ ], [
+ HAVE_FAAD="no"
+ ])
AC_SUBST(FAAD_LIBS)
- AC_SUBST(FAAD_IS_NEAAC)
])
dnl *** fbdev ***
diff --git a/ext/faad/Makefile.am b/ext/faad/Makefile.am
index 2aef183af..56ad30f4c 100644
--- a/ext/faad/Makefile.am
+++ b/ext/faad/Makefile.am
@@ -1,11 +1,11 @@
plugin_LTLIBRARIES = libgstfaad.la
libgstfaad_la_SOURCES = gstfaad.c
-libgstfaad_la_CFLAGS = -DGST_USE_UNSTABLE_API \
+libgstfaad_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(FAAD_CFLAGS)
libgstfaad_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
- $(GST_BASE_LIBS) $(GST_LIBS) $(FAAD_LIBS)
+ $(GST_BASE_LIBS) $(GST_LIBS) $(FAAD_LIBS) $(LIBM)
libgstfaad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstfaad_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index 8197ca56d..b72b42d5b 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -42,49 +42,8 @@
#include <string.h>
#include <gst/audio/audio.h>
-/* These are the correct types for these functions, as defined in the source,
- * with types changed to match glib types, since those are defined for us.
- * However, upstream FAAD is distributed with a broken header file that defined
- * these wrongly (in a way which was broken on 64 bit systems).
- *
- * Upstream CVS still has the bug, but has also renamed all the public symbols
- * for Better Corporate Branding (or whatever), so we need to take that
- * (FAAD_IS_NEAAC) into account as well.
- *
- * We must call them using these definitions. Most distributions now have the
- * corrected header file (they distribute a patch along with the source),
- * but not all, hence this Truly Evil Hack.
- *
- * Note: The prototypes don't need to be defined conditionaly, as the cpp will
- * do that for us.
- */
-#if FAAD2_MINOR_VERSION < 7
-#ifdef FAAD_IS_NEAAC
-#define NeAACDecInit NeAACDecInit_no_definition
-#define NeAACDecInit2 NeAACDecInit2_no_definition
-#else
-#define faacDecInit faacDecInit_no_definition
-#define faacDecInit2 faacDecInit2_no_definition
-#endif
-#endif /* FAAD2_MINOR_VERSION < 7 */
-
#include "gstfaad.h"
-#if FAAD2_MINOR_VERSION < 7
-#ifdef FAAD_IS_NEAAC
-#undef NeAACDecInit
-#undef NeAACDecInit2
-#else
-#undef faacDecInit
-#undef faacDecInit2
-#endif
-
-extern long faacDecInit (faacDecHandle, guint8 *, guint32, guint32 *, guint8 *);
-extern gint8 faacDecInit2 (faacDecHandle, guint8 *, guint32,
- guint32 *, guint8 *);
-
-#endif /* FAAD2_MINOR_VERSION < 7 */
-
GST_DEBUG_CATEGORY_STATIC (faad_debug);
#define GST_CAT_DEFAULT faad_debug
@@ -277,11 +236,7 @@ gst_faad_set_format (GstAudioDecoder * dec, GstCaps * caps)
faad->packetised = FALSE;
if ((value = gst_structure_get_value (str, "codec_data"))) {
-#if FAAD2_MINOR_VERSION >= 7
unsigned long samplerate;
-#else
- guint32 samplerate;
-#endif
guint8 channels;
/* We have codec data, means packetised stream */
@@ -691,11 +646,7 @@ gst_faad_handle_frame (GstAudioDecoder * dec, GstBuffer * buffer)
init:
/* init if not already done during capsnego */
if (!faad->init) {
-#if FAAD2_MINOR_VERSION >= 7
unsigned long rate;
-#else
- guint32 rate;
-#endif
guint8 ch;
GST_DEBUG_OBJECT (faad, "initialising ...");
diff --git a/ext/faad/gstfaad.h b/ext/faad/gstfaad.h
index 1e34797e5..03bd6abc4 100644
--- a/ext/faad/gstfaad.h
+++ b/ext/faad/gstfaad.h
@@ -23,11 +23,7 @@
#include <gst/gst.h>
#include <gst/audio/gstaudiodecoder.h>
-#ifdef FAAD_IS_NEAAC
#include <neaacdec.h>
-#else
-#include <faad.h>
-#endif
G_BEGIN_DECLS