2002-08-30 00:34:24 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2002-08-30 00:34:24 +00:00
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2002-08-30 00:34:24 +00:00
|
|
|
*
|
|
|
|
* Mark Spencer <markster@digium.com>
|
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-26 13:03:17 +00:00
|
|
|
/*! \file
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-10-26 13:03:17 +00:00
|
|
|
* \brief Translate between signed linear and Speex (Open Codec)
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-10-26 13:03:17 +00:00
|
|
|
* \note This work was motivated by Jeremy McNamara
|
|
|
|
* hacked to be configurable by anthm and bkw 9/28/2004
|
2007-02-24 19:27:50 +00:00
|
|
|
*
|
2005-11-06 15:09:47 +00:00
|
|
|
* \ingroup codecs
|
2007-02-24 19:27:50 +00:00
|
|
|
*
|
|
|
|
* \extref The Speex library - http://www.speex.org
|
|
|
|
*
|
2002-08-30 00:34:24 +00:00
|
|
|
*/
|
|
|
|
|
2006-04-24 17:11:45 +00:00
|
|
|
/*** MODULEINFO
|
2006-07-05 20:12:29 +00:00
|
|
|
<depend>speex</depend>
|
2008-05-05 22:13:57 +00:00
|
|
|
<depend>speex_preprocess</depend>
|
2011-07-05 22:11:40 +00:00
|
|
|
<use type="external">speexdsp</use>
|
2011-07-14 20:28:54 +00:00
|
|
|
<support_level>core</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
***/
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
|
2006-04-24 17:11:45 +00:00
|
|
|
#include <speex/speex.h>
|
2005-06-06 22:12:19 +00:00
|
|
|
|
2005-08-26 20:14:06 +00:00
|
|
|
/* We require a post 1.1.8 version of Speex to enable preprocessing
|
|
|
|
and better type handling */
|
|
|
|
#ifdef _SPEEX_TYPES_H
|
|
|
|
#include <speex/speex_preprocess.h>
|
|
|
|
#endif
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include "asterisk/translate.h"
|
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/config.h"
|
|
|
|
#include "asterisk/utils.h"
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
/* codec variables */
|
2005-08-26 20:14:06 +00:00
|
|
|
static int quality = 3;
|
2004-10-01 03:18:48 +00:00
|
|
|
static int complexity = 2;
|
|
|
|
static int enhancement = 0;
|
|
|
|
static int vad = 0;
|
|
|
|
static int vbr = 0;
|
2005-08-26 20:14:06 +00:00
|
|
|
static float vbr_quality = 4;
|
2004-10-01 03:18:48 +00:00
|
|
|
static int abr = 0;
|
2006-04-08 21:40:57 +00:00
|
|
|
static int dtx = 0; /* set to 1 to enable silence detection */
|
2004-10-01 03:18:48 +00:00
|
|
|
|
2005-08-26 20:14:06 +00:00
|
|
|
static int preproc = 0;
|
|
|
|
static int pp_vad = 0;
|
|
|
|
static int pp_agc = 0;
|
2006-04-08 21:40:57 +00:00
|
|
|
static float pp_agc_level = 8000; /* XXX what is this 8000 ? */
|
2005-08-26 20:14:06 +00:00
|
|
|
static int pp_denoise = 0;
|
|
|
|
static int pp_dereverb = 0;
|
|
|
|
static float pp_dereverb_decay = 0.4;
|
|
|
|
static float pp_dereverb_level = 0.3;
|
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
#define TYPE_SILENCE 0x2
|
|
|
|
#define TYPE_HIGH 0x0
|
|
|
|
#define TYPE_LOW 0x1
|
|
|
|
#define TYPE_MASK 0x3
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
#define BUFFER_SAMPLES 8000
|
|
|
|
#define SPEEX_SAMPLES 160
|
2002-08-30 00:34:24 +00:00
|
|
|
|
2008-10-17 21:35:23 +00:00
|
|
|
/* Sample frame data */
|
|
|
|
#include "asterisk/slin.h"
|
|
|
|
#include "ex_speex.h"
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt {
|
2002-08-30 00:34:24 +00:00
|
|
|
void *speex;
|
|
|
|
SpeexBits bits;
|
|
|
|
int framesize;
|
2006-04-08 21:40:57 +00:00
|
|
|
int silent_state;
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
|
|
|
SpeexPreprocessState *pp;
|
2006-04-08 21:40:57 +00:00
|
|
|
spx_int16_t buf[BUFFER_SAMPLES];
|
2005-08-26 20:14:06 +00:00
|
|
|
#else
|
2006-04-08 21:40:57 +00:00
|
|
|
int16_t buf[BUFFER_SAMPLES]; /* input, waiting to be compressed */
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2002-08-30 00:34:24 +00:00
|
|
|
};
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
static int speex_encoder_construct(struct ast_trans_pvt *pvt, const SpeexMode *profile, int sampling_rate)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *tmp = pvt->pvt;
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
if (!(tmp->speex = speex_encoder_init(profile)))
|
2006-06-24 19:43:31 +00:00
|
|
|
return -1;
|
2006-04-08 21:40:57 +00:00
|
|
|
|
|
|
|
speex_bits_init(&tmp->bits);
|
|
|
|
speex_bits_reset(&tmp->bits);
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize);
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_COMPLEXITY, &complexity);
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
2006-04-08 21:40:57 +00:00
|
|
|
if (preproc) {
|
2010-06-17 17:23:43 +00:00
|
|
|
tmp->pp = speex_preprocess_state_init(tmp->framesize, sampling_rate);
|
2006-04-08 21:40:57 +00:00
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_VAD, &pp_vad);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_AGC, &pp_agc);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &pp_agc_level);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_DENOISE, &pp_denoise);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_DEREVERB, &pp_dereverb);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &pp_dereverb_decay);
|
|
|
|
speex_preprocess_ctl(tmp->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &pp_dereverb_level);
|
|
|
|
}
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2006-04-08 21:40:57 +00:00
|
|
|
if (!abr && !vbr) {
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_QUALITY, &quality);
|
|
|
|
if (vad)
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_VAD, &vad);
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
2006-04-08 21:40:57 +00:00
|
|
|
if (vbr) {
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_VBR, &vbr);
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_VBR_QUALITY, &vbr_quality);
|
|
|
|
}
|
|
|
|
if (abr)
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_ABR, &abr);
|
|
|
|
if (dtx)
|
|
|
|
speex_encoder_ctl(tmp->speex, SPEEX_SET_DTX, &dtx);
|
|
|
|
tmp->silent_state = 0;
|
|
|
|
|
2006-06-24 19:43:31 +00:00
|
|
|
return 0;
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
static int lintospeex_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_encoder_construct(pvt, &speex_nb_mode, 8000);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lin16tospeexwb_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_encoder_construct(pvt, &speex_wb_mode, 16000);
|
|
|
|
}
|
|
|
|
|
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
2011-02-22 23:04:49 +00:00
|
|
|
static int lin32tospeexuwb_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_encoder_construct(pvt, &speex_uwb_mode, 32000);
|
|
|
|
}
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
static int speex_decoder_construct(struct ast_trans_pvt *pvt, const SpeexMode *profile)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *tmp = pvt->pvt;
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
if (!(tmp->speex = speex_decoder_init(profile)))
|
2006-06-24 19:43:31 +00:00
|
|
|
return -1;
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
speex_bits_init(&tmp->bits);
|
|
|
|
speex_decoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize);
|
|
|
|
if (enhancement)
|
|
|
|
speex_decoder_ctl(tmp->speex, SPEEX_SET_ENH, &enhancement);
|
2006-06-24 19:43:31 +00:00
|
|
|
|
|
|
|
return 0;
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
static int speextolin_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_decoder_construct(pvt, &speex_nb_mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int speexwbtolin16_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_decoder_construct(pvt, &speex_wb_mode);
|
|
|
|
}
|
|
|
|
|
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
2011-02-22 23:04:49 +00:00
|
|
|
static int speexuwbtolin32_new(struct ast_trans_pvt *pvt)
|
|
|
|
{
|
|
|
|
return speex_decoder_construct(pvt, &speex_uwb_mode);
|
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
/*! \brief convert and store into outbuf */
|
|
|
|
static int speextolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *tmp = pvt->pvt;
|
2002-08-30 00:34:24 +00:00
|
|
|
|
|
|
|
/* Assuming there's space left, decode into the current buffer at
|
|
|
|
the tail location. Read in as many frames as there are */
|
|
|
|
int x;
|
|
|
|
int res;
|
2008-06-26 17:06:17 +00:00
|
|
|
int16_t *dst = pvt->outbuf.i16;
|
2006-04-08 21:40:57 +00:00
|
|
|
/* XXX fout is a temporary buffer, may have different types */
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
2006-04-08 21:40:57 +00:00
|
|
|
spx_int16_t fout[1024];
|
2005-08-26 20:14:06 +00:00
|
|
|
#else
|
2002-08-30 00:34:24 +00:00
|
|
|
float fout[1024];
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2005-03-17 21:30:19 +00:00
|
|
|
|
2005-08-26 20:14:06 +00:00
|
|
|
if (f->datalen == 0) { /* Native PLC interpolation */
|
2006-04-08 21:40:57 +00:00
|
|
|
if (pvt->samples + tmp->framesize > BUFFER_SAMPLES) {
|
2005-03-17 21:30:19 +00:00
|
|
|
ast_log(LOG_WARNING, "Out of buffer space\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
2006-04-08 21:40:57 +00:00
|
|
|
speex_decode_int(tmp->speex, NULL, dst + pvt->samples);
|
2005-08-26 20:14:06 +00:00
|
|
|
#else
|
2005-03-17 21:30:19 +00:00
|
|
|
speex_decode(tmp->speex, NULL, fout);
|
|
|
|
for (x=0;x<tmp->framesize;x++) {
|
2006-04-08 21:40:57 +00:00
|
|
|
dst[pvt->samples + x] = (int16_t)fout[x];
|
2005-03-17 21:30:19 +00:00
|
|
|
}
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2006-04-08 21:40:57 +00:00
|
|
|
pvt->samples += tmp->framesize;
|
2007-05-14 18:49:40 +00:00
|
|
|
pvt->datalen += 2 * tmp->framesize; /* 2 bytes/sample */
|
2005-03-17 21:30:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
/* Read in bits */
|
2008-05-22 17:10:53 +00:00
|
|
|
speex_bits_read_from(&tmp->bits, f->data.ptr, f->datalen);
|
2006-04-08 21:40:57 +00:00
|
|
|
for (;;) {
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
2006-04-08 21:40:57 +00:00
|
|
|
res = speex_decode_int(tmp->speex, &tmp->bits, fout);
|
2005-08-26 20:14:06 +00:00
|
|
|
#else
|
2002-08-30 00:34:24 +00:00
|
|
|
res = speex_decode(tmp->speex, &tmp->bits, fout);
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2002-08-30 00:34:24 +00:00
|
|
|
if (res < 0)
|
|
|
|
break;
|
2006-04-08 21:40:57 +00:00
|
|
|
if (pvt->samples + tmp->framesize > BUFFER_SAMPLES) {
|
2002-08-30 00:34:24 +00:00
|
|
|
ast_log(LOG_WARNING, "Out of buffer space\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2006-04-08 21:40:57 +00:00
|
|
|
for (x = 0 ; x < tmp->framesize; x++)
|
|
|
|
dst[pvt->samples + x] = (int16_t)fout[x];
|
|
|
|
pvt->samples += tmp->framesize;
|
|
|
|
pvt->datalen += 2 * tmp->framesize; /* 2 bytes/sample */
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
/*! \brief store input frame in work buffer */
|
|
|
|
static int lintospeex_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *tmp = pvt->pvt;
|
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
/* XXX We should look at how old the rest of our stream is, and if it
|
|
|
|
is too old, then we should overwrite it entirely, otherwise we can
|
|
|
|
get artifacts of earlier talk that do not belong */
|
2008-05-22 17:10:53 +00:00
|
|
|
memcpy(tmp->buf + pvt->samples, f->data.ptr, f->datalen);
|
2006-04-08 21:40:57 +00:00
|
|
|
pvt->samples += f->samples;
|
2002-08-30 00:34:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
/*! \brief convert work buffer and produce output frame */
|
|
|
|
static struct ast_frame *lintospeex_frameout(struct ast_trans_pvt *pvt)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *tmp = pvt->pvt;
|
2005-08-26 20:14:06 +00:00
|
|
|
int is_speech=1;
|
2006-04-08 21:40:57 +00:00
|
|
|
int datalen = 0; /* output bytes */
|
|
|
|
int samples = 0; /* output samples */
|
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
/* We can't work on anything less than a frame in size */
|
2006-04-08 21:40:57 +00:00
|
|
|
if (pvt->samples < tmp->framesize)
|
2002-08-30 00:34:24 +00:00
|
|
|
return NULL;
|
|
|
|
speex_bits_reset(&tmp->bits);
|
2006-04-08 21:40:57 +00:00
|
|
|
while (pvt->samples >= tmp->framesize) {
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
|
|
|
/* Preprocess audio */
|
2006-04-08 21:40:57 +00:00
|
|
|
if (preproc)
|
2006-09-08 21:33:32 +00:00
|
|
|
is_speech = speex_preprocess(tmp->pp, tmp->buf + samples, NULL);
|
2005-08-26 20:14:06 +00:00
|
|
|
/* Encode a frame of data */
|
|
|
|
if (is_speech) {
|
|
|
|
/* If DTX enabled speex_encode returns 0 during silence */
|
2006-09-08 21:33:32 +00:00
|
|
|
is_speech = speex_encode_int(tmp->speex, tmp->buf + samples, &tmp->bits) || !dtx;
|
2005-08-26 20:14:06 +00:00
|
|
|
} else {
|
|
|
|
/* 5 zeros interpreted by Speex as silence (submode 0) */
|
|
|
|
speex_bits_pack(&tmp->bits, 0, 5);
|
|
|
|
}
|
|
|
|
#else
|
2006-04-08 21:40:57 +00:00
|
|
|
{
|
|
|
|
float fbuf[1024];
|
|
|
|
int x;
|
|
|
|
/* Convert to floating point */
|
|
|
|
for (x = 0; x < tmp->framesize; x++)
|
2006-09-08 21:33:32 +00:00
|
|
|
fbuf[x] = tmp->buf[samples + x];
|
2006-04-08 21:40:57 +00:00
|
|
|
/* Encode a frame of data */
|
|
|
|
is_speech = speex_encode(tmp->speex, fbuf, &tmp->bits) || !dtx;
|
|
|
|
}
|
2005-08-26 20:14:06 +00:00
|
|
|
#endif
|
2006-04-08 21:40:57 +00:00
|
|
|
samples += tmp->framesize;
|
|
|
|
pvt->samples -= tmp->framesize;
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
2005-07-12 22:20:16 +00:00
|
|
|
|
2006-09-08 21:33:32 +00:00
|
|
|
/* Move the data at the end of the buffer to the front */
|
|
|
|
if (pvt->samples)
|
|
|
|
memmove(tmp->buf, tmp->buf + samples, pvt->samples * 2);
|
|
|
|
|
2005-08-26 20:14:06 +00:00
|
|
|
/* Use AST_FRAME_CNG to signify the start of any silence period */
|
2006-04-08 21:40:57 +00:00
|
|
|
if (is_speech) {
|
|
|
|
tmp->silent_state = 0;
|
|
|
|
} else {
|
2005-08-26 20:14:06 +00:00
|
|
|
if (tmp->silent_state) {
|
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
tmp->silent_state = 1;
|
|
|
|
speex_bits_reset(&tmp->bits);
|
2006-04-08 21:40:57 +00:00
|
|
|
memset(&pvt->f, 0, sizeof(pvt->f));
|
|
|
|
pvt->f.frametype = AST_FRAME_CNG;
|
|
|
|
pvt->f.samples = samples;
|
|
|
|
/* XXX what now ? format etc... */
|
2005-08-26 20:14:06 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-12 22:20:16 +00:00
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
/* Terminate bit stream */
|
|
|
|
speex_bits_pack(&tmp->bits, 15, 5);
|
2008-06-26 17:06:17 +00:00
|
|
|
datalen = speex_bits_write(&tmp->bits, pvt->outbuf.c, pvt->t->buf_size);
|
2006-04-08 21:40:57 +00:00
|
|
|
return ast_trans_frameout(pvt, datalen, samples);
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
static void speextolin_destroy(struct ast_trans_pvt *arg)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *pvt = arg->pvt;
|
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
speex_decoder_destroy(pvt->speex);
|
|
|
|
speex_bits_destroy(&pvt->bits);
|
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
static void lintospeex_destroy(struct ast_trans_pvt *arg)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2006-04-08 21:40:57 +00:00
|
|
|
struct speex_coder_pvt *pvt = arg->pvt;
|
2005-08-26 20:14:06 +00:00
|
|
|
#ifdef _SPEEX_TYPES_H
|
|
|
|
if (preproc)
|
|
|
|
speex_preprocess_state_destroy(pvt->pp);
|
|
|
|
#endif
|
2002-08-30 00:34:24 +00:00
|
|
|
speex_encoder_destroy(pvt->speex);
|
|
|
|
speex_bits_destroy(&pvt->bits);
|
|
|
|
}
|
|
|
|
|
2006-04-08 21:40:57 +00:00
|
|
|
static struct ast_translator speextolin = {
|
|
|
|
.name = "speextolin",
|
|
|
|
.newpvt = speextolin_new,
|
|
|
|
.framein = speextolin_framein,
|
|
|
|
.destroy = speextolin_destroy,
|
2008-10-17 21:35:23 +00:00
|
|
|
.sample = speex_sample,
|
2006-04-08 21:40:57 +00:00
|
|
|
.desc_size = sizeof(struct speex_coder_pvt),
|
|
|
|
.buffer_samples = BUFFER_SAMPLES,
|
|
|
|
.buf_size = BUFFER_SAMPLES * 2,
|
2007-05-24 15:28:29 +00:00
|
|
|
.native_plc = 1,
|
2006-04-08 21:40:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ast_translator lintospeex = {
|
|
|
|
.name = "lintospeex",
|
|
|
|
.newpvt = lintospeex_new,
|
|
|
|
.framein = lintospeex_framein,
|
|
|
|
.frameout = lintospeex_frameout,
|
|
|
|
.destroy = lintospeex_destroy,
|
2008-10-17 21:35:23 +00:00
|
|
|
.sample = slin8_sample,
|
2006-04-08 21:40:57 +00:00
|
|
|
.desc_size = sizeof(struct speex_coder_pvt),
|
|
|
|
.buffer_samples = BUFFER_SAMPLES,
|
|
|
|
.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
|
|
|
|
};
|
2004-10-01 03:18:48 +00:00
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
static struct ast_translator speexwbtolin16 = {
|
|
|
|
.name = "speexwbtolin16",
|
|
|
|
.newpvt = speexwbtolin16_new,
|
|
|
|
.framein = speextolin_framein,
|
|
|
|
.destroy = speextolin_destroy,
|
2010-06-21 21:58:33 +00:00
|
|
|
.sample = speex16_sample,
|
2010-06-17 17:23:43 +00:00
|
|
|
.desc_size = sizeof(struct speex_coder_pvt),
|
|
|
|
.buffer_samples = BUFFER_SAMPLES,
|
|
|
|
.buf_size = BUFFER_SAMPLES * 2,
|
|
|
|
.native_plc = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ast_translator lin16tospeexwb = {
|
|
|
|
.name = "lin16tospeexwb",
|
|
|
|
.newpvt = lin16tospeexwb_new,
|
|
|
|
.framein = lintospeex_framein,
|
|
|
|
.frameout = lintospeex_frameout,
|
|
|
|
.destroy = lintospeex_destroy,
|
2010-06-21 21:58:33 +00:00
|
|
|
.sample = slin16_sample,
|
2010-06-17 17:23:43 +00:00
|
|
|
.desc_size = sizeof(struct speex_coder_pvt),
|
|
|
|
.buffer_samples = BUFFER_SAMPLES,
|
|
|
|
.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
|
|
|
|
};
|
|
|
|
|
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
2011-02-22 23:04:49 +00:00
|
|
|
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 ? */
|
|
|
|
};
|
|
|
|
|
2007-10-31 19:24:29 +00:00
|
|
|
static int parse_config(int reload)
|
2004-10-01 13:16:44 +00:00
|
|
|
{
|
2007-08-16 21:09:46 +00:00
|
|
|
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
|
|
|
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
2004-10-01 03:18:48 +00:00
|
|
|
struct ast_variable *var;
|
|
|
|
int res;
|
2005-06-21 23:16:32 +00:00
|
|
|
float res_f;
|
2004-10-01 13:16:44 +00:00
|
|
|
|
2008-09-12 23:30:03 +00:00
|
|
|
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
2007-10-31 19:24:29 +00:00
|
|
|
return 0;
|
2006-04-08 21:40:57 +00:00
|
|
|
|
|
|
|
for (var = ast_variable_browse(cfg, "speex"); var; var = var->next) {
|
|
|
|
if (!strcasecmp(var->name, "quality")) {
|
|
|
|
res = abs(atoi(var->value));
|
|
|
|
if (res > -1 && res < 11) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting Quality to %d\n",res);
|
2006-04-08 21:40:57 +00:00
|
|
|
quality = res;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error Quality must be 0-10\n");
|
|
|
|
} else if (!strcasecmp(var->name, "complexity")) {
|
|
|
|
res = abs(atoi(var->value));
|
|
|
|
if (res > -1 && res < 11) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting Complexity to %d\n",res);
|
2006-04-08 21:40:57 +00:00
|
|
|
complexity = res;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n");
|
|
|
|
} else if (!strcasecmp(var->name, "vbr_quality")) {
|
2009-08-10 19:20:57 +00:00
|
|
|
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0 && res_f <= 10) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
|
2006-04-08 21:40:57 +00:00
|
|
|
vbr_quality = res_f;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! VBR Quality must be 0-10\n");
|
|
|
|
} else if (!strcasecmp(var->name, "abr_quality")) {
|
|
|
|
ast_log(LOG_ERROR,"Error! ABR Quality setting obsolete, set ABR to desired bitrate\n");
|
|
|
|
} else if (!strcasecmp(var->name, "enhancement")) {
|
|
|
|
enhancement = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Perceptual Enhancement Mode. [%s]\n",enhancement ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "vbr")) {
|
|
|
|
vbr = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: VBR Mode. [%s]\n",vbr ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "abr")) {
|
|
|
|
res = abs(atoi(var->value));
|
|
|
|
if (res >= 0) {
|
|
|
|
if (res > 0)
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting ABR target bitrate to %d\n",res);
|
2006-04-08 21:40:57 +00:00
|
|
|
else
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Disabling ABR\n");
|
2006-04-08 21:40:57 +00:00
|
|
|
abr = res;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! ABR target bitrate must be >= 0\n");
|
|
|
|
} else if (!strcasecmp(var->name, "vad")) {
|
|
|
|
vad = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "dtx")) {
|
|
|
|
dtx = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: DTX Mode. [%s]\n",dtx ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "preprocess")) {
|
|
|
|
preproc = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Preprocessing. [%s]\n",preproc ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "pp_vad")) {
|
|
|
|
pp_vad = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Preprocessor VAD. [%s]\n",pp_vad ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "pp_agc")) {
|
|
|
|
pp_agc = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "pp_agc_level")) {
|
2009-08-10 19:20:57 +00:00
|
|
|
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
|
2006-04-08 21:40:57 +00:00
|
|
|
pp_agc_level = res_f;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! Preprocessor AGC Level must be >= 0\n");
|
|
|
|
} else if (!strcasecmp(var->name, "pp_denoise")) {
|
|
|
|
pp_denoise = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Preprocessor Denoise. [%s]\n",pp_denoise ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "pp_dereverb")) {
|
|
|
|
pp_dereverb = ast_true(var->value) ? 1 : 0;
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
|
2006-04-08 21:40:57 +00:00
|
|
|
} else if (!strcasecmp(var->name, "pp_dereverb_decay")) {
|
2009-08-10 19:20:57 +00:00
|
|
|
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
|
2006-04-08 21:40:57 +00:00
|
|
|
pp_dereverb_decay = res_f;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n");
|
|
|
|
} else if (!strcasecmp(var->name, "pp_dereverb_level")) {
|
2009-08-10 19:20:57 +00:00
|
|
|
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
2007-07-26 15:49:18 +00:00
|
|
|
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
|
2006-04-08 21:40:57 +00:00
|
|
|
pp_dereverb_level = res_f;
|
|
|
|
} else
|
|
|
|
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Level must be >= 0\n");
|
2004-10-01 03:18:48 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-08 21:40:57 +00:00
|
|
|
ast_config_destroy(cfg);
|
2007-10-31 19:24:29 +00:00
|
|
|
return 0;
|
2004-10-01 03:18:48 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int reload(void)
|
2004-10-01 13:16:44 +00:00
|
|
|
{
|
2007-10-31 19:24:29 +00:00
|
|
|
if (parse_config(1))
|
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
|
|
|
return AST_MODULE_LOAD_SUCCESS;
|
2004-10-01 03:18:48 +00:00
|
|
|
}
|
2002-08-30 00:34:24 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2010-06-17 17:23:43 +00:00
|
|
|
int res = 0;
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2006-04-14 14:08:19 +00:00
|
|
|
res |= ast_unregister_translator(&speextolin);
|
2010-06-17 17:23:43 +00:00
|
|
|
res |= ast_unregister_translator(&lintospeex);
|
|
|
|
res |= ast_unregister_translator(&speexwbtolin16);
|
|
|
|
res |= ast_unregister_translator(&lin16tospeexwb);
|
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
2011-02-22 23:04:49 +00:00
|
|
|
res |= ast_unregister_translator(&speexuwbtolin32);
|
|
|
|
res |= ast_unregister_translator(&lin32tospeexuwb);
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2002-08-30 00:34:24 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2002-08-30 00:34:24 +00:00
|
|
|
{
|
2010-06-17 17:23:43 +00:00
|
|
|
int res = 0;
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2007-10-31 19:24:29 +00:00
|
|
|
if (parse_config(0))
|
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
2010-06-17 17:23:43 +00:00
|
|
|
|
2011-02-03 16:22:10 +00:00
|
|
|
|
|
|
|
ast_format_set(&speextolin.src_format, AST_FORMAT_SPEEX, 0);
|
|
|
|
ast_format_set(&speextolin.dst_format, AST_FORMAT_SLINEAR, 0);
|
|
|
|
|
|
|
|
ast_format_set(&lintospeex.src_format, AST_FORMAT_SLINEAR, 0);
|
|
|
|
ast_format_set(&lintospeex.dst_format, AST_FORMAT_SPEEX, 0);
|
|
|
|
|
|
|
|
ast_format_set(&speexwbtolin16.src_format, AST_FORMAT_SPEEX16, 0);
|
|
|
|
ast_format_set(&speexwbtolin16.dst_format, AST_FORMAT_SLINEAR16, 0);
|
|
|
|
|
|
|
|
ast_format_set(&lin16tospeexwb.src_format, AST_FORMAT_SLINEAR16, 0);
|
|
|
|
ast_format_set(&lin16tospeexwb.dst_format, AST_FORMAT_SPEEX16, 0);
|
|
|
|
|
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
2011-02-22 23:04:49 +00:00
|
|
|
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);
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
res |= ast_register_translator(&speextolin);
|
|
|
|
res |= ast_register_translator(&lintospeex);
|
|
|
|
res |= ast_register_translator(&speexwbtolin16);
|
|
|
|
res |= ast_register_translator(&lin16tospeexwb);
|
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
2011-02-22 23:04:49 +00:00
|
|
|
res |= ast_register_translator(&speexuwbtolin32);
|
|
|
|
res |= ast_register_translator(&lin32tospeexuwb);
|
|
|
|
|
2010-06-17 17:23:43 +00:00
|
|
|
|
|
|
|
return res;
|
2002-08-30 00:34:24 +00:00
|
|
|
}
|
2006-04-14 14:08:19 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Speex Coder/Decoder",
|
|
|
|
.load = load_module,
|
|
|
|
.unload = unload_module,
|
|
|
|
.reload = reload,
|
|
|
|
);
|