2009-03-06 16:36:08 +01:00
|
|
|
AC_DEFUN([AM_PATH_FAAD],
|
|
|
|
[dnl ##
|
|
|
|
dnl faad
|
|
|
|
dnl ##
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(aac,
|
|
|
|
AS_HELP_STRING([--disable-aac],
|
|
|
|
[disable AAC support (default: enable)]),,
|
|
|
|
enable_aac=yes)
|
|
|
|
|
|
|
|
if test x$enable_aac = xyes; then
|
2013-01-29 15:40:44 +01:00
|
|
|
FAAD_LIBS="-lfaad"
|
|
|
|
FAAD_CFLAGS=""
|
2009-03-06 16:36:08 +01:00
|
|
|
|
|
|
|
oldcflags=$CFLAGS
|
|
|
|
oldlibs=$LIBS
|
|
|
|
oldcppflags=$CPPFLAGS
|
2013-01-29 15:51:23 +01:00
|
|
|
CFLAGS="$CFLAGS $FAAD_CFLAGS"
|
2011-10-09 17:33:09 +02:00
|
|
|
LIBS="$LIBS $FAAD_LIBS"
|
2009-03-06 16:36:08 +01:00
|
|
|
CPPFLAGS=$CFLAGS
|
|
|
|
AC_CHECK_HEADER(faad.h,,enable_aac=no)
|
|
|
|
if test x$enable_aac = xyes; then
|
|
|
|
AC_CHECK_DECL(FAAD2_VERSION,,enable_aac=no,[#include <faad.h>])
|
|
|
|
fi
|
|
|
|
if test x$enable_aac = xyes; then
|
2013-01-29 16:17:15 +01:00
|
|
|
AC_CHECK_LIB(faad,NeAACDecInit2,,enable_aac=no)
|
2009-03-06 16:36:08 +01:00
|
|
|
fi
|
|
|
|
if test x$enable_aac = xyes; then
|
|
|
|
AC_MSG_CHECKING(that FAAD2 can even be used)
|
2011-01-07 17:20:48 +01:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
2009-03-06 16:36:08 +01:00
|
|
|
#include <faad.h>
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
char buffer;
|
2013-01-29 16:17:15 +01:00
|
|
|
NeAACDecHandle decoder;
|
|
|
|
NeAACDecFrameInfo frameInfo;
|
|
|
|
NeAACDecConfigurationPtr config;
|
2009-03-06 16:36:08 +01:00
|
|
|
unsigned char channels;
|
|
|
|
long sampleRate;
|
|
|
|
long bufferlen = 0;
|
|
|
|
|
2013-01-29 16:17:15 +01:00
|
|
|
decoder = NeAACDecOpen();
|
|
|
|
config = NeAACDecGetCurrentConfiguration(decoder);
|
2009-03-06 16:36:08 +01:00
|
|
|
config->outputFormat = FAAD_FMT_16BIT;
|
2013-01-29 16:17:15 +01:00
|
|
|
NeAACDecSetConfiguration(decoder,config);
|
|
|
|
NeAACDecInit(decoder,&buffer,bufferlen,&sampleRate,&channels);
|
|
|
|
NeAACDecInit2(decoder,&buffer,bufferlen,&sampleRate,&channels);
|
|
|
|
NeAACDecDecode(decoder,&frameInfo,&buffer,bufferlen);
|
|
|
|
NeAACDecClose(decoder);
|
2009-03-06 16:36:08 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-07 17:20:48 +01:00
|
|
|
])],AC_MSG_RESULT(yes),[AC_MSG_RESULT(no);enable_aac=no])
|
2009-03-06 16:36:08 +01:00
|
|
|
fi
|
|
|
|
if test x$enable_aac = xyes; then
|
|
|
|
AC_DEFINE(HAVE_FAAD,1,[Define to use FAAD2 for AAC decoding])
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([faad2 lib needed for MP4/AAC support -- disabling MP4/AAC support])
|
|
|
|
fi
|
|
|
|
CFLAGS=$oldcflags
|
|
|
|
LIBS=$oldlibs
|
|
|
|
CPPFLAGS=$oldcppflags
|
|
|
|
fi
|
|
|
|
|
decoder/faad: remove workaround for ancient libfaad2 ABI bug
Many years ago, FAAD had a serious ABI bug: the NeAACDecInit()
prototype in its header declared the "samplerate" parameter to be
"unsigned long *", but internally, the function assumed it was
"uint32_t *" instead. On 32 bit machines, that was no difference, but
on 64 bit, this left one portion of the return value uninitialized;
and worse, on big-endian, the wrong word was filled. This bug had to
be worked around in MPD (commit 9c4e97a6).
A few months later, the bug was fixed in the FAAD CVS in commit 1.117
on file libfaad/decoder.c; the commit message was:
"Use public headers internally to prevent duplicate declarations"
The commit message was too brief at best; the problem was not
duplicate declarations, but a prototype mismatch. No mention of the
bug fix in the ChangeLog.
The MPD project never learned about this bug fix, and so MPD would
always pass a "uin32_t *" dressed up as a "unsigned long *". Nearly 6
years later, it's about time to fix this second ABI problem. Let's
kill the workaround!
2014-10-25 20:42:50 +02:00
|
|
|
if test x$enable_aac = xno; then
|
2013-01-29 15:52:43 +01:00
|
|
|
FAAD_LIBS=""
|
|
|
|
FAAD_CFLAGS=""
|
2009-03-06 16:36:08 +01:00
|
|
|
fi
|
|
|
|
|
2011-10-09 18:25:09 +02:00
|
|
|
AC_SUBST(FAAD_CFLAGS)
|
|
|
|
AC_SUBST(FAAD_LIBS)
|
|
|
|
|
2009-04-29 12:11:14 +02:00
|
|
|
])
|