#include "asterisk.h"
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "asterisk/lock.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/options.h"
#include "asterisk/translate.h"
#include "asterisk/channel.h"
#include "asterisk/alaw.h"
#include "asterisk/utils.h"
#include "slin_ulaw_ex.h"
#include "ulaw_slin_ex.h"
Go to the source code of this file.
Defines | |
#define | BUFFER_SAMPLES 8096 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | alawtolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
decode frame into lin and fill output buffer. | |
static struct ast_frame * | alawtolin_sample (void) |
alawToLin_Sample | |
static int | lintoalaw_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
convert and store input samples in output buffer | |
static struct ast_frame * | lintoalaw_sample (void) |
LinToalaw_Sample. | |
static int | load_module (void) |
static int | reload (void) |
standard module stuff | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "A-law 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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, .reload = reload, } |
static struct ast_translator | alawtolin |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_translator | lintoalaw |
Definition in file codec_alaw.c.
#define BUFFER_SAMPLES 8096 |
Definition at line 47 of file codec_alaw.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 170 of file codec_alaw.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 170 of file codec_alaw.c.
static int alawtolin_framein | ( | struct ast_trans_pvt * | pvt, | |
struct ast_frame * | f | |||
) | [static] |
decode frame into lin and fill output buffer.
Definition at line 55 of file codec_alaw.c.
References AST_ALAW, ast_trans_pvt::datalen, f, ast_trans_pvt::outbuf, and ast_trans_pvt::samples.
00056 { 00057 int i = f->samples; 00058 unsigned char *src = f->data; 00059 int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples; 00060 00061 pvt->samples += i; 00062 pvt->datalen += i * 2; /* 2 bytes/sample */ 00063 00064 while (i--) 00065 *dst++ = AST_ALAW(*src++); 00066 00067 return 0; 00068 }
static struct ast_frame* alawtolin_sample | ( | void | ) | [static] |
alawToLin_Sample
Definition at line 87 of file codec_alaw.c.
References AST_FORMAT_ALAW, AST_FRAME_VOICE, f, and ulaw_slin_ex.
00088 { 00089 static struct ast_frame f; 00090 f.frametype = AST_FRAME_VOICE; 00091 f.subclass = AST_FORMAT_ALAW; 00092 f.datalen = sizeof(ulaw_slin_ex); 00093 f.samples = sizeof(ulaw_slin_ex); 00094 f.mallocd = 0; 00095 f.offset = 0; 00096 f.src = __PRETTY_FUNCTION__; 00097 f.data = ulaw_slin_ex; 00098 return &f; 00099 }
static int lintoalaw_framein | ( | struct ast_trans_pvt * | pvt, | |
struct ast_frame * | f | |||
) | [static] |
convert and store input samples in output buffer
Definition at line 71 of file codec_alaw.c.
References AST_LIN2A, ast_trans_pvt::datalen, f, ast_trans_pvt::outbuf, and ast_trans_pvt::samples.
00072 { 00073 int i = f->samples; 00074 char *dst = pvt->outbuf + pvt->samples; 00075 int16_t *src = f->data; 00076 00077 pvt->samples += i; 00078 pvt->datalen += i; /* 1 byte/sample */ 00079 00080 while (i--) 00081 *dst++ = AST_LIN2A(*src++); 00082 00083 return 0; 00084 }
static struct ast_frame* lintoalaw_sample | ( | void | ) | [static] |
LinToalaw_Sample.
Definition at line 102 of file codec_alaw.c.
References AST_FORMAT_SLINEAR, AST_FRAME_VOICE, f, and slin_ulaw_ex.
00103 { 00104 static struct ast_frame f; 00105 f.frametype = AST_FRAME_VOICE; 00106 f.subclass = AST_FORMAT_SLINEAR; 00107 f.datalen = sizeof(slin_ulaw_ex); 00108 f.samples = sizeof(slin_ulaw_ex) / 2; 00109 f.mallocd = 0; 00110 f.offset = 0; 00111 f.src = __PRETTY_FUNCTION__; 00112 f.data = slin_ulaw_ex; 00113 return &f; 00114 }
static int load_module | ( | void | ) | [static] |
Definition at line 153 of file codec_alaw.c.
References alawtolin, ast_register_translator, ast_unregister_translator(), and lintoalaw.
00154 { 00155 int res; 00156 00157 res = ast_register_translator(&alawtolin); 00158 if (!res) 00159 res = ast_register_translator(&lintoalaw); 00160 else 00161 ast_unregister_translator(&alawtolin); 00162 00163 return res; 00164 }
static int reload | ( | void | ) | [static] |
static int unload_module | ( | void | ) | [static] |
Definition at line 143 of file codec_alaw.c.
References alawtolin, ast_unregister_translator(), and lintoalaw.
00144 { 00145 int res; 00146 00147 res = ast_unregister_translator(&lintoalaw); 00148 res |= ast_unregister_translator(&alawtolin); 00149 00150 return res; 00151 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "A-law 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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, .reload = reload, } [static] |
Definition at line 170 of file codec_alaw.c.
struct ast_translator alawtolin [static] |
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 170 of file codec_alaw.c.
struct ast_translator lintoalaw [static] |