#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/ulaw.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 | lintoulaw_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
convert and store samples in outbuf | |
static struct ast_frame * | lintoulaw_sample (void) |
LinToulaw_Sample. | |
static int | load_module (void) |
static int | reload (void) |
static int | ulawtolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
convert and store samples in outbuf | |
static struct ast_frame * | ulawtolin_sample (void) |
ulawToLin_Sample | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "mu-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 const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_translator | lintoulaw |
The complete translator for LinToulaw. | |
static struct ast_translator | ulawtolin |
The complete translator for ulawToLin. |
Definition in file codec_ulaw.c.
#define BUFFER_SAMPLES 8096 |
Definition at line 47 of file codec_ulaw.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 181 of file codec_ulaw.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 181 of file codec_ulaw.c.
static int lintoulaw_framein | ( | struct ast_trans_pvt * | pvt, | |
struct ast_frame * | f | |||
) | [static] |
convert and store samples in outbuf
Definition at line 72 of file codec_ulaw.c.
References AST_LIN2MU, ast_trans_pvt::datalen, f, ast_trans_pvt::outbuf, and ast_trans_pvt::samples.
00073 { 00074 int i = f->samples; 00075 char *dst = pvt->outbuf + pvt->samples; 00076 int16_t *src = f->data; 00077 00078 pvt->samples += i; 00079 pvt->datalen += i; /* 1 byte/sample */ 00080 00081 while (i--) 00082 *dst++ = AST_LIN2MU(*src++); 00083 00084 return 0; 00085 }
static struct ast_frame* lintoulaw_sample | ( | void | ) | [static] |
LinToulaw_Sample.
Definition at line 106 of file codec_ulaw.c.
References AST_FORMAT_SLINEAR, AST_FRAME_VOICE, f, and slin_ulaw_ex.
00107 { 00108 static struct ast_frame f; 00109 f.frametype = AST_FRAME_VOICE; 00110 f.subclass = AST_FORMAT_SLINEAR; 00111 f.datalen = sizeof(slin_ulaw_ex); 00112 /* Assume 8000 Hz */ 00113 f.samples = sizeof(slin_ulaw_ex) / 2; 00114 f.mallocd = 0; 00115 f.offset = 0; 00116 f.src = __PRETTY_FUNCTION__; 00117 f.data = slin_ulaw_ex; 00118 return &f; 00119 }
static int load_module | ( | void | ) | [static] |
Definition at line 164 of file codec_ulaw.c.
References ast_register_translator, ast_unregister_translator(), lintoulaw, and ulawtolin.
00165 { 00166 int res; 00167 00168 res = ast_register_translator(&ulawtolin); 00169 if (!res) 00170 res = ast_register_translator(&lintoulaw); 00171 else 00172 ast_unregister_translator(&ulawtolin); 00173 00174 return res; 00175 }
static int reload | ( | void | ) | [static] |
static int ulawtolin_framein | ( | struct ast_trans_pvt * | pvt, | |
struct ast_frame * | f | |||
) | [static] |
convert and store samples in outbuf
Definition at line 55 of file codec_ulaw.c.
References AST_MULAW, 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 /* convert and copy in outbuf */ 00065 while (i--) 00066 *dst++ = AST_MULAW(*src++); 00067 00068 return 0; 00069 }
static struct ast_frame* ulawtolin_sample | ( | void | ) | [static] |
ulawToLin_Sample
*
Definition at line 88 of file codec_ulaw.c.
References AST_FORMAT_ULAW, AST_FRAME_VOICE, f, and ulaw_slin_ex.
00089 { 00090 static struct ast_frame f; 00091 f.frametype = AST_FRAME_VOICE; 00092 f.subclass = AST_FORMAT_ULAW; 00093 f.datalen = sizeof(ulaw_slin_ex); 00094 f.samples = sizeof(ulaw_slin_ex); 00095 f.mallocd = 0; 00096 f.offset = 0; 00097 f.src = __PRETTY_FUNCTION__; 00098 f.data = ulaw_slin_ex; 00099 return &f; 00100 }
static int unload_module | ( | void | ) | [static] |
Definition at line 154 of file codec_ulaw.c.
References ast_unregister_translator(), lintoulaw, and ulawtolin.
00155 { 00156 int res; 00157 00158 res = ast_unregister_translator(&lintoulaw); 00159 res |= ast_unregister_translator(&ulawtolin); 00160 00161 return res; 00162 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "mu-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 181 of file codec_ulaw.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 181 of file codec_ulaw.c.
struct ast_translator lintoulaw [static] |
The complete translator for LinToulaw.
Definition at line 139 of file codec_ulaw.c.
Referenced by dahdi_encoder_framein(), load_module(), and unload_module().
struct ast_translator ulawtolin [static] |
The complete translator for ulawToLin.
Definition at line 125 of file codec_ulaw.c.
Referenced by dahdi_decoder_frameout(), load_module(), and unload_module().