58 #define USE_ILBC_ENHANCER 0 59 #define BUFFER_SAMPLES 8000 77 const unsigned int mode = attr ? attr->
mode : 30;
98 const unsigned int mode = attr ? attr->
mode : 30;
100 const unsigned int samples_per_frame = mode * sample_rate / 1000;
101 const unsigned int octets_per_frame = (mode == 20) ? 38 : 50;
112 ast_debug(1,
"issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", datalen, f->
src ? f->
src :
"no src set");
118 datalen = octets_per_frame;
119 f->
samples = samples_per_frame;
121 pvt->
samples += samples_per_frame;
124 if (datalen % octets_per_frame) {
125 ast_log(
LOG_WARNING,
"Huh? An ilbc frame that isn't a multiple of %u bytes long from %s (%d)?\n", octets_per_frame, f->
src, datalen);
134 for (x = 0; x < datalen; x += octets_per_frame) {
140 for (i = 0; i < samples_per_frame; i++)
141 dst[pvt->
samples + i] = tmpf[i];
142 pvt->
samples += samples_per_frame;
143 pvt->
datalen += samples_per_frame * 2;
171 const unsigned int mode = attr ? attr->
mode : 30;
173 const unsigned int samples_per_frame = mode * sample_rate / 1000;
174 const unsigned int octets_per_frame = (mode == 20) ? 38 : 50;
176 while (pvt->
samples >= samples_per_frame) {
182 for (i = 0; i < samples_per_frame; i++)
183 tmpf[i] = tmp->
buf[samples + i];
186 samples += samples_per_frame;
187 pvt->
samples -= samples_per_frame;
struct ast_frame * ast_trans_frameout(struct ast_trans_pvt *pvt, int datalen, int samples)
generic frameout function
int datalen
actual space used in outbuf
#define AST_MODULE_INFO_STANDARD(keystr, desc)
static int ilbctolin_new(struct ast_trans_pvt *pvt)
Asterisk main include file. File version handling, generic pbx functions.
Descriptor of a translator.
Support for translation of data formats. translate.c.
void iLBC_decode(float *decblock, unsigned char *bytes, iLBC_Dec_Inst_t *iLBCdec_inst, int mode)
static struct ast_translator ilbctolin
static struct ast_translator lintoilbc
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static struct ast_frame * slin8_sample(void)
static int load_module(void)
void iLBC_encode(unsigned char *bytes, float *block, iLBC_Enc_Inst_t *iLBCenc_inst)
struct ast_frame_subclass subclass
static struct ast_frame * ilbc_sample(void)
short initDecode(iLBC_Dec_Inst_t *iLBCdec_inst, int mode, int use_enhancer)
#define ast_debug(level,...)
Log a DEBUG message.
struct sla_ringing_trunk * last
#define ast_register_translator(t)
See __ast_register_translator()
Asterisk internal frame definitions.
int ast_unregister_translator(struct ast_translator *t)
Unregister a translator Unregisters the given tranlator.
A set of macros to manage forward-linked lists.
static int ilbctolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
decode a frame and store in outbuf
int16_t buf[BUFFER_SAMPLES]
union ast_trans_pvt::@327 outbuf
struct ast_codec dst_codec
struct ast_format * explicit_dst
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
short initEncode(iLBC_Enc_Inst_t *iLBCenc_inst, int mode)
static int unload_module(void)
Module has failed to load, may be in an inconsistent state.
unsigned int sample_rate
Sample rate (number of samples carried in a second)
Support for logging to various files, console and syslog Configuration in file logger.conf.
static struct ast_frame * lintoilbc_frameout(struct ast_trans_pvt *pvt)
encode the temporary buffer and generate a frame
#define USE_ILBC_ENHANCER
Data structure associated with a single frame of data.
static int lintoilbc_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
store a frame into a temporary buffer, for later decoding
struct ast_translator * t
union ast_frame::@263 data
struct ast_format * format
static int lintoilbc_new(struct ast_trans_pvt *pvt)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.