Skip to content
Snippets Groups Projects
Commit 195430dd authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #9779: dropped CELT support

parent c5ec9b7e
Branches
Tags
No related merge requests found
...@@ -193,37 +193,6 @@ AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp], [], [ ...@@ -193,37 +193,6 @@ AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp], [], [
AC_MSG_ERROR([Unable to find speexdsp development files]) AC_MSG_ERROR([Unable to find speexdsp development files])
]) ])
# check for libcelt
AC_ARG_WITH([celt], [AS_HELP_STRING([--without-celt],
[disable support for celt codec])], [], [with_celt=yes])
AS_IF([test "x$with_celt" != xno],
[PKG_CHECK_MODULES(CELT, celt >= 0.9.1,
[
with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1])
],
[
PKG_CHECK_MODULES(CELT, celt >= 0.7.1,
[
with_celt_71=yes; AC_MSG_NOTICE([Using celt 0.7.1])
],
[
dnl celt071 is how certain distros package celt
PKG_CHECK_MODULES(CELT, celt071 >= 0.7.1,
[
with_celt_071=yes; AC_MSG_NOTICE([Using celt071])
],
[
AC_MSG_FAILURE([libcelt link test failed. You may use --without-celt to compile without celt codec support.])
])
])
])]
)
AM_CONDITIONAL(BUILD_CELT_91, test "x$with_celt_91" = "xyes" )
AM_CONDITIONAL(BUILD_CELT_71, test "x$with_celt_71" = "xyes" )
AM_CONDITIONAL(BUILD_CELT_071, test "x$with_celt_071" = "xyes" )
dnl Check for IAX dnl Check for IAX
AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2], AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2],
[disable support for the iax2 protocol])], [], [with_iax2=yes]) [disable support for the iax2 protocol])], [], [with_iax2=yes])
......
...@@ -41,34 +41,7 @@ libcodec_speex_ub_so_LDADD = libcodecdescriptor.la ...@@ -41,34 +41,7 @@ libcodec_speex_ub_so_LDADD = libcodecdescriptor.la
INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so
endif endif
if BUILD_CELT_91 noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(SPEEX_UB_LIB)
CELT_LIB = libcodec_celt.so
libcodec_celt_so_SOURCES = celtcodec.cpp
libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_91
libcodec_celt_so_LDFLAGS = --shared -lc ${CELT_LIBS}
libcodec_celt_so_LDADD = libcodecdescriptor.la
INSTALL_CELT_RULE = install-libcodec_celt_so
endif
if BUILD_CELT_71
CELT_LIB = libcodec_celt.so
libcodec_celt_so_SOURCES = celtcodec.cpp
libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_71
libcodec_celt_so_LDFLAGS = --shared -lc ${CELT_LIBS}
libcodec_celt_so_LDADD = libcodecdescriptor.la
INSTALL_CELT_RULE = install-libcodec_celt_so
endif
if BUILD_CELT_071
CELT_LIB = libcodec_celt.so
libcodec_celt_so_SOURCES = celtcodec.cpp
libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_071 -I${top_srcdir}/src
libcodec_celt_so_LDFLAGS = --shared -lc ${CELT_LIBS}
libcodec_celt_so_LDADD = libcodecdescriptor.la
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_HEADERS = audiocodec.h audiocodecfactory.h speexcodec.h g722.h noinst_HEADERS = audiocodec.h audiocodecfactory.h speexcodec.h g722.h
...@@ -87,8 +60,8 @@ libcodec_g722_so_CXXFLAGS = -fPIC -g -Wall ...@@ -87,8 +60,8 @@ libcodec_g722_so_CXXFLAGS = -fPIC -g -Wall
libcodec_g722_so_LDADD = libcodecdescriptor.la libcodec_g722_so_LDADD = libcodecdescriptor.la
libcodec_g722_so_LDFLAGS = --shared -lc libcodec_g722_so_LDFLAGS = --shared -lc
install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_g722_so $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_SPEEX_UB_RULE) $(INSTALL_CELT_RULE) $(INSTALL_ILBC_RULE) install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_g722_so $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_SPEEX_UB_RULE) $(INSTALL_ILBC_RULE)
uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_g722_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so uninstall-libcodec_speex_ub_so uninstall-libcodec_celt_so uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_g722_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so uninstall-libcodec_speex_ub_so
install-libcodec_ulaw_so: libcodec_ulaw.so install-libcodec_ulaw_so: libcodec_ulaw.so
...@@ -112,9 +85,6 @@ install-libcodec_speex_wb_so: libcodec_speex_wb.so ...@@ -112,9 +85,6 @@ install-libcodec_speex_wb_so: libcodec_speex_wb.so
install-libcodec_speex_ub_so: libcodec_speex_ub.so install-libcodec_speex_ub_so: libcodec_speex_ub.so
mkdir -p $(sflcodecdir) mkdir -p $(sflcodecdir)
$(INSTALL_PROGRAM) libcodec_speex_ub.so $(sflcodecdir) $(INSTALL_PROGRAM) libcodec_speex_ub.so $(sflcodecdir)
install-libcodec_celt_so: libcodec_celt.so
mkdir -p $(sflcodecdir)
$(INSTALL_PROGRAM) libcodec_celt.so $(sflcodecdir)
uninstall-libcodec_ulaw_so: uninstall-libcodec_ulaw_so:
rm -f $(sflcodecdir)/libcodec_ulaw.so rm -f $(sflcodecdir)/libcodec_ulaw.so
...@@ -130,7 +100,4 @@ uninstall-libcodec_speex_wb_so: ...@@ -130,7 +100,4 @@ uninstall-libcodec_speex_wb_so:
rm -f $(sflcodecdir)/libcodec_speex_wb.so rm -f $(sflcodecdir)/libcodec_speex_wb.so
uninstall-libcodec_speex_ub_so: uninstall-libcodec_speex_ub_so:
rm -f $(sflcodecdir)/libcodec_speex_ub.so rm -f $(sflcodecdir)/libcodec_speex_ub.so
uninstall-libcodec_celt_so:
rm -f $(sflcodecdir)/libcodec_celt.so
rm -rf $(sflcodecdir)
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "audiocodec.h"
#include <cstdio>
#ifdef BUILD_CELT_071
// FIXME: Hack to workaround celt's insufficient pkg-config file
#include <celt071/celt.h>
#else
#include <celt/celt.h>
#endif
#include <stdexcept>
#include "noncopyable.h"
class Celt : public sfl::AudioCodec {
public:
Celt(int payload = 115) : sfl::AudioCodec(payload, "celt"), mode_(0), enc_(0), dec_(0) {
clockRate_ = 32000;
frameSize_ = 320; // fixed frameSize, TODO: support variable size from 64 to 512
channel_ = 1;
bitrate_ = 0;
hasDynamicPayload_ = true;
int error = 0;
mode_ = celt_mode_create(clockRate_, frameSize_, &error);
if (error != CELT_OK) {
switch (error) {
case CELT_BAD_ARG:
throw std::runtime_error("Celt: An (or more) invalid argument (e.g. out of range)\n");
break;
case CELT_INVALID_MODE:
throw std::runtime_error("Celt: The mode struct passed is invalid\n");
break;
case CELT_INTERNAL_ERROR:
throw std::runtime_error("Celt: An internal error was detected\n");
break;
case CELT_CORRUPTED_DATA:
throw std::runtime_error("Celt: The data passed (e.g. compressed data to decoder) is corrupted\n");
break;
case CELT_UNIMPLEMENTED:
throw std::runtime_error("Celt: Invalid/unsupported request numbe\n");
break;
case CELT_INVALID_STATE:
throw std::runtime_error("Celt: An encoder or decoder structure is invalid or already freed\n");
break;
case CELT_ALLOC_FAIL:
throw std::runtime_error("Celt: Memory allocation has failed\n");
break;
default:
throw std::runtime_error("Celt: Unknown error");
}
}
if (mode_ == NULL)
throw std::runtime_error("Celt: Failed to create Celt mode");
enc_ = celt_encoder_create(mode_, channel_, &error);
dec_ = celt_decoder_create(mode_, channel_, &error);
celt_encoder_ctl(enc_, CELT_SET_COMPLEXITY(2));
celt_decoder_ctl(dec_, CELT_SET_COMPLEXITY(2));
celt_encoder_ctl(enc_, CELT_SET_PREDICTION(2));
celt_decoder_ctl(dec_, CELT_SET_PREDICTION(2));
}
NON_COPYABLE(Celt);
~Celt() {
celt_encoder_destroy(enc_);
celt_decoder_destroy(dec_);
celt_mode_destroy(mode_);
}
virtual int decode(short *dst, unsigned char *src, size_t buf_size) {
#ifdef BUILD_CELT_91 // == 91
celt_decode(dec_, src, buf_size, (celt_int16*) dst, frameSize_);
#endif
#ifdef BUILD_CELT_71
celt_decode(dec_, src, buf_size, (celt_int16*) dst);
#endif
return frameSize_;
}
virtual int encode(unsigned char *dst, short *src, size_t buf_size) {
int len = 0;
#ifdef BUILD_CELT_91// == 91
len = celt_encode(enc_, (celt_int16*) src, frameSize_, dst, buf_size);
#endif
#ifdef BUILD_CELT_71
len = celt_encode(enc_, (celt_int16*) src, (celt_int16 *) src, dst, buf_size);
#endif
return len;
}
private:
CELTMode *mode_;
CELTEncoder *enc_;
CELTDecoder *dec_;
};
// the class factories
// cppcheck-suppress unusedFunction
extern "C" sfl::Codec* create()
{
return new Celt(115);
}
// cppcheck-suppress unusedFunction
extern "C" void destroy(sfl::Codec* a)
{
delete a;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment