Asterisk - The Open Source Telephony Project
18.5.0
|
Flat, binary, ulaw PCM file format. More...
#include "asterisk.h"
#include "asterisk/mod_format.h"
#include "asterisk/module.h"
#include "asterisk/endian.h"
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | au_desc |
Macros | |
#define | AU_ENC_8BIT_ULAW 1 |
#define | AU_HDR_CHANNELS_OFF 5 |
#define | AU_HDR_DATA_SIZE_OFF 2 |
#define | AU_HDR_ENCODING_OFF 3 |
#define | AU_HDR_HDR_SIZE_OFF 1 |
#define | AU_HDR_MAGIC_OFF 0 |
#define | AU_HDR_SAMPLE_RATE_OFF 4 |
#define | AU_HEADER(var) uint32_t var[6] |
#define | AU_MAGIC 0x2e736e64 |
#define | BUF_SIZE 160 /* 160 bytes, and same number of samples */ |
#define | MIN_AU_HEADER_SIZE 24 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | au_open (struct ast_filestream *s) |
static int | au_rewrite (struct ast_filestream *s, const char *comment) |
static int | au_seek (struct ast_filestream *fs, off_t sample_offset, int whence) |
static off_t | au_tell (struct ast_filestream *fs) |
static int | au_trunc (struct ast_filestream *fs) |
static int | check_header (struct ast_filestream *fs) |
static struct ast_frame * | g722_read (struct ast_filestream *s, int *whennext) |
static int | g722_seek (struct ast_filestream *fs, off_t sample_offset, int whence) |
static off_t | g722_tell (struct ast_filestream *fs) |
static int | load_module (void) |
static struct ast_frame * | pcm_read (struct ast_filestream *s, int *whennext) |
static int | pcm_seek (struct ast_filestream *fs, off_t sample_offset, int whence) |
static off_t | pcm_tell (struct ast_filestream *fs) |
static int | pcm_trunc (struct ast_filestream *fs) |
static int | pcm_write (struct ast_filestream *fs, struct ast_frame *f) |
static int | unload_module (void) |
static int | update_header (struct ast_filestream *fs) |
static int | write_header (struct ast_filestream *fs) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G.722 16Khz" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } |
static struct ast_format_def | alaw_f |
static char | alaw_silence [BUF_SIZE] |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_format_def | au_f |
static struct ast_format_def | g722_f |
static struct ast_format_def | pcm_f |
static char | ulaw_silence [BUF_SIZE] |
Flat, binary, ulaw PCM file format.
Definition in file format_pcm.c.
#define AU_ENC_8BIT_ULAW 1 |
Definition at line 247 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_CHANNELS_OFF 5 |
Definition at line 245 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_DATA_SIZE_OFF 2 |
Definition at line 242 of file format_pcm.c.
Referenced by update_header(), and write_header().
#define AU_HDR_ENCODING_OFF 3 |
Definition at line 243 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_HDR_SIZE_OFF 1 |
Definition at line 241 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_MAGIC_OFF 0 |
Definition at line 240 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_SAMPLE_RATE_OFF 4 |
Definition at line 244 of file format_pcm.c.
Referenced by check_header(), and write_header().
Definition at line 238 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_MAGIC 0x2e736e64 |
Definition at line 249 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define BUF_SIZE 160 /* 160 bytes, and same number of samples */ |
Definition at line 40 of file format_pcm.c.
Referenced by pcm_read(), and pcm_seek().
#define MIN_AU_HEADER_SIZE 24 |
Definition at line 237 of file format_pcm.c.
Referenced by au_rewrite(), check_header(), and write_header().
|
static |
Definition at line 581 of file format_pcm.c.
|
static |
Definition at line 581 of file format_pcm.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 581 of file format_pcm.c.
|
static |
|
static |
Definition at line 395 of file format_pcm.c.
References ast_filestream::_private, desc, au_desc::hdr_size, MIN_AU_HEADER_SIZE, and write_header().
|
static |
Definition at line 407 of file format_pcm.c.
References ast_filestream::_private, ast_log, AST_LOG_WARNING, desc, errno, ast_filestream::f, au_desc::hdr_size, max, min, and SEEK_FORCECUR.
|
static |
Definition at line 467 of file format_pcm.c.
References ast_filestream::_private, desc, ast_filestream::f, and au_desc::hdr_size.
|
static |
Definition at line 447 of file format_pcm.c.
References ast_log, AST_LOG_WARNING, errno, ast_filestream::f, and update_header().
|
static |
Definition at line 276 of file format_pcm.c.
References ast_filestream::_private, ast_log, AU_ENC_8BIT_ULAW, AU_HDR_CHANNELS_OFF, AU_HDR_ENCODING_OFF, AU_HDR_HDR_SIZE_OFF, AU_HDR_MAGIC_OFF, AU_HDR_SAMPLE_RATE_OFF, AU_HEADER, AU_MAGIC, channels, DEFAULT_SAMPLE_RATE, desc, encoding, ast_filestream::f, au_desc::hdr_size, LOG_WARNING, and MIN_AU_HEADER_SIZE.
Referenced by au_open().
|
static |
Definition at line 474 of file format_pcm.c.
References ast_filestream::fr, pcm_read(), and ast_frame::samples.
|
static |
Definition at line 481 of file format_pcm.c.
References pcm_seek().
|
static |
|
static |
Definition at line 552 of file format_pcm.c.
References alaw_silence, ARRAY_LEN, ast_format_alaw, ast_format_def_register, ast_format_g722, ast_format_ulaw, AST_LIN2A, AST_LIN2MU, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, ast_format_def::format, ulaw_silence, and unload_module().
|
static |
Definition at line 79 of file format_pcm.c.
References ast_format_get_name(), AST_FRAME_SET_BUFFER, AST_FRIENDLY_OFFSET, ast_log, ast_filestream::buf, BUF_SIZE, ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, ast_frame_subclass::format, ast_filestream::fr, LOG_WARNING, NULL, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by g722_read().
|
static |
Definition at line 98 of file format_pcm.c.
References alaw_silence, ast_format_alaw, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_log, AST_LOG_WARNING, BUF_SIZE, errno, ast_filestream::f, ast_filestream::fmt, ast_format_def::format, LOG_WARNING, max, MIN, ast_frame::offset, SEEK_FORCECUR, ast_frame::src, and ulaw_silence.
Referenced by g722_seek().
|
static |
Definition at line 175 of file format_pcm.c.
References ast_filestream::f.
Referenced by g722_tell().
|
static |
Definition at line 159 of file format_pcm.c.
References ast_log, AST_LOG_WARNING, errno, and ast_filestream::f.
|
static |
Definition at line 180 of file format_pcm.c.
References ast_filestream::_private, ast_format_alaw, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_log, buf, ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, ast_filestream::fmt, ast_format_def::format, LOG_ERROR, LOG_WARNING, and ast_frame::ptr.
|
static |
Definition at line 544 of file format_pcm.c.
References ast_format_def_unregister(), and ast_format_def::name.
Referenced by load_module().
|
static |
Definition at line 331 of file format_pcm.c.
References ast_filestream::_private, ast_log, AU_HDR_DATA_SIZE_OFF, desc, end, ast_filestream::f, au_desc::hdr_size, and LOG_WARNING.
Referenced by au_trunc().
|
static |
Definition at line 365 of file format_pcm.c.
References ast_filestream::_private, ast_log, AU_ENC_8BIT_ULAW, AU_HDR_CHANNELS_OFF, AU_HDR_DATA_SIZE_OFF, AU_HDR_ENCODING_OFF, AU_HDR_HDR_SIZE_OFF, AU_HDR_MAGIC_OFF, AU_HDR_SAMPLE_RATE_OFF, AU_HEADER, AU_MAGIC, DEFAULT_SAMPLE_RATE, desc, ast_filestream::f, au_desc::hdr_size, LOG_WARNING, and MIN_AU_HEADER_SIZE.
Referenced by au_rewrite().
|
static |
Definition at line 581 of file format_pcm.c.
|
static |
Definition at line 491 of file format_pcm.c.
|
static |
Definition at line 43 of file format_pcm.c.
Referenced by load_module(), and pcm_seek().
|
static |
Definition at line 581 of file format_pcm.c.
|
static |
Definition at line 530 of file format_pcm.c.
|
static |
Definition at line 519 of file format_pcm.c.
|
static |
Definition at line 507 of file format_pcm.c.
|
static |
Definition at line 42 of file format_pcm.c.
Referenced by load_module(), and pcm_seek().