ref: e5ec5718b28a6cb0101a67d79b5fc9e6c89217f9
parent: 0a60ae593cc8a64bb3d6a6c5f0f5df684f64a993
author: Mans Rullgard <mans@mansr.com>
date: Thu Aug 13 10:26:00 EDT 2020
gsm: use separate variable names for library and format handler Use LIBGSM when referring to the library and GSM for the format handler.
--- a/configure.ac
+++ b/configure.ac
@@ -400,10 +400,13 @@
fi
# Check for libgsm
-found_libgsm=yes
+HAVE_LIBGSM=yes
AC_CHECK_HEADERS(gsm/gsm.h, ,
- [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
- AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
+ [AC_CHECK_HEADERS(gsm.h, , HAVE_LIBGSM=no)])
+ AC_CHECK_LIB(gsm, gsm_create, [
+ AC_DEFINE(HAVE_LIBGSM, 1, [Define if libgsm is available])
+ LIBGSM_LIBS="$LIBGSM_LIBS -lgsm"], HAVE_LIBGSM=no)
+AC_SUBST(LIBGSM_LIBS)
@@ -559,7 +562,7 @@
# GSM format depends on libgsm
-AC_OPTIONAL_FORMAT(gsm, GSM, [using_gsm=$found_libgsm])
+AC_OPTIONAL_FORMAT(gsm, GSM, [using_gsm=$HAVE_LIBGSM])
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,6 +83,9 @@
if HAVE_MAGIC
libsox_la_LIBADD += @MAGIC_LIBS@
endif
+if HAVE_LIBGSM
+libsox_la_LIBADD += @LIBGSM_LIBS@
+endif
libsox_la_CFLAGS =
libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \
--- a/src/optional-fmts.am
+++ b/src/optional-fmts.am
@@ -94,13 +94,13 @@
if STATIC_GSM
libsox_la_SOURCES += gsm.c
if STATIC_LIBSOX_ONLY
- sox_LDADD += @GSM_LIBS@
+ sox_LDADD += @LIBGSM_LIBS@
else
- libsox_la_LIBADD += @GSM_LIBS@
+ libsox_la_LIBADD += @LIBGSM_LIBS@
endif
else
libsox_fmt_gsm_la_SOURCES = gsm.c
- libsox_fmt_gsm_la_LIBADD = libsox.la @GSM_LIBS@
+ libsox_fmt_gsm_la_LIBADD = libsox.la @LIBGSM_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_gsm.la
endif
endif
--- a/src/wav.c
+++ b/src/wav.c
@@ -19,7 +19,7 @@
#include "ima_rw.h"
#include "adpcm.h"
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
#ifdef HAVE_GSM_GSM_H
#include <gsm/gsm.h>
#else
@@ -108,7 +108,7 @@
unsigned short blockSamplesRemaining;/* Samples remaining per channel */
int state[16]; /* step-size info for *ADPCM writes */
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
/* following used by GSM 6.10 wav */
gsm gsmhandle;
gsm_signal *gsmsample;
@@ -343,7 +343,7 @@
return (SOX_SUCCESS);
}
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
/****************************************************************************/
/* WAV GSM6.10 support functions */
/****************************************************************************/
@@ -518,7 +518,7 @@
wavgsmdestroy(ft);
}
-#endif /* HAVE_GSM */
+#endif /* HAVE_LIBGSM */
/****************************************************************************/
/* General Sox WAV file code */
@@ -577,7 +577,7 @@
{ WAVE_FORMAT_AUDIOFILE_AF10, "Audio File AF10" },
{ WAVE_FORMAT_DOLBY_AC2, "Dolby AC-2" },
{ WAVE_FORMAT_GSM610, "GSM 6.10",
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
SOX_ENCODING_GSM,
wav_gsm_fmt,
#endif
@@ -955,7 +955,7 @@
lsx_ima_init_table();
break;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case WAVE_FORMAT_GSM610:
wav->numSamples = qwDataLength / wav->blockAlign * wav->samplesPerBlock;
wavgsminit(ft);
@@ -1043,7 +1043,7 @@
return done;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case SOX_ENCODING_GSM:
done = wavgsmread(ft, buf, len);
break;
@@ -1087,7 +1087,7 @@
switch (ft->encoding.encoding)
{
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case SOX_ENCODING_GSM:
wavgsmdestroy(ft);
break;
@@ -1147,7 +1147,7 @@
wav->samplePtr = wav->samples;
break;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case WAVE_FORMAT_GSM610:
return wavgsminit(ft);
#endif
@@ -1306,7 +1306,7 @@
wExtSize = 4+4*7; /* Ext fmt data length */
wSamplesPerBlock = lsx_ms_adpcm_samples_in((size_t) 0, (size_t) wChannels, (size_t) wBlockAlign, (size_t) 0);
break;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case SOX_ENCODING_GSM:
if (wChannels!=1)
{
@@ -1474,7 +1474,7 @@
lsx_debug("Finished writing Wave file, %"PRIu64" data bytes %"PRIu64" samples",
dwDataLength, wav->numSamples);
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
if (wFormatTag == WAVE_FORMAT_GSM610){
lsx_debug("GSM6.10 format: %"PRIu64" blocks %"PRIu64" padded samples %"PRIu64" padded data bytes",
blocksWritten, dwSamplesWritten, dwDataLength);
@@ -1516,7 +1516,7 @@
return total_len - len;
break;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case WAVE_FORMAT_GSM610:
len = wavgsmwrite(ft, buf, len);
wav->numSamples += (len/ft->signal.channels);
@@ -1545,7 +1545,7 @@
case WAVE_FORMAT_ADPCM:
xxxAdpcmWriteBlock(ft);
break;
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
case WAVE_FORMAT_GSM610:
wavgsmstopwrite(ft);
break;
@@ -1633,7 +1633,7 @@
SOX_ENCODING_UNSIGNED, 8, 0,
SOX_ENCODING_ULAW, 8, 0,
SOX_ENCODING_ALAW, 8, 0,
-#ifdef HAVE_GSM
+#ifdef HAVE_LIBGSM
SOX_ENCODING_GSM, 0,
#endif
SOX_ENCODING_MS_ADPCM, 4, 0,