diff --git a/.gitmodules b/.gitmodules index 44de238a7..cc546d800 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "celt-0.10.0-src"] path = celt-0.10.0-src url = git://git.xiph.org/celt.git/ +[submodule "celt-0.11.0-src"] + path = celt-0.11.0-src + url = git://git.xiph.org/celt.git/ diff --git a/celt-0.11.0-src b/celt-0.11.0-src new file mode 160000 index 000000000..0b405d117 --- /dev/null +++ b/celt-0.11.0-src @@ -0,0 +1 @@ +Subproject commit 0b405d1170122c859faab435405666506d52fa2e diff --git a/installer/Files.wxs b/installer/Files.wxs index eaf77a495..e08cfa92b 100644 --- a/installer/Files.wxs +++ b/installer/Files.wxs @@ -36,6 +36,9 @@ + + + @@ -105,6 +108,9 @@ + + + @@ -114,6 +120,9 @@ + + + diff --git a/installer/Product.wxs b/installer/Product.wxs index 5b414dfa3..7891f56b1 100644 --- a/installer/Product.wxs +++ b/installer/Product.wxs @@ -141,13 +141,16 @@ + + + diff --git a/main.pro b/main.pro index ab7b02bc4..54968984b 100644 --- a/main.pro +++ b/main.pro @@ -12,7 +12,7 @@ CONFIG *= ordered debug_and_release SUBDIRS *= speexbuild } !CONFIG(no-bundled-celt) { - SUBDIRS *= celt-0.7.0-build celt-0.10.0-build + SUBDIRS *= celt-0.7.0-build celt-0.10.0-build celt-0.11.0-build } !CONFIG(no-11x) { SUBDIRS *= src/mumble11x diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp index 6fb947631..63785e15b 100644 --- a/src/mumble/Audio.cpp +++ b/src/mumble/Audio.cpp @@ -87,6 +87,21 @@ void CodecInit::initialize() { delete codec; } } + + codec = new CELTCodec011(QLatin1String("0.11.0")); + if (codec->isValid()) { + codec->report(); + g.qmCodecs.insert(codec->bitstreamVersion(), codec); + } else { + delete codec; + codec = new CELTCodec011(QLatin1String("2.0.0")); + if (codec->isValid()) { + codec->report(); + g.qmCodecs.insert(codec->bitstreamVersion(), codec); + } else { + delete codec; + } + } } void CodecInit::destroy() { @@ -262,6 +277,37 @@ int CELTCodec080::decode_float(CELTDecoder *st, const unsigned char *data, int l return celt_decode_float(st, data, len, pcm, SAMPLE_RATE / 100); } +CELTCodec011::CELTCodec011(const QString &version) : CELTCodec(version) { + RESOLVE(celt_mode_create); + RESOLVE(celt_encoder_create_custom); + RESOLVE(celt_decoder_create_custom); + RESOLVE(celt_encode_float); + RESOLVE(celt_encode); + RESOLVE(celt_decode_float); + RESOLVE(celt_decode); + RESOLVE(celt_strerror); + + if (bValid) { + cmMode = celt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, NULL); + } +} + +CELTEncoder *CELTCodec011::encoderCreate() { + return celt_encoder_create_custom(cmMode, 1, NULL); +} + +CELTDecoder *CELTCodec011::decoderCreate() { + return celt_decoder_create_custom(cmMode, 1, NULL); +} + +int CELTCodec011::encode(CELTEncoder *st, const celt_int16 *pcm, unsigned char *compressed, int nbCompressedBytes) { + return celt_encode(st, pcm, SAMPLE_RATE / 100, compressed, nbCompressedBytes); +} + +int CELTCodec011::decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm) { + return celt_decode_float(st, data, len, pcm, SAMPLE_RATE / 100); +} + LoopUser::LoopUser() { qsName = QLatin1String("Loopy"); uiSession = 0; diff --git a/src/mumble/Audio.h b/src/mumble/Audio.h index b9cae0fe2..97ea01a4d 100644 --- a/src/mumble/Audio.h +++ b/src/mumble/Audio.h @@ -108,6 +108,24 @@ class CELTCodec080 : public CELTCodec { virtual int decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm); }; +class CELTCodec011 : public CELTCodec { + protected: + CELTMode *(*celt_mode_create)(celt_int32 Fs, int frame_size, int *error); + CELTEncoder *(__cdecl *celt_encoder_create_custom)(const CELTMode *mode, int channels, int *error); + CELTDecoder *(__cdecl *celt_decoder_create_custom)(const CELTMode *mode, int channels, int *error); + int (__cdecl *celt_encode_float)(CELTEncoder *st, const float *pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes); + int (__cdecl *celt_encode)(CELTEncoder *st, const celt_int16 *pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes); + int (__cdecl *celt_decode_float)(CELTDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size); + int (__cdecl *celt_decode)(CELTDecoder *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size); + const char *(__cdecl *celt_strerror)(int error); + public: + CELTCodec011(const QString &version); + virtual CELTEncoder *encoderCreate(); + virtual CELTDecoder *decoderCreate(); + virtual int encode(CELTEncoder *st, const celt_int16 *pcm, unsigned char *compressed, int nbCompressedBytes); + virtual int decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm); +}; + class LoopUser : public ClientUser { private: Q_DISABLE_COPY(LoopUser)