49    unsigned long start_time;
 
   53static unsigned long get_time(
void)
 
   63    return cur * 1000 / sysconf( _SC_CLK_TCK );
 
   69        pd->starttime = get_time();
 
  103    if ((cur = ftello(fs->
f)) < 0) {
 
  108    if (fseeko(fs->
f, 0, SEEK_END) < 0) {
 
  113    if ((
max = ftello(fs->
f)) < 0) {
 
  127        offset = cur + sample_offset;
 
  154        ret = fseeko(fs->
f, 
offset, SEEK_SET);
 
 
  163    if ((fd = fileno(fs->
f)) < 0) {
 
  167    if ((cur = ftello(fs->
f)) < 0) {
 
  172    return ftruncate(fd, cur);
 
 
  177    return ftello(fs->
f);
 
 
  186        struct pcm_desc *pd = (
struct pcm_desc *)fs->
_private;
 
  187        struct stat stat_buf;
 
  188        unsigned long cur_time = get_time();
 
  189        unsigned long fpos = ( cur_time - pd->start_time ) * 8; 
 
  194        fstat(fileno(fs->
f), &stat_buf );
 
  195        if (stat_buf.st_size > fpos )
 
  198        if (stat_buf.st_size < fpos) {
 
  201            unsigned long cur, to_write;
 
  203            cur = stat_buf.st_size;
 
  204            if (fseek(fs->
f, cur, SEEK_SET) < 0) {
 
  208            memset(
buf, 0x55, 512);
 
  210                to_write = fpos - cur;
 
  211                if (to_write > 
sizeof(
buf))
 
  212                    to_write = 
sizeof(
buf);
 
  213                if (fwrite(
buf, 1, to_write, fs->
f) != to_write) {
 
  221        if (fseek(s->
f, fpos, SEEK_SET) < 0) {
 
 
  237#define MIN_AU_HEADER_SIZE  24 
  238#define AU_HEADER(var)      uint32_t var[6] 
  240#define AU_HDR_MAGIC_OFF    0 
  241#define AU_HDR_HDR_SIZE_OFF 1 
  242#define AU_HDR_DATA_SIZE_OFF    2 
  243#define AU_HDR_ENCODING_OFF 3 
  244#define AU_HDR_SAMPLE_RATE_OFF  4 
  245#define AU_HDR_CHANNELS_OFF 5 
  247#define AU_ENC_8BIT_ULAW    1 
  249#define AU_MAGIC 0x2e736e64 
  250#if __BYTE_ORDER == __BIG_ENDIAN 
  256#if __BYTE_ORDER == __LITTLE_ENDIAN 
  258          (((((b)      ) & 0xFF) << 24) | \ 
  259           ((((b) >>  8) & 0xFF) << 16) | \ 
  260           ((((b) >> 16) & 0xFF) <<  8) | \ 
  261           ((((b) >> 24) & 0xFF)      )) 
  263          (((((b)      ) & 0xFF) << 8) | \ 
  264           ((((b) >> 8) & 0xFF)      )) 
  265#define ltohl(b) htoll(b) 
  266#define ltohs(b) htols(b) 
  268#error "Endianess not defined" 
  283    uint32_t sample_rate;
 
  318    fseek(f, 0, SEEK_END);
 
  320    if (fseek(f, 
hdr_size, SEEK_SET) == -1 ) {
 
 
  340    fseek(f, 0, SEEK_END);
 
  344    datalen = 
htoll(bytes);
 
  354    if (fwrite(&datalen, 1, 
sizeof(datalen), f) != 
sizeof(datalen)) {
 
  358    if (fseek(f, cur, SEEK_SET)) {
 
 
  380    fseek(f, 0, SEEK_SET);
 
 
  415    if ((cur = ftello(fs->
f)) < 0) {
 
  420    if (fseeko(fs->
f, 0, SEEK_END) < 0) {
 
  425    if ((
max = ftello(fs->
f)) < 0) {
 
  430    if (whence == SEEK_SET)
 
  431        offset = sample_offset + 
min;
 
  433        offset = sample_offset + cur;
 
  434    else if (whence == SEEK_END)
 
  435        offset = 
max - sample_offset;
 
  438        offset = (offset > 
max) ? 
max : offset;
 
  442    offset = (offset < 
min) ? 
min : offset;
 
  444    return fseeko(fs->
f, offset, SEEK_SET);
 
 
  452    if ((fd = fileno(fs->
f)) < 0) {
 
  456    if ((cur = ftello(fs->
f)) < 0) {
 
  461    if (ftruncate(fd, cur)) {
 
 
  470    off_t offset = ftello(fs->
f);
 
  471    return offset - 
desc->hdr_size;
 
 
  477    *whennext = s->
fr.
samples = (*whennext * 2);
 
 
  483    return pcm_seek(fs, sample_offset / 2, whence);
 
 
  493    .exts = 
"alaw|al|alw",
 
  502    .rewrite = pcma_rewrite,
 
  503    .desc_size = 
sizeof(
struct pcm_desc),
 
 
  509    .exts = 
"pcm|ulaw|ul|mu|ulw",
 
  510    .mime_types = 
"audio/basic",
 
 
  541    .desc_size = 
sizeof(
struct au_desc),
 
 
A-Law to Signed linear conversion.
Asterisk main include file. File version handling, generic pbx functions.
#define DEFAULT_SAMPLE_RATE
static struct channel_usage channels
Asterisk architecture endianess compatibility definitions.
#define AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen)
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
struct ast_frame fr
frame produced by read, typically
struct ast_format_def * fmt
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@239 data
u-Law to Signed linear conversion