38 #define BUFFER_SAMPLES 8000
40 static unsigned char mu2a[256];
41 static unsigned char a2mu[256];
51 unsigned char *src = f->
data.ptr;
52 unsigned char *dst = pvt->outbuf.
uc + pvt->
samples;
58 *dst++ = a2mu[*src++];
67 unsigned char *src = f->
data.ptr;
68 unsigned char *dst = pvt->outbuf.
uc + pvt->
samples;
74 *dst++ = mu2a[*src++];
83 .type = AST_MEDIA_TYPE_AUDIO,
88 .type = AST_MEDIA_TYPE_AUDIO,
93 .sample = alaw_sample,
94 .buffer_samples = BUFFER_SAMPLES,
95 .buf_size = BUFFER_SAMPLES,
102 .type = AST_MEDIA_TYPE_AUDIO,
107 .type = AST_MEDIA_TYPE_AUDIO,
112 .sample = ulaw_sample,
113 .buffer_samples = BUFFER_SAMPLES,
114 .buf_size = BUFFER_SAMPLES,
129 static int load_module(
void)
134 for (x=0;x<256;x++) {
135 mu2a[x] = AST_LIN2A(AST_MULAW(x));
136 a2mu[x] = AST_LIN2MU(AST_ALAW(x));
150 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"A-law and Mulaw direct Coder/Decoder");
A-Law to Signed linear conversion.
int datalen
actual space used in outbuf
static int ulawtoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
convert frame data and store into the buffer
Asterisk main include file. File version handling, generic pbx functions.
Descriptor of a translator.
Support for translation of data formats. translate.c.
static int unload_module(void)
standard module glue
u-Law to Signed linear conversion
#define ast_register_translator(t)
See __ast_register_translator()
int ast_unregister_translator(struct ast_translator *t)
Unregister a translator Unregisters the given translator.
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.
static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
convert frame data and store into the buffer
Data structure associated with a single frame of data.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.