Commit 95183f0f authored by conrad's avatar conrad
Browse files

Backport changeset:329 from branches/pcm-types:

add support for new speex_lib_get_mode() function in libspeex svn (1.1.7)

This conditionally uses speex_lib_get_mode() if available, rather than the
static mode definitions. For ticket:419



git-svn-id: http://svn.annodex.net/libfishsound/trunk@3732 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent caa36747
......@@ -39,6 +39,9 @@
/* Define to 1 if you have libspeex 1.1.x */
#undef HAVE_SPEEX_1_1
/* Define to 1 if speex_lib_get_mode() exists in libspeex */
#undef HAVE_SPEEX_LIB_GET_MODE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......
......@@ -222,6 +222,18 @@ if test "x${ac_enable_speex}" = xyes ; then
if test "x$HAVE_SPEEX_1_1" = xyes ; then
AC_DEFINE(HAVE_SPEEX_1_1, [1], [Define to 1 if you have libspeex 1.1.x])
SPEEX_SUPPORT="yes (1.1.x)"
dnl Test for speex_lib_get_mode() in libspeex 1.1
AC_CHECK_LIB(speex, speex_lib_get_mode, HAVE_SPEEX_LIB_GET_MODE="yes",
HAVE_SPEEX_LIB_GET_MODE="no", [$SPEEX_LIBS])
if test "x$HAVE_SPEEX_LIB_GET_MODE" = xyes ; then
AC_DEFINE(HAVE_SPEEX_LIB_GET_MODE, [1],
[Define to 1 if speex_lib_get_mode() exists in libspeex])
else
AC_DEFINE(HAVE_SPEEX_LIB_GET_MODE, [0],
[Define to 1 if speex_lib_get_mode() exists in libspeex])
fi
else
AC_DEFINE(HAVE_SPEEX_1_1, [0], [Define to 1 if you have libspeex 1.1.x])
SPEEX_SUPPORT="yes (1.0.x)"
......
......@@ -148,8 +148,13 @@ process_header(unsigned char * buf, long bytes, int enh_enabled,
modeID = header->mode;
if (forceMode!=-1)
modeID = forceMode;
#if HAVE_SPEEX_LIB_GET_MODE
mode = (SpeexMode *) speex_lib_get_mode (modeID);
#else
/* speex_mode_list[] is declared const in speex 1.1.x, hence the cast */
mode = (SpeexMode *)speex_mode_list[modeID];
#endif
if (header->speex_version_id > 1) {
/*
......@@ -363,15 +368,21 @@ static FishSound *
fs_speex_enc_headers (FishSound * fsound)
{
FishSoundSpeexInfo * fss = (FishSoundSpeexInfo *)fsound->codec_data;
int modeID;
SpeexMode * mode = NULL;
SpeexHeader header;
unsigned char * buf;
int bytes;
size_t buflen;
/* XXX: set wb, nb, uwb modes */
/* These modes are declared const in speex 1.1.x, hence the explicit cast */
mode = (SpeexMode *)&speex_wb_mode;
modeID = 1;
#if HAVE_SPEEX_LIB_GET_MODE
mode = (SpeexMode *) speex_lib_get_mode (modeID);
#else
/* speex_mode_list[] is declared const in speex 1.1.x, hence the cast */
mode = (SpeexMode *)speex_mode_list[modeID];
#endif
speex_init_header (&header, fsound->info.samplerate, 1, mode);
header.frames_per_packet = fss->nframes; /* XXX: frames per packet */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment