AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
AC_ARG_ENABLE(werror,
- AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles]))
+ AC_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles]))
AC_ARG_ENABLE(stack-smash-protection,
- AS_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
+ AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
AC_ARG_ENABLE(gcc-pipe,
- AS_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
+ AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
AC_ARG_ENABLE(gcc-opt,
- AS_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
+ AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
AC_ARG_ENABLE(cpu-clip,
- AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
+ AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
AC_ARG_ENABLE(bow-docs,
- AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
+ AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
AC_ARG_ENABLE(sqlite,
- AS_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
+ AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
AC_ARG_ENABLE(alsa,
- AS_HELP_STRING([--disable-alsa], [disable use of ALSA]))
+ AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
AC_ARG_ENABLE(external-libs,
- AC_HELP_STRING([--disable-external-libs], [disable use of Ogg and Vorbis [[default=no]]]))
- AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]]))
++ AC_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]]))
AC_ARG_ENABLE(octave,
- AS_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
-
-AC_ARG_ENABLE([full-suite],
- AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]]))
-AM_CONDITIONAL([FULL_SUITE], [test "x$enable_full_suite" != "xno"])
+ AC_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
AC_ARG_ENABLE(test-coverage,
- AS_HELP_STRING([--enable-test-coverage], [enable test coverage]))
+ AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
#====================================================================================
fi
#====================================================================================
- # Check for Ogg, Vorbis.
+ # Check for Ogg, Vorbis and FLAC.
-HAVE_EXTERNAL_XIPH_LIBS=0
-EXTERNAL_XIPH_CFLAGS=""
-EXTERNAL_XIPH_LIBS=""
+HAVE_EXTERNAL_LIBS=0
+EXTERNAL_CFLAGS=""
+EXTERNAL_LIBS=""
# Check for pkg-config outside the if statement.
PKG_PROG_PKG_CONFIG
enable_external_libs=yes
fi
- if test x$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyes" ; then
+ if test x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyesyes" ; then
- HAVE_EXTERNAL_XIPH_LIBS=1
+ HAVE_EXTERNAL_LIBS=1
enable_external_libs=yes
- EXTERNAL_CFLAGS="$OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS"
- EXTERNAL_LIBS="$OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS "
- EXTERNAL_XIPH_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS"
- EXTERNAL_XIPH_LIBS="$FLAC_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS "
++ EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS"
++ EXTERNAL_LIBS="$FLAC_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS "
else
echo
- AC_MSG_WARN([[*** One or more of the external libraries (ie libogg and]])
+ AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg and]])
AC_MSG_WARN([[*** libvorbis) is either missing (possibly only the development]])
AC_MSG_WARN([[*** headers) or is of an unsupported version.]])
AC_MSG_WARN([[***]])
fi
fi
- AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if ogg and vorbis are available.])
-AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], $HAVE_EXTERNAL_XIPH_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
++AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
#====================================================================================
# Check for libsqlite3 (only used in regtest).
#include "sndfile.h"
#include "common.h"
- #if 0 /* HAVE_EXTERNAL_LIBS : Disable for TIZEN */
-#if HAVE_EXTERNAL_XIPH_LIBS
++#if HAVE_EXTERNAL_LIBS
#include <FLAC/stream_decoder.h>
#include <FLAC/stream_encoder.h>
unsigned bufferpos ;
const FLAC__Frame *frame ;
++ FLAC__bool bufferbackup ;
unsigned compression ;
--
} FLAC_PRIVATE ;
typedef struct
return 0 ;
} ;
- if (frame->header.channels > FLAC__MAX_CHANNELS)
- psf_log_printf (psf, "Ooops : frame->header.channels (%d) > FLAC__MAX_BLOCK_SIZE (%d)\n", __func__, __LINE__, frame->header.channels, FLAC__MAX_CHANNELS) ;
-
- channels = SF_MIN (frame->header.channels, FLAC__MAX_CHANNELS) ;
-
if (pflac->ptr == NULL)
{ /*
-- ** This pointer is reset to NULL each time the current frame has been
-- ** decoded. Somehow its used during encoding and decoding.
++ ** Not sure why this code is here and not elsewhere.
++ ** Removing it causes valgrind errors.
*/
- for (i = 0 ; i < channels ; i++)
++ pflac->bufferbackup = SF_TRUE ;
+ for (i = 0 ; i < frame->header.channels ; i++)
{
if (pflac->rbuffer [i] == NULL)
- pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (int32_t)) ;
+ pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (FLAC__int32)) ;
- memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (int32_t)) ;
+ memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ;
} ;
- pflac->wbuffer = (const int32_t* const*) pflac->rbuffer ;
-
- return 0 ;
- } ;
-
-
- len = SF_MIN (pflac->len, frame->header.blocksize) ;
+ pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ;
- if (pflac->remain % channels != 0)
- { psf_log_printf (psf, "Error: pflac->remain %u channels %u\n", pflac->remain, channels) ;
return 0 ;
} ;
pflac->frame = frame ;
pflac->bufferpos = 0 ;
++ pflac->bufferbackup = SF_FALSE ;
pflac->wbuffer = buffer ;
flac_buffer_copy (psf) ;
static unsigned
flac_read_loop (SF_PRIVATE *psf, unsigned len)
{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
-- FLAC__StreamDecoderState state ;
pflac->pos = 0 ;
pflac->len = len ;
pflac->remain = len ;
--
-- state = FLAC__stream_decoder_get_state (pflac->fsd) ;
-- if (state > FLAC__STREAM_DECODER_END_OF_STREAM)
-- { psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ;
-- /* Current frame is busted, so NULL the pointer. */
-- pflac->frame = NULL ;
-- } ;
--
-- /* First copy data that has already been decoded and buffered. */
if (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize)
flac_buffer_copy (psf) ;
while (pflac->pos < pflac->len)
{ if (FLAC__stream_decoder_process_single (pflac->fsd) == 0)
break ;
-- state = FLAC__stream_decoder_get_state (pflac->fsd) ;
-- if (state >= FLAC__STREAM_DECODER_END_OF_STREAM)
-- { psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ;
-- /* Current frame is busted, so NULL the pointer. */
-- pflac->frame = NULL ;
++ if (FLAC__stream_decoder_get_state (pflac->fsd) >= FLAC__STREAM_DECODER_END_OF_STREAM)
break ;
-- } ;
} ;
pflac->ptr = NULL ;