48 #define BUFFER_SAMPLES 8096
54 #include "asterisk/slin.h"
70 g722_encode_init(&tmp->g722, 64000, G722_SAMPLE_RATE_8000);
79 g722_encode_init(&tmp->g722, 64000, 0);
89 g722_decode_init(&tmp->g722, 64000, G722_SAMPLE_RATE_8000);
98 g722_decode_init(&tmp->g722, 64000, 0);
112 out_samples = g722_decode(&tmp->g722, &pvt->outbuf.i16[pvt->
samples *
sizeof(int16_t)],
113 (uint8_t *) f->
data.ptr, in_samples);
117 pvt->
datalen += (out_samples *
sizeof(int16_t));
127 outlen = g722_encode(&tmp->g722, (&pvt->outbuf.ui8[pvt->
datalen]),
141 .type = AST_MEDIA_TYPE_AUDIO,
142 .sample_rate = 16000,
146 .type = AST_MEDIA_TYPE_AUDIO,
151 .framein = g722tolin_framein,
152 .sample = g722_sample,
154 .buffer_samples = BUFFER_SAMPLES /
sizeof(int16_t),
155 .buf_size = BUFFER_SAMPLES,
162 .type = AST_MEDIA_TYPE_AUDIO,
167 .type = AST_MEDIA_TYPE_AUDIO,
168 .sample_rate = 16000,
172 .framein = lintog722_framein,
173 .sample = slin8_sample,
175 .buffer_samples = BUFFER_SAMPLES * 2,
176 .buf_size = BUFFER_SAMPLES,
180 .
name =
"g722tolin16",
183 .type = AST_MEDIA_TYPE_AUDIO,
184 .sample_rate = 16000,
188 .type = AST_MEDIA_TYPE_AUDIO,
189 .sample_rate = 16000,
192 .newpvt = g722tolin16_new,
193 .framein = g722tolin_framein,
194 .sample = g722_sample,
196 .buffer_samples = BUFFER_SAMPLES /
sizeof(int16_t),
197 .buf_size = BUFFER_SAMPLES,
201 .
name =
"lin16tog722",
204 .type = AST_MEDIA_TYPE_AUDIO,
205 .sample_rate = 16000,
209 .type = AST_MEDIA_TYPE_AUDIO,
210 .sample_rate = 16000,
213 .newpvt = lin16tog722_new,
214 .framein = lintog722_framein,
215 .sample = slin16_sample,
217 .buffer_samples = BUFFER_SAMPLES * 2,
218 .buf_size = BUFFER_SAMPLES,
221 static int unload_module(
void)
233 static int load_module(
void)
250 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"ITU G.722-64kbps G722 Transcoder",
251 .support_level = AST_MODULE_SUPPORT_CORE,
253 .unload = unload_module,
int datalen
actual space used in outbuf
Asterisk main include file. File version handling, generic pbx functions.
Descriptor of a translator.
Support for translation of data formats. translate.c.
Configuration File Parser.
static int lintog722_new(struct ast_trans_pvt *pvt)
init a new instance of g722_encoder_pvt.
#define ast_register_translator(t)
See __ast_register_translator()
int ast_unregister_translator(struct ast_translator *t)
Unregister a translator Unregisters the given translator.
A set of macros to manage forward-linked lists.
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
union ast_frame::@224 data
Module has failed to load, may be in an inconsistent state.
Data structure associated with a single frame of data.
static int g722tolin_new(struct ast_trans_pvt *pvt)
init a new instance of g722_encoder_pvt.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.