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"
Go to the source code of this file.
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_HEADER_SIZE 24 |
#define | AU_MAGIC 0x2e736e64 |
#define | BUF_SIZE 160 /* 160 bytes, and same number of samples */ |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (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 (FILE *f) |
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 (FILE *f) |
static int | write_header (FILE *f) |
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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } |
static struct ast_format | alaw_f |
static char | alaw_silence [BUF_SIZE] |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_format | au_f |
static struct ast_format | g722_f |
static struct ast_format | 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 257 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_CHANNELS_OFF 5 |
Definition at line 255 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_DATA_SIZE_OFF 2 |
Definition at line 252 of file format_pcm.c.
Referenced by update_header(), and write_header().
#define AU_HDR_ENCODING_OFF 3 |
Definition at line 253 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_HDR_SIZE_OFF 1 |
Definition at line 251 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_MAGIC_OFF 0 |
Definition at line 250 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HDR_SAMPLE_RATE_OFF 4 |
Definition at line 254 of file format_pcm.c.
Referenced by check_header(), and write_header().
Definition at line 248 of file format_pcm.c.
Referenced by check_header(), and write_header().
#define AU_HEADER_SIZE 24 |
Definition at line 247 of file format_pcm.c.
Referenced by au_seek(), au_tell(), check_header(), update_header(), and write_header().
#define AU_MAGIC 0x2e736e64 |
Definition at line 259 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 41 of file format_pcm.c.
Referenced by pcm_read(), and pcm_seek().
|
static |
Definition at line 550 of file format_pcm.c.
|
static |
Definition at line 550 of file format_pcm.c.
|
static |
|
static |
|
static |
Definition at line 397 of file format_pcm.c.
References AST_FORMAT_G722, ast_log(), AST_LOG_WARNING, AU_HEADER_SIZE, errno, ast_filestream::f, ast_filestream::fmt, ast_format::format, and SEEK_FORCECUR.
|
static |
|
static |
Definition at line 439 of file format_pcm.c.
References ast_log(), AST_LOG_WARNING, errno, ast_filestream::f, and update_header().
|
static |
Definition at line 282 of file format_pcm.c.
References 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_HEADER_SIZE, AU_MAGIC, channels, DEFAULT_SAMPLE_RATE, encoding, and LOG_WARNING.
Referenced by au_open().
|
static |
Definition at line 520 of file format_pcm.c.
References ARRAY_LEN, ast_format_register, AST_LIN2A, AST_LIN2MU, AST_MODULE_LOAD_FAILURE, and AST_MODULE_LOAD_SUCCESS.
|
static |
Definition at line 80 of file format_pcm.c.
References AST_FORMAT_G722, AST_FRAME_SET_BUFFER, AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), ast_filestream::buf, BUF_SIZE, ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, ast_filestream::fmt, ast_format::format, ast_filestream::fr, ast_frame::frametype, LOG_WARNING, ast_frame::mallocd, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
|
static |
Definition at line 103 of file format_pcm.c.
References AST_FORMAT_ALAW, ast_log(), AST_LOG_WARNING, BUF_SIZE, errno, ast_filestream::f, ast_filestream::fmt, ast_format::format, LOG_WARNING, ast_frame::offset, SEEK_FORCECUR, and ast_frame::src.
|
static |
Definition at line 179 of file format_pcm.c.
References ast_filestream::f.
|
static |
Definition at line 163 of file format_pcm.c.
References ast_log(), AST_LOG_WARNING, errno, and ast_filestream::f.
|
static |
Definition at line 184 of file format_pcm.c.
References ast_filestream::_private, AST_FORMAT_ALAW, AST_FRAME_VOICE, ast_getformatname(), ast_log(), ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, ast_filestream::fmt, ast_format::format, ast_frame::frametype, LOG_WARNING, ast_frame::ptr, and ast_frame::subclass.
|
static |
Definition at line 538 of file format_pcm.c.
References ast_format_unregister(), and ast_format::name.
|
static |
Definition at line 330 of file format_pcm.c.
References ast_log(), AU_HDR_DATA_SIZE_OFF, AU_HEADER_SIZE, and LOG_WARNING.
Referenced by au_trunc().
|
static |
Definition at line 362 of file format_pcm.c.
References 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_HEADER_SIZE, AU_MAGIC, DEFAULT_SAMPLE_RATE, and LOG_WARNING.
Referenced by au_rewrite().
|
static |
Definition at line 550 of file format_pcm.c.
|
static |
Definition at line 465 of file format_pcm.c.
|
static |
Definition at line 44 of file format_pcm.c.
|
static |
Definition at line 550 of file format_pcm.c.
|
static |
Definition at line 506 of file format_pcm.c.
|
static |
Definition at line 494 of file format_pcm.c.
|
static |
Definition at line 482 of file format_pcm.c.
|
static |
Definition at line 43 of file format_pcm.c.