Asterisk - The Open Source Telephony Project
21.4.1
|
Translate between various formats natively through DAHDI transcoding. More...
#include "asterisk.h"
#include <stdbool.h>
#include <poll.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <dahdi/user.h>
#include "asterisk/lock.h"
#include "asterisk/translate.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/cli.h"
#include "asterisk/channel.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/ulaw.h"
#include "asterisk/format_compatibility.h"
Go to the source code of this file.
Data Structures | |
struct | channel_usage |
struct | codec_dahdi_pvt |
struct | translator |
struct | translators |
the list of translators More... | |
Macros | |
#define | BUFFER_SIZE 8000 |
#define | container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member))) |
#define | DAHDI_FORMAT_ADPCM (1 << 5) |
#define | DAHDI_FORMAT_ALAW (1 << 3) |
#define | DAHDI_FORMAT_G723_1 (1 << 0) |
#define | DAHDI_FORMAT_G726 (1 << 4) |
#define | DAHDI_FORMAT_G729A (1 << 8) |
#define | DAHDI_FORMAT_GSM (1 << 1) |
#define | DAHDI_FORMAT_ILBC (1 << 10) |
#define | DAHDI_FORMAT_LPC10 (1 << 7) |
#define | DAHDI_FORMAT_SLINEAR (1 << 6) |
#define | DAHDI_FORMAT_SPEEX (1 << 9) |
#define | DAHDI_FORMAT_ULAW (1 << 2) |
#define | G723_SAMPLES 240 |
#define | G729_SAMPLES 160 |
#define | ULAW_SAMPLES 160 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | build_translators (uint32_t dstfmts, uint32_t srcfmts) |
static int | dahdi_decoder_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
static struct ast_frame * | dahdi_decoder_frameout (struct ast_trans_pvt *pvt) |
static void | dahdi_destroy (struct ast_trans_pvt *pvt) |
static int | dahdi_encoder_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
static struct ast_frame * | dahdi_encoder_frameout (struct ast_trans_pvt *pvt) |
static struct ast_format * | dahdi_format_to_cached (int format) |
static int | dahdi_new (struct ast_trans_pvt *pvt) |
static int | dahdi_translate (struct ast_trans_pvt *pvt, uint32_t dst_dahdi_fmt, uint32_t src_dahdi_fmt) |
static void | dahdi_wait_for_packet (int fd) |
static void | dahdi_write_frame (struct codec_dahdi_pvt *dahdip, const uint8_t *buffer, const ssize_t count) |
static struct ast_frame * | fakesrc_sample (void) |
static int | find_transcoders (void) |
static const struct ast_codec * | get_dahdi_codec (uint32_t dahdi_fmt) |
static char * | handle_cli_transcoder_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static bool | is_already_registered (uint32_t dstfmt, uint32_t srcfmt) |
static bool | is_encoder (uint32_t src_dahdi_fmt) |
static int | lintoulaw (struct ast_trans_pvt *pvt, struct ast_frame *f) |
static int | load_module (void) |
static int | register_translator (uint32_t dst_dahdi_fmt, uint32_t src_dahdi_fmt) |
static int | reload (void) |
static int | ulawtolin (struct ast_trans_pvt *pvt, int samples) |
static int | unload_module (void) |
static void | unregister_translators (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Generic DAHDI Transcoder Codec Translator" , .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 = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct channel_usage | channels |
static struct ast_cli_entry | cli [] |
static struct translators | translators = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
Translate between various formats natively through DAHDI transcoding.
Definition in file codec_dahdi.c.
#define DAHDI_FORMAT_ADPCM (1 << 5) |
ADPCM (IMA)
Definition at line 74 of file codec_dahdi.c.
#define DAHDI_FORMAT_ALAW (1 << 3) |
Raw A-law data (G.711)
Definition at line 70 of file codec_dahdi.c.
#define DAHDI_FORMAT_G723_1 (1 << 0) |
G.723.1 compression
Definition at line 64 of file codec_dahdi.c.
#define DAHDI_FORMAT_G726 (1 << 4) |
ADPCM (G.726, 32kbps)
Definition at line 72 of file codec_dahdi.c.
#define DAHDI_FORMAT_G729A (1 << 8) |
G.729A audio
Definition at line 80 of file codec_dahdi.c.
#define DAHDI_FORMAT_GSM (1 << 1) |
GSM compression
Definition at line 66 of file codec_dahdi.c.
#define DAHDI_FORMAT_ILBC (1 << 10) |
iLBC Free Compression
Definition at line 84 of file codec_dahdi.c.
#define DAHDI_FORMAT_LPC10 (1 << 7) |
LPC10, 180 samples/frame
Definition at line 78 of file codec_dahdi.c.
#define DAHDI_FORMAT_SLINEAR (1 << 6) |
Raw 16-bit Signed Linear (8000 Hz) PCM
Definition at line 76 of file codec_dahdi.c.
#define DAHDI_FORMAT_SPEEX (1 << 9) |
SpeeX Free Compression
Definition at line 82 of file codec_dahdi.c.
#define DAHDI_FORMAT_ULAW (1 << 2) |
Raw mu-law data (G.711)
Definition at line 68 of file codec_dahdi.c.
|
static |
Definition at line 265 of file codec_dahdi.c.