Ticket #672: configure_fix_ffmpeg.diff

File configure_fix_ffmpeg.diff, 8.1 KB (added by nbk@…, 12 years ago)

Fix the lists of FFmpeg codecs and muxers

  • configure

     
    165165  test $? -ne 0
    166166}
    167167
     168set_all(){
     169    value=$1
     170    shift
     171    for var in $*; do
     172        eval $var=$value
     173    done
     174}
     175
     176enable(){
     177    set_all yes $*
     178}
     179
     180disable(){
     181    set_all no $*
     182}
     183
     184enabled(){
     185    eval test "x\$$1" = "xyes"
     186}
     187
     188enabled_all(){
     189    for opt; do
     190        enabled $opt || return 1
     191    done
     192}
     193
     194enabled_any(){
     195    for opt; do
     196        enabled $opt && return 0
     197    done
     198}
     199
    168200# Use this before starting a check
    169201echocheck() {
    170202  echo "============ Checking for $@ ============" >> "$TMPLOG"
     
    15871619_amr_nb=auto
    15881620_amr_nb_fixed=auto
    15891621_amr_wb=auto
    1590 _libavdecoders=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "libavcodec/allcodecs.c"`
    1591 _libavencoders=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "libavcodec/allcodecs.c"`
    1592 _libavparsers=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "libavcodec/allcodecs.c"`
    1593 _libavdemuxers=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c`
    1594 _libavmuxers=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c`
    15951622_libavcodec_so=auto
    15961623_libavformat=auto
    15971624_libavformat_so=auto
     
    17461773_rpath=no
    17471774_asmalign_pot=auto
    17481775_color_console=no
     1776
     1777# Parts of FFmpeg
     1778_libavencoder_list=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "libavcodec/allcodecs.c"`
     1779_libavdecoder_list=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "libavcodec/allcodecs.c"`
     1780_libavparser_list=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "libavcodec/allcodecs.c"`
     1781_libavmuxer_list=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "libavformat/allformats.c"`
     1782_libavdemuxer_list=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "libavformat/allformats.c"`
     1783enable $_libavencoder_list $_libavdecoder_list $_libavparser_list $_libavmuxer_list $_libavdemuxer_list
     1784
    17491785for ac_option do
    17501786  case "$ac_option" in
    17511787  # Skip 1st pass
     
    19802016  --disable-amr_nb-fixed)       _amr_nb_fixed=no ;;
    19812017  --enable-amr_wb)      _amr_wb=yes     ;;
    19822018  --disable-amr_wb)     _amr_wb=no      ;;
    1983   --enable-decoder=*)   _libavdecoders="$_libavdecoders `echo $ac_option | cut -d '=' -f 2`" ;;
    1984   --disable-decoder=*)  _libavdecoders=`echo $_libavdecoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
    1985   --enable-encoder=*)   _libavencoders="$_libavencoders `echo $ac_option | cut -d '=' -f 2`" ;;
    1986   --disable-encoder=*)  _libavencoders=`echo $_libavencoders | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
    1987   --enable-parser=*)    _libavparsers="$_libavparsers `echo $ac_option | cut -d '=' -f 2`" ;;
    1988   --disable-parser=*)   _libavparsers=`echo $_libavparsers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
    1989   --enable-demuxer=*)   _libavdemuxers="$_libavdemuxers `echo $ac_option | cut -d '=' -f 2`" ;;
    1990   --disable-demuxer=*)  _libavdemuxers=`echo $_libavdemuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
    1991   --enable-muxer=*)     _libavmuxers="$_libavmuxers `echo $ac_option | cut -d '=' -f 2`" ;;
    1992   --disable-muxer=*)    _libavmuxers=`echo $_libavmuxers | sed "s/\`echo $ac_option | cut -d '=' -f 2\`//g"` ;;
     2019  --enable-decoder=*)   enable `echo $ac_option | cut -d '=' -f 2`_decoder ;;
     2020  --disable-decoder=*)  disable `echo $ac_option | cut -d '=' -f 2`_decoder ;;
     2021  --enable-encoder=*)   enable `echo $ac_option | cut -d '=' -f 2`_encoder ;;
     2022  --disable-encoder=*)  disable `echo $ac_option | cut -d '=' -f 2`_encoder ;;
     2023  --enable-parser=*)    enable `echo $ac_option | cut -d '=' -f 2`_parser ;;
     2024  --disable-parser=*)   disable `echo $ac_option | cut -d '=' -f 2`_parser ;;
     2025  --enable-demuxer=*)   enable `echo $ac_option | cut -d '=' -f 2`_demuxer ;;
     2026  --disable-demuxer=*)  disable `echo $ac_option | cut -d '=' -f 2`_demuxer ;;
     2027  --enable-muxer=*)     enable `echo $ac_option | cut -d '=' -f 2`_muxer ;;
     2028  --disable-muxer=*)    disable `echo $ac_option | cut -d '=' -f 2`_muxer ;;
    19932029  --enable-libavformat) _libavformat=yes;;
    19942030  --disable-libavformat)        _libavformat=no ;;
    19952031  --enable-libavformat_so)      _libavformat_so=yes     ;;
     
    58285864fi
    58295865if test "$_faac" = yes ; then
    58305866  _def_faac="#define HAVE_FAAC 1"
    5831   if echo $_libavencoders | grep -q faac ; then
     5867  if enabled faac_encoder ; then
    58325868    _lavc_faac=yes
    58335869    _def_lavc_faac="#define CONFIG_FAAC 1"
    58345870    _libs_mplayer="$_libs_mplayer $_ld_faac"
     
    64666502  _x264=yes
    64676503  _def_x264='#define HAVE_X264 1'
    64686504  _codecmodules="x264 $_codecmodules"
    6469   if echo $_libavencoders | grep -q x264 ; then
     6505  if enabled x264_encoder ; then
    64706506    _lavc_x264=yes
    64716507    _def_lavc_x264='#define CONFIG_X264 1'
    64726508    _libs_mplayer="$_libs_mplayer $_ld_x264"
     
    65336569int main(void) { lame_set_preset(NULL, MEDIUM_FAST); return 0; }
    65346570EOF
    65356571    cc_check $_ld_mp3lame $_ld_lm && _def_mp3lame_preset_medium="#define HAVE_MP3LAME_PRESET_MEDIUM"
    6536     if echo $_libavencoders | grep -q mp3lame ; then
     6572    if enabled mp3lame_encoder ; then
    65376573      _lavc_mp3lame=yes
    65386574      _def_lavc_mp3lame="#define CONFIG_MP3LAME 1"
    65396575      _libs_mplayer="$_libs_mplayer $_ld_mp3lame"
     
    65546590  _mencoder_flag='#define HAVE_MENCODER'
    65556591  _def_muxers='#define CONFIG_MUXERS 1'
    65566592else
     6593  disable $_libavmuxer_list
     6594  disable $_libavencoder_list
    65576595  # mpeg1video for vf_lavc, snow for vf_uspp and vf_mcdeint
    6558   _libavencoders="mpeg1video_encoder snow_encoder"
    6559   _libavmuxers=""
     6596  enable mpeg1video_encoder snow_encoder
    65606597fi
    65616598echores "$_mencoder"
    65626599
     
    74757512CONFIG_AMR_NB=$_amr_nb
    74767513CONFIG_AMR_NB_FIXED=$_amr_nb_fixed
    74777514CONFIG_AMR_WB=$_amr_wb
    7478 `echo $_libavdecoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/'`
    7479 `echo $_libavencoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/'`
    7480 `echo $_libavparsers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/'`
    7481 `echo $_libavdemuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/'`
    7482 `echo $_libavmuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/'`
    74837515CONFIG_FAAC=$_lavc_faac
    74847516CONFIG_MP3LAME=$_lavc_mp3lame
    74857517CONFIG_XVID=$_lavc_xvid
     
    75217553AF_SRCS = $_afsrc
    75227554
    75237555EOF
     7556for codec in $_libavdecoder_list $_libavencoder_list $_libavparser_list $_libavdemuxer_list $_libavmuxer_list; do
     7557  ucname="`echo $codec | tr '[a-z]' '[A-Z]'`"
     7558  if enabled $codec; then
     7559        echo "CONFIG_$ucname=yes"
     7560  fi
     7561done >> config.mak
    75247562
    75257563#############################################################################
    75267564echo "Creating config.h"
     
    78487886$_def_amr_nb_fixed
    78497887$_def_amr_wb
    78507888
    7851 /* Use specific parts from FFmpeg. */
    7852 `echo $_libavdecoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define CONFIG_/;s/$/ 1/'`
    7853 `echo $_libavdecoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define ENABLE_/;s/$/ 1/'`
    7854 `echo $_libavencoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define CONFIG_/;s/$/ 1/'`
    7855 `echo $_libavencoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define ENABLE_/;s/$/ 1/'`
    7856 `echo $_libavparsers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define CONFIG_/;s/$/ 1/'`
    7857 `echo $_libavparsers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define ENABLE_/;s/$/ 1/'`
    7858 `echo $_libavdemuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define CONFIG_/;s/$/ 1/'`
    7859 `echo $_libavdemuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define ENABLE_/;s/$/ 1/'`
    7860 `echo $_libavmuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define CONFIG_/;s/$/ 1/'`
    7861 `echo $_libavmuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/#define ENABLE_/;s/$/ 1/'`
    7862 $_def_lavc_faac
    7863 $_def_lavc_xvid
    7864 $_def_lavc_mp3lame
    7865 $_def_lavc_x264
    7866 
    78677889/* Use codec libs included in mplayer CVS / source dist: */
    78687890$_def_mp3lib
    78697891$_def_liba52
     
    82328254#define X11_FULLSCREEN 1
    82338255#endif
    82348256
    8235 #endif /* MPLAYER_CONFIG_H */
     8257/* Use specific parts from FFmpeg. */
     8258$_def_lavc_faac
     8259$_def_lavc_xvid
     8260$_def_lavc_mp3lame
     8261$_def_lavc_x264
     8262
    82368263EOF
     8264for codec in $_libavdecoder_list $_libavencoder_list $_libavparser_list $_libavdemuxer_list $_libavmuxer_list; do
     8265  ucname="`echo $codec | tr '[a-z]' '[A-Z]'`"
     8266  if enabled $codec; then
     8267        echo "#define CONFIG_$ucname 1"
     8268        echo "#define ENABLE_$ucname 1"
     8269    else
     8270        echo "#define ENABLE_$ucname 0"
     8271    fi
     8272done >> config.h
     8273echo '#endif /* MPLAYER_CONFIG_H */' >> config.h
    82378274
    82388275#############################################################################
    82398276