view configure.in @ 474:c66080364dff

Most decoders now report total sample play time, now. Technically, this breaks binary compatibility with the 1.0 branch, since it extends the Sound_Sample struct, but most (all?) programs are just passing pointers allocated by SDL_sound around, and might be okay. Source-level compatibility is not broken...yet! :) --ryan. -------- Original Message -------- Subject: SDL_sound patch: Finding total length of time of sound file. Date: Sun, 26 Jan 2003 09:31:17 -0800 (PST) Hi Ryan, I am working with Eric Wing and helping him modify SDL_sound. AS part of our efforts in improving and enhancing SDL_sound, we like to submit this patch. We modified the codecs to find the total time of a sound file. Below is the explanation of the patch. The patch is appended as an attachment to this email. * MOTIVATION: We needed the ability to get the total play time of a sample (And we noticed that we're not the only ones). Since SDL_sound blocks direct access to the specific decoders, there is no way for a user to know this information short of decoding the whole thing. Because of this, we believe this will be a useful addition, even though the accuracy may not be perfect (subject to each decoder) or the information may not always be available. * CONTRIBUTORS: Wesley Leong (modified the majority of the codecs and verified the results) Eric Wing (showed everyone how to do modify codec, modified mikmod) Wang Lam (modified a handful of codecs, researched into specs and int overflow) Ahilan Anantha (modified a few codecs and helped with integer math) * GENERAL ISSUES: We chose the value to be milliseconds as an Sint32. Milliseconds because that's what Sound_Seek takes as a parameter and -1 to allow for instances/codecs where the value could not be determined. We are not sure if this is the final convention you want, so we are willing to work with you on this. We also expect the total_time field to be set on open and never again modified by SDL_sound. Users may access it directly much like the sample buffer and buffer_size. We thought about recomputing the time on DecodeAll, but since users may seek or decode small chunks first, not all the data may be there. So this is better done by the user. This may be good information to document. Currently, all the main codecs are implemented except for QuickTime.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 08 May 2004 08:19:50 +0000
parents 636796aed4e2
children 9e761a594df1 d0d381a6f2bb
line wrap: on
line source

# Process this file with autoconf to produce a configure script.
AC_INIT(SDL_sound.c)

dnl ---------------------------------------------------------------------
dnl System/version info
dnl ---------------------------------------------------------------------

# Making releases:
#   MICRO_VERSION += 1;
#   INTERFACE_AGE += 1;
#   BINARY_AGE += 1;
# if any functions have been added, set INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set BINARY_AGE and INTERFACE_AGE to 0.

MAJOR_VERSION=1
MINOR_VERSION=0
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION

AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(MICRO_VERSION)
AC_SUBST(INTERFACE_AGE)
AC_SUBST(BINARY_AGE)
AC_SUBST(VERSION)

# libtool versioning
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
LT_REVISION=$INTERFACE_AGE
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`

AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Setup for automake
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(SDL_sound, $VERSION)


dnl ---------------------------------------------------------------------
dnl Compilers and other tools
dnl ---------------------------------------------------------------------

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LIBTOOL


dnl ---------------------------------------------------------------------
dnl Debug mode?
dnl ---------------------------------------------------------------------

AC_ARG_ENABLE(debug,
[  --enable-debug             enable debug mode [default=no]],
              , enable_debug=no)
if test x$enable_debug = xyes; then
  if test x$ac_cv_prog_cc_g = xyes; then
    CFLAGS="-g -O0"
  else
    CFLAGS="-O0"
  fi
  CFLAGS="$CFLAGS -Werror"
  AC_DEFINE(DEBUG)
  AC_DEFINE(DEBUG_CHATTER)
else
  AC_DEFINE(NDEBUG)
fi


dnl ---------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------

dnl Check for SDL
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,
            :,
 	     AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
)
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"

dnl Check for voc decoder inclusion...
AC_ARG_ENABLE(voc,
[  --enable-voc               enable VOC decoding [default=yes]],
              , enable_voc=yes)
if test x$enable_voc = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_VOC)
fi


dnl Check for wav decoder inclusion...
AC_ARG_ENABLE(wav,
[  --enable-wav               enable WAV decoding [default=yes]],
              , enable_wav=yes)
if test x$enable_wav = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_WAV)
fi


dnl Check for raw decoder inclusion...
AC_ARG_ENABLE(raw,
[  --enable-raw               enable raw audio "decoding" [default=yes]],
              , enable_raw=yes)
if test x$enable_raw = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_RAW)
fi


dnl Check for aiff decoder inclusion...
AC_ARG_ENABLE(aiff,
[  --enable-aiff              enable AIFF decoding [default=yes]],
              , enable_aiff=yes)
if test x$enable_aiff = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_AIFF)
fi

dnl Check for au decoder inclusion
AC_ARG_ENABLE(au,
[  --enable-au                enable AU decoding [default=yes]],
              , enable_au=yes)
if test x$enable_au = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_AU)
fi

dnl Check for shn decoder inclusion...
AC_ARG_ENABLE(shn,
[  --enable-shn               enable SHN decoding [default=yes]],
              , enable_shn=yes)
if test x$enable_shn = xyes; then
    AC_DEFINE(SOUND_SUPPORTS_SHN)
fi

dnl Check for the MIDI decoder...
AC_ARG_ENABLE(midi,
[  --enable-midi              enable software MIDI music [default=yes]],
              , enable_midi=yes)
if test x$enable_midi = xyes; then
  AC_DEFINE(SOUND_SUPPORTS_MIDI)
fi


dnl Note that we intentionally look for a symbol in FLAC 1.0.4, since the
dnl  FLAC developers tend to break their API with every release, so we're
dnl  checking for the latest-and-greatest here so we don't have to support
dnl  obsolete versions.

dnl Hooray for shitty autoconf bugs!
x="C__seekable_stream_decoder_process_single"
flcsym="FLA$x"
dnl Check for libFLAC
AC_ARG_ENABLE(flac,
[  --enable-flac              enable FLAC decoding via libFLAC [default=yes]],
              , enable_flac=yes)
if test x$enable_flac = xyes; then
  AC_CHECK_HEADER(FLAC/stream_decoder.h, have_flac_hdr=yes)
  AC_CHECK_LIB(FLAC, $flcsym, have_flac_lib=yes)
  if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
    LIBS="$LIBS -lFLAC"
    AC_DEFINE(SOUND_SUPPORTS_FLAC)
  fi
fi

dnl Check for SMPEG
AC_ARG_ENABLE(smpeg,
[  --enable-smpeg             enable MP3 decoding via smpeg [default=yes]],
              , enable_smpeg=yes)
if test x$enable_smpeg = xyes; then
  SMPEG_VERSION=0.4.3
  AM_PATH_SMPEG($SMPEG_VERSION, , no_smpeg=yes)
  if test "x$no_smpeg" = "x" ; then
    CFLAGS="$CFLAGS $SMPEG_CFLAGS"
    LIBS="$LIBS $SMPEG_LIBS"
    AC_DEFINE(SOUND_SUPPORTS_SMPEG)
  fi
fi

dnl Check for the MIDI decoder...
AC_ARG_ENABLE(mpglib,
[  --enable-mpglib            enable MP3 decoding internally [default=yes]],
              , enable_mpglib=yes)
if test x$enable_mpglib = xyes; then
  AC_DEFINE(SOUND_SUPPORTS_MPGLIB)
fi


dnl Check for libmikmod
AC_ARG_ENABLE(mikmod,
[  --enable-mikmod            enable MOD decoding via mikmod [default=yes]],
              , enable_mikmod=yes)
if test x$enable_mikmod = xyes; then
  AM_PATH_LIBMIKMOD
  if test "x$no_libmikmod" = "x" ; then
    CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
    LIBS="$LIBS $LIBMIKMOD_LIBS"
    LDADD="$LDADD $LIBMIKMOD_LDADD"
    AC_DEFINE(SOUND_SUPPORTS_MIKMOD)
  fi
fi

dnl Check for libmodplug
AC_ARG_ENABLE(modplug,
[  --enable-modplug           enable MOD decoding via modplug [default=yes]],
              , enable_modplug=yes)
if test x$enable_modplug = xyes; then
  AC_CHECK_HEADER(modplug.h, have_modplug_hdr=yes)
  AC_CHECK_LIB(modplug, ModPlug_Load, have_modplug_lib=yes)
  if test x$have_modplug_hdr = xyes -a x$have_modplug_lib = xyes; then
    LIBS="$LIBS -lmodplug"
    AC_DEFINE(SOUND_SUPPORTS_MODPLUG)
  fi
fi

dnl Check for ogg
AC_ARG_ENABLE(ogg,
[  --enable-ogg               enable OGG decoding via libvorbis [default=yes]],
              , enable_ogg=yes)
if test x$enable_ogg = xyes; then
  AM_PATH_VORBIS
  if test "x$no_vorbis" = "x" ; then
    CFLAGS="$CFLAGS $VORBIS_CFLAGS"
    LIBS="$LIBS $VORBIS_LIBS $VORBISFILE_LIBS $VORBISENC_LIBS"
    AC_DEFINE(SOUND_SUPPORTS_OGG)
  fi
fi

dnl Check for speex
AC_ARG_ENABLE(speex,
[  --enable-speex               enable SPX decoding via libspeex [default=yes]],
              , enable_speex=yes)
if test x$enable_speex = xyes; then
  AC_CHECK_HEADER(ogg/ogg.h, have_ogg_hdr=yes)
  AC_CHECK_LIB(ogg, ogg_sync_init, have_ogg_lib=yes)
  AC_CHECK_HEADER(speex.h, have_speex_hdr=yes)
  AC_CHECK_LIB(speex, speex_bits_init, have_speex_lib=yes)
  if test "x$have_ogg_hdr" = "xyes" -a "x$have_ogg_lib" = "xyes" -a "x$have_speex_hdr" = "xyes" -a "x$have_speex_lib" = "xyes"; then
    LIBS="$LIBS -logg -lspeex"
    AC_DEFINE(SOUND_SUPPORTS_SPEEX)
  fi
fi


dnl Check for PhysicsFS http://icculus.org/physfs/
AC_ARG_ENABLE(physfs,
[  --enable-physfs            enable PhysicsFS in playsound [default=yes]],
              , enable_physfs=yes)
if test x$enable_physfs = xyes; then
  AC_CHECK_HEADER(physfs.h, have_physfs_hdr=yes)
  AC_CHECK_LIB(physfs, PHYSFS_init, have_physfs_lib=yes)
  if test x$have_physfs_hdr = xyes -a x$have_physfs_lib = xyes; then
    enable_physfs="yes"
  else
    enable_physfs="no"
  fi
fi

dnl Check for PhysicsFS http://icculus.org/physfs/
AC_ARG_ENABLE(altcvt,
[  --enable-altcvt            enable EXPERIMENTAL audio converter [default=no]],
              , enable_altcvt=no)
if test x$enable_altcvt = xyes; then
  AC_DEFINE(SOUND_USE_ALTCVT)
fi


dnl Check for efence (!!! FIXME : This doesn't work.)
dnl AC_ARG_ENABLE(efence,
dnl [  --enable-efence            enable ElectricFence usage [default=no]],
dnl               , enable_efence=no)
dnl if test x$enable_efence = xyes; then
dnl   LIBS="$LIBS /usr/lib/libefence.a"
dnl fi

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h signal.h assert.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

# Checks for library functions.

# This is only in the bleeding edge autoconf distro...
#AC_FUNC_MALLOC


AC_FUNC_MEMCMP
AC_CHECK_FUNCS([memset strrchr setbuf])

dnl Add Makefile conditionals
AM_CONDITIONAL(USE_TIMIDITY, test x$enable_midi = xyes)
AM_CONDITIONAL(USE_MPGLIB, test x$enable_mpglib = xyes)
AM_CONDITIONAL(USE_PHYSICSFS, test x$enable_physfs = xyes)

AC_OUTPUT([
Makefile
decoders/Makefile
decoders/timidity/Makefile
decoders/mpglib/Makefile
playsound/Makefile
])