Add CELT 0.11.0 support

This commit is contained in:
Benjamin Jemlich 2011-02-04 18:51:36 +01:00
parent cd52bf6423
commit 58aba64e55
7 changed files with 81 additions and 1 deletions

3
.gitmodules vendored
View File

@ -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/

1
celt-0.11.0-src Submodule

@ -0,0 +1 @@
Subproject commit 0b405d1170122c859faab435405666506d52fa2e

View File

@ -36,6 +36,9 @@
<Component Id="celt0.0.10.0.dll">
<File Source="$(var.SourceDir)\release\celt0.0.10.0.dll" KeyPath="yes" />
</Component>
<Component Id="celt0.0.11.0.dll">
<File Source="$(var.SourceDir)\release\celt0.0.11.0.dll" KeyPath="yes" />
</Component>
<Component Id="speex.dll">
<File Source="$(var.SourceDir)\release\speex.dll" KeyPath="yes" />
</Component>
@ -105,6 +108,9 @@
<Component Id="celt0.0.10.0.sse.dll">
<File Source="$(var.SourceDir)\release\celt0.0.10.0.sse.dll" KeyPath="yes" />
</Component>
<Component Id="celt0.0.11.0.sse.dll">
<File Source="$(var.SourceDir)\release\celt0.0.11.0.sse.dll" KeyPath="yes" />
</Component>
<?endif ?>
<?ifdef SSE2 ?>
@ -114,6 +120,9 @@
<Component Id="celt0.0.10.0.sse2.dll">
<File Source="$(var.SourceDir)\release\celt0.0.10.0.sse2.dll" KeyPath="yes" />
</Component>
<Component Id="celt0.0.11.0.sse2.dll">
<File Source="$(var.SourceDir)\release\celt0.0.11.0.sse2.dll" KeyPath="yes" />
</Component>
<?endif ?>
<?ifdef ProtoBufDir ?>

View File

@ -141,13 +141,16 @@
<ComponentGroupRef Id="Plugins"/>
<ComponentRef Id="celt0.0.7.0.dll" />
<ComponentRef Id="celt0.0.10.0.dll" />
<ComponentRef Id="celt0.0.11.0.dll" />
<?ifdef SSE ?>
<ComponentRef Id="celt0.0.7.0.sse.dll" />
<ComponentRef Id="celt0.0.10.0.sse.dll" />
<ComponentRef Id="celt0.0.11.0.sse.dll" />
<?endif ?>
<?ifdef SSE2 ?>
<ComponentRef Id="celt0.0.7.0.sse2.dll" />
<ComponentRef Id="celt0.0.10.0.sse2.dll" />
<ComponentRef Id="celt0.0.11.0.sse2.dll" />
<?endif ?>
<ComponentRef Id="mumble.exe" />
<ComponentRef Id="mumble_ol.dll" />

View File

@ -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

View File

@ -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;

View File

@ -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)