Add a configure-time check using avcodec_find_encoder_by_name("libmp3lame") to

look for LAME support.  Unfortunatly FFMPEG's internal MP3 support is rather
broken.  If --enable-broken-mp3 is supplied configure will continue otherwise
LAME must be compiled into FFMPEG.

Originally committed to SVN as r1989.
This commit is contained in:
Amar Takhar 2008-03-09 07:38:49 +00:00
parent fe8ed21878
commit 6c7b619c83
1 changed files with 43 additions and 0 deletions

View File

@ -225,6 +225,49 @@ if test "$with_ffmpeg" != "no"; then
fi
fi
if test "$with_ffmpeg" = "yes"; then
AC_ARG_ENABLE(broken-mp3, [--enable-broken-mp3 Enable the use of FFMPEG w/out LAME compiled in.])
AC_MSG_CHECKING([whether ffmpeg has LAME compiled in])
aegisub_save_LDFLAGS="$LDFLAGS"
AC_LANG(C)
LDFLAGS="$LDFLAGS $AVCODEC_LDFLAGS"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([#include <ffmpeg/avcodec.h>],
[
avcodec_register_all();
if (avcodec_find_encoder_by_name("libmp3lame"))
return 1;
])
],
ffmpeg_mp3_broken="yes",
ffmpeg_mp3_broken="no")
LDFLAGS="$aegisub_save_LDFLAGS"
AC_LANG(C++)
fi
if test $ffmpeg_mp3_broken = "yes"; then
AC_MSG_RESULT([no])
AC_MSG_NOTICE([
***********************************************************************
* Your installation of FFMPEG does not have LAME support compiled in.
* This will result in _broken_ mp3 decoding, either recompile FFMPEG
* with LAME support, or supply --with-broken-mp3 (With this you will have
* to demux the audio, convert to wav and load the audio/wav seperately.)
* * LAME can be found at: http://lame.sourceforge.net/index.php
***********************************************************************
])
echo "enable_broken_mp3: $enable_broken_mp3"
if test "$enable_broken_mp3" != "yes"; then
AC_MSG_FAILURE([Please read.])
fi
else
AC_MSG_RESULT([yes])
fi
AC_SUBST(SWSCALE_LDFLAGS)
AC_SUBST(AVCODEC_LDFLAGS)
AC_SUBST(AVFORMAT_LDFLAGS)