diff options
Diffstat (limited to 'codecs/codec_speex.c')
-rw-r--r-- | codecs/codec_speex.c | 44 |
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; } |