summaryrefslogtreecommitdiff
path: root/codecs/codec_speex.c
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-02-22 23:04:49 +0000
committerDavid Vossel <dvossel@digium.com>2011-02-22 23:04:49 +0000
commitd760e81f37b231a99865a40f67838c51079ed4f8 (patch)
treeb061487de973558358757bd1b6e457aaccf41638 /codecs/codec_speex.c
parent736133f874f270be81810c2c1fb36c47e6a479bf (diff)
Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd audio ConfBridge, and other stuff
-Functional changes 1. Dynamic global format list build by codecs defined in codecs.conf 2. SILK 8khz, 12khz, 16khz, and 24khz with custom attributes defined in codecs.conf 3. Negotiation of SILK attributes in chan_sip. 4. SPEEX 32khz with translation 5. SLINEAR 8khz, 12khz, 24khz, 32khz, 44.1khz, 48khz, 96khz, 192khz with translation using codec_resample.c 6. Various changes to RTP code required to properly handle the dynamic format list and formats with attributes. 7. ConfBridge now dynamically jumps to the best possible sample rate. This allows for conferences to take advantage of HD audio (Which sounds awesome) 8. Audiohooks are no longer limited to 8khz audio, and most effects have been updated to take advantage of this such as Volume, DENOISE, PITCH_SHIFT. 9. codec_resample now uses its own code rather than depending on libresample. -Organizational changes Global format list is moved from frame.c to format.c Various format specific functions moved from frame.c to format.c Review: https://reviewboard.asterisk.org/r/1104/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs/codec_speex.c')
-rw-r--r--codecs/codec_speex.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index aaaa1bea2..d48e21f28 100644
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -148,6 +148,11 @@ static int lin16tospeexwb_new(struct ast_trans_pvt *pvt)
return speex_encoder_construct(pvt, &speex_wb_mode, 16000);
}
+static int lin32tospeexuwb_new(struct ast_trans_pvt *pvt)
+{
+ return speex_encoder_construct(pvt, &speex_uwb_mode, 32000);
+}
+
static int speex_decoder_construct(struct ast_trans_pvt *pvt, const SpeexMode *profile)
{
struct speex_coder_pvt *tmp = pvt->pvt;
@@ -173,6 +178,11 @@ static int speexwbtolin16_new(struct ast_trans_pvt *pvt)
return speex_decoder_construct(pvt, &speex_wb_mode);
}
+static int speexuwbtolin32_new(struct ast_trans_pvt *pvt)
+{
+ return speex_decoder_construct(pvt, &speex_uwb_mode);
+}
+
/*! \brief convert and store into outbuf */
static int speextolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
@@ -376,6 +386,28 @@ static struct ast_translator lin16tospeexwb = {
.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
};
+static struct ast_translator speexuwbtolin32 = {
+ .name = "speexuwbtolin32",
+ .newpvt = speexuwbtolin32_new,
+ .framein = speextolin_framein,
+ .destroy = speextolin_destroy,
+ .desc_size = sizeof(struct speex_coder_pvt),
+ .buffer_samples = BUFFER_SAMPLES,
+ .buf_size = BUFFER_SAMPLES * 2,
+ .native_plc = 1,
+};
+
+static struct ast_translator lin32tospeexuwb = {
+ .name = "lin32tospeexuwb",
+ .newpvt = lin32tospeexuwb_new,
+ .framein = lintospeex_framein,
+ .frameout = lintospeex_frameout,
+ .destroy = lintospeex_destroy,
+ .desc_size = sizeof(struct speex_coder_pvt),
+ .buffer_samples = BUFFER_SAMPLES,
+ .buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
+};
+
static int parse_config(int reload)
{
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
@@ -486,6 +518,9 @@ static int unload_module(void)
res |= ast_unregister_translator(&lintospeex);
res |= ast_unregister_translator(&speexwbtolin16);
res |= ast_unregister_translator(&lin16tospeexwb);
+ res |= ast_unregister_translator(&speexuwbtolin32);
+ res |= ast_unregister_translator(&lin32tospeexuwb);
+
return res;
}
@@ -510,10 +545,19 @@ static int load_module(void)
ast_format_set(&lin16tospeexwb.src_format, AST_FORMAT_SLINEAR16, 0);
ast_format_set(&lin16tospeexwb.dst_format, AST_FORMAT_SPEEX16, 0);
+ ast_format_set(&speexuwbtolin32.src_format, AST_FORMAT_SPEEX32, 0);
+ ast_format_set(&speexuwbtolin32.dst_format, AST_FORMAT_SLINEAR32, 0);
+
+ ast_format_set(&lin32tospeexuwb.src_format, AST_FORMAT_SLINEAR32, 0);
+ ast_format_set(&lin32tospeexuwb.dst_format, AST_FORMAT_SPEEX32, 0);
+
res |= ast_register_translator(&speextolin);
res |= ast_register_translator(&lintospeex);
res |= ast_register_translator(&speexwbtolin16);
res |= ast_register_translator(&lin16tospeexwb);
+ res |= ast_register_translator(&speexuwbtolin32);
+ res |= ast_register_translator(&lin32tospeexuwb);
+
return res;
}