|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "iLBC Coder/Decoder" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_translator | ilbctolin |
|
static struct ast_translator | lintoilbc |
|
Translate between signed linear and Internet Low Bitrate Codec.
Definition in file codec_ilbc.c.
decode a frame and store in outbuf
Definition at line 94 of file codec_ilbc.c.
95{
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;
102
103 int plc_mode = 1;
104
105
106 int x,i;
110
112 ast_debug(1,
"issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", datalen, f->
src ? f->
src :
"no src set");
114 datalen = 0;
115 }
116
117 if (datalen == 0) {
118 datalen = octets_per_frame;
119 f->
samples = samples_per_frame;
120 plc_mode = 0;
121 pvt->
samples += samples_per_frame;
122 }
123
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);
126 return -1;
127 }
128
132 }
133
134 for (x = 0; x < datalen; x += octets_per_frame) {
137 return -1;
138 }
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;
144 }
145 return 0;
146}
#define USE_ILBC_ENHANCER
short initDecode(iLBC_Dec_Inst_t *iLBCdec_inst, int mode, int use_enhancer)
void iLBC_decode(float *decblock, unsigned char *bytes, iLBC_Dec_Inst_t *iLBCdec_inst, int mode)
#define ast_debug(level,...)
Log a DEBUG message.
unsigned int sample_rate
Sample rate (number of samples carried in a second)
struct ast_format * format
struct ast_frame_subclass subclass
union ast_frame::@226 data
struct ast_translator * t
int datalen
actual space used in outbuf
union ast_trans_pvt::@287 outbuf
struct ast_codec dst_codec
References ast_debug, ast_format_get_attribute_data(), ast_log, BUFFER_SAMPLES, ast_frame::data, ast_frame::datalen, ast_trans_pvt::datalen, ast_translator::dst_codec, ast_frame_subclass::format, ast_trans_pvt::i16, iLBC_decode(), initDecode(), LOG_WARNING, ilbc_attr::mode, NULL, ast_trans_pvt::outbuf, ast_frame::ptr, ast_trans_pvt::pvt, ast_codec::sample_rate, ast_frame::samples, ast_trans_pvt::samples, ast_frame::src, ast_frame::subclass, ast_trans_pvt::t, tmp(), and USE_ILBC_ENHANCER.
encode the temporary buffer and generate a frame
Definition at line 163 of file codec_ilbc.c.
164{
169
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;
175
176 while (pvt->
samples >= samples_per_frame) {
179 int i;
180
181
182 for (i = 0; i < samples_per_frame; i++)
185
187 pvt->
samples -= samples_per_frame;
188
191 continue;
194 } else {
196 }
198 }
199
200
203 }
204
206}
struct sla_ringing_trunk * last
void iLBC_encode(unsigned char *bytes, float *block, iLBC_Enc_Inst_t *iLBCenc_inst)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Data structure associated with a single frame of data.
struct ast_frame * ast_trans_frameout(struct ast_trans_pvt *pvt, int datalen, int samples)
generic frameout function
References ast_format_get_attribute_data(), AST_LIST_NEXT, ast_trans_frameout(), current, ast_translator::dst_codec, ast_trans_pvt::f, ast_frame_subclass::format, iLBC_encode(), last, ilbc_attr::mode, NULL, ast_trans_pvt::outbuf, ast_trans_pvt::pvt, result, ast_codec::sample_rate, ast_frame::samples, ast_trans_pvt::samples, ast_frame::subclass, ast_trans_pvt::t, and tmp().