Skip to content
Snippets Groups Projects
Commit 2a966ae9 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#5267] Autodetect celt version (0.9.1, 0.7.1)

parent f288fde9
No related branches found
No related tags found
No related merge requests found
...@@ -389,16 +389,17 @@ AC_ARG_WITH([celt], ...@@ -389,16 +389,17 @@ AC_ARG_WITH([celt],
AS_IF([test "x$with_celt" != xno], AS_IF([test "x$with_celt" != xno],
PKG_CHECK_MODULES(CELT, celt >= 0.9.1, PKG_CHECK_MODULES(CELT, celt >= 0.9.1,
[ [
BUILD_CELT=91 ; with_celt=yes with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1]); AC_SUBST(BUILD_CELT_91)
], ],
[ [
PKG_CHECK_MODULES(CELT, celt >= 0.7.1,,AC_MSG_FAILURE([libcelt link test failed. You may use --without-celt to compile without celt codec support.])) PKG_CHECK_MODULES(CELT, celt >= 0.7.1, [with_celt_71=yes; AC_MSG_NOTICE([Using celt 0.7.1]); AC_SUBST(BUILD_CELT_71)], AC_MSG_FAILURE([libcelt link test failed. You may use --without-celt to compile without celt codec support.]))
BUILD_CELT=71; with_celt=yes;
]) ])
) )
AC_SUBST(BUILD_CELT) # AC_SUBST(BUILD_CELT)
AM_CONDITIONAL(BUILD_CELT, test "x$with_celt" = "xyes" ) # AM_CONDITIONAL(BUILD_CELT, test "x$with_celt" = "xyes" )
AM_CONDITIONAL(BUILD_CELT_91, test "x$with_celt_91" = "xyes" )
AM_CONDITIONAL(BUILD_CELT_71, test "x$with_celt_71" = "xyes" )
dnl Check for IAX dnl Check for IAX
......
...@@ -40,15 +40,23 @@ libcodec_speex_ub_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_NIMP) ...@@ -40,15 +40,23 @@ libcodec_speex_ub_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_NIMP)
INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so
endif endif
if BUILD_CELT if BUILD_CELT_91
CELT_LIB = libcodec_celt.so CELT_LIB = libcodec_celt.so
libcodec_celt_so_SOURCES = celtcodec.cpp libcodec_celt_so_SOURCES = celtcodec.cpp
libcodec_celt_so_CFLAGS = -fPIC -g -Wall -D$(BUILD_CELT) libcodec_celt_so_CFLAGS = -fPIC -g -Wall -DBUILD_CELT_91
libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_91
libcodec_celt_so_LDFLAGS = --shared -lc -lcelt0 $(CELT_NIMP) libcodec_celt_so_LDFLAGS = --shared -lc -lcelt0 $(CELT_NIMP)
INSTALL_CELT_RULE = install-libcodec_celt_so INSTALL_CELT_RULE = install-libcodec_celt_so
endif endif
if BUILD_CELT_71
CELT_LIB = libcodec_celt.so
libcodec_celt_so_SOURCES = celtcodec.cpp
libcodec_celt_so_CFLAGS = -fPIC -g -Wall -DBUILD_CELT_71
libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_71
libcodec_celt_so_LDFLAGS = --shared -lc -lcelt0 $(CELT_NIMP)
INSTALL_CELT_RULE = install-libcodec_celt_so
endif
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(SPEEX_UB_LIB) $(CELT_LIB) noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(SPEEX_UB_LIB) $(CELT_LIB)
......
...@@ -126,10 +126,12 @@ class Celt : public AudioCodec ...@@ -126,10 +126,12 @@ class Celt : public AudioCodec
} }
virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) { virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) {
#ifdef BUILD_CELT_91 // == 91
int err = 0; int err = 0;
#if BUILD_CELT == 91
err = celt_decode (_dec, src, size, (celt_int16*) dst, size); err = celt_decode (_dec, src, size, (celt_int16*) dst, size);
#else #endif
#ifdef BUILD_CELT_71
int err = 0;
err = celt_decode (_dec, src, size, (celt_int16*) dst); err = celt_decode (_dec, src, size, (celt_int16*) dst);
#endif #endif
return _frameSize * sizeof (celt_int16); return _frameSize * sizeof (celt_int16);
...@@ -137,9 +139,10 @@ class Celt : public AudioCodec ...@@ -137,9 +139,10 @@ class Celt : public AudioCodec
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) { virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
int len = 0; int len = 0;
#if BUILD_CELT == 91 #ifdef BUILD_CELT_91// == 91
len = celt_encode (_enc, (celt_int16*) src, size, dst, 40); len = celt_encode (_enc, (celt_int16*) src, size, dst, 40);
#else #endif
#ifdef BUILD_CELT_71
len = celt_encode (_enc, (celt_int16*) src, (celt_int16 *) src, dst, 40); len = celt_encode (_enc, (celt_int16*) src, (celt_int16 *) src, dst, 40);
#endif #endif
// returns the number of bytes writen // returns the number of bytes writen
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment