Sat Mar 10 01:55:24 2012

Asterisk developer's documentation


format_wav_gsm.c File Reference

Save GSM in the proprietary Microsoft format. More...

#include "asterisk.h"
#include "asterisk/mod_format.h"
#include "asterisk/module.h"
#include "asterisk/endian.h"
#include "msgsm.h"

Go to the source code of this file.

Data Structures

struct  wavg_desc

Defines

#define GSM_FRAME_SIZE   33
#define GSM_SAMPLES   160
#define MSGSM_DATA_OFFSET   60
#define MSGSM_FRAME_SIZE   65
#define MSGSM_SAMPLES   (2*GSM_SAMPLES)

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int check_header (FILE *f)
static int load_module (void)
static int unload_module (void)
static int update_header (FILE *f)
static int wav_open (struct ast_filestream *s)
static struct ast_framewav_read (struct ast_filestream *s, int *whennext)
static int wav_rewrite (struct ast_filestream *s, const char *comment)
static int wav_seek (struct ast_filestream *fs, off_t sample_offset, int whence)
static off_t wav_tell (struct ast_filestream *fs)
static int wav_trunc (struct ast_filestream *fs)
static int wav_write (struct ast_filestream *s, struct ast_frame *f)
static int write_header (FILE *f)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Microsoft WAV format (Proprietary GSM)" , .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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND }
static struct ast_module_infoast_module_info = &__mod_info
static char msgsm_silence []
static struct ast_format wav49_f


Detailed Description

Save GSM in the proprietary Microsoft format.

Microsoft WAV format (Proprietary GSM)

Definition in file format_wav_gsm.c.


Define Documentation

#define GSM_FRAME_SIZE   33

Definition at line 48 of file format_wav_gsm.c.

#define GSM_SAMPLES   160

Definition at line 51 of file format_wav_gsm.c.

#define MSGSM_DATA_OFFSET   60

Definition at line 50 of file format_wav_gsm.c.

Referenced by update_header(), wav_seek(), and wav_tell().

#define MSGSM_FRAME_SIZE   65

Definition at line 49 of file format_wav_gsm.c.

Referenced by update_header(), wav_read(), wav_seek(), wav_tell(), wav_write(), and write_header().

#define MSGSM_SAMPLES   (2*GSM_SAMPLES)

Definition at line 52 of file format_wav_gsm.c.

Referenced by update_header(), wav_seek(), wav_tell(), and write_header().


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 559 of file format_wav_gsm.c.

static void __unreg_module ( void   )  [static]

Definition at line 559 of file format_wav_gsm.c.

static int check_header ( FILE *  f  )  [static]

Definition at line 92 of file format_wav_gsm.c.

References ast_log(), DEFAULT_SAMPLE_RATE, format, LOG_WARNING, and type.

00093 {
00094    int type, size, formtype;
00095    int fmt, hsize, fact;
00096    short format, chans;
00097    int freq;
00098    int data;
00099    if (fread(&type, 1, 4, f) != 4) {
00100       ast_log(LOG_WARNING, "Read failed (type)\n");
00101       return -1;
00102    }
00103    if (fread(&size, 1, 4, f) != 4) {
00104       ast_log(LOG_WARNING, "Read failed (size)\n");
00105       return -1;
00106    }
00107    size = ltohl(size);
00108    if (fread(&formtype, 1, 4, f) != 4) {
00109       ast_log(LOG_WARNING, "Read failed (formtype)\n");
00110       return -1;
00111    }
00112    if (memcmp(&type, "RIFF", 4)) {
00113       ast_log(LOG_WARNING, "Does not begin with RIFF\n");
00114       return -1;
00115    }
00116    if (memcmp(&formtype, "WAVE", 4)) {
00117       ast_log(LOG_WARNING, "Does not contain WAVE\n");
00118       return -1;
00119    }
00120    if (fread(&fmt, 1, 4, f) != 4) {
00121       ast_log(LOG_WARNING, "Read failed (fmt)\n");
00122       return -1;
00123    }
00124    if (memcmp(&fmt, "fmt ", 4)) {
00125       ast_log(LOG_WARNING, "Does not say fmt\n");
00126       return -1;
00127    }
00128    if (fread(&hsize, 1, 4, f) != 4) {
00129       ast_log(LOG_WARNING, "Read failed (formtype)\n");
00130       return -1;
00131    }
00132    if (ltohl(hsize) != 20) {
00133       ast_log(LOG_WARNING, "Unexpected header size %d\n", ltohl(hsize));
00134       return -1;
00135    }
00136    if (fread(&format, 1, 2, f) != 2) {
00137       ast_log(LOG_WARNING, "Read failed (format)\n");
00138       return -1;
00139    }
00140    if (ltohs(format) != 49) {
00141       ast_log(LOG_WARNING, "Not a GSM file %d\n", ltohs(format));
00142       return -1;
00143    }
00144    if (fread(&chans, 1, 2, f) != 2) {
00145       ast_log(LOG_WARNING, "Read failed (format)\n");
00146       return -1;
00147    }
00148    if (ltohs(chans) != 1) {
00149       ast_log(LOG_WARNING, "Not in mono %d\n", ltohs(chans));
00150       return -1;
00151    }
00152    if (fread(&freq, 1, 4, f) != 4) {
00153       ast_log(LOG_WARNING, "Read failed (freq)\n");
00154       return -1;
00155    }
00156    if (ltohl(freq) != DEFAULT_SAMPLE_RATE) {
00157       ast_log(LOG_WARNING, "Unexpected frequency %d\n", ltohl(freq));
00158       return -1;
00159    }
00160    /* Ignore the byte frequency */
00161    if (fread(&freq, 1, 4, f) != 4) {
00162       ast_log(LOG_WARNING, "Read failed (X_1)\n");
00163       return -1;
00164    }
00165    /* Ignore the two weird fields */
00166    if (fread(&freq, 1, 4, f) != 4) {
00167       ast_log(LOG_WARNING, "Read failed (X_2/X_3)\n");
00168       return -1;
00169    }
00170    /* Ignore the byte frequency */
00171    if (fread(&freq, 1, 4, f) != 4) {
00172       ast_log(LOG_WARNING, "Read failed (Y_1)\n");
00173       return -1;
00174    }
00175    /* Check for the word fact */
00176    if (fread(&fact, 1, 4, f) != 4) {
00177       ast_log(LOG_WARNING, "Read failed (fact)\n");
00178       return -1;
00179    }
00180    if (memcmp(&fact, "fact", 4)) {
00181       ast_log(LOG_WARNING, "Does not say fact\n");
00182       return -1;
00183    }
00184    /* Ignore the "fact value" */
00185    if (fread(&fact, 1, 4, f) != 4) {
00186       ast_log(LOG_WARNING, "Read failed (fact header)\n");
00187       return -1;
00188    }
00189    if (fread(&fact, 1, 4, f) != 4) {
00190       ast_log(LOG_WARNING, "Read failed (fact value)\n");
00191       return -1;
00192    }
00193    /* Check for the word data */
00194    if (fread(&data, 1, 4, f) != 4) {
00195       ast_log(LOG_WARNING, "Read failed (data)\n");
00196       return -1;
00197    }
00198    if (memcmp(&data, "data", 4)) {
00199       ast_log(LOG_WARNING, "Does not say data\n");
00200       return -1;
00201    }
00202    /* Ignore the data length */
00203    if (fread(&data, 1, 4, f) != 4) {
00204       ast_log(LOG_WARNING, "Read failed (data)\n");
00205       return -1;
00206    }
00207    return 0;
00208 }

static int load_module ( void   )  [static]

Definition at line 543 of file format_wav_gsm.c.

References ast_format_register, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, and wav49_f.

00544 {
00545    if (ast_format_register(&wav49_f))
00546       return AST_MODULE_LOAD_FAILURE;
00547    return AST_MODULE_LOAD_SUCCESS;
00548 }

static int unload_module ( void   )  [static]

Definition at line 550 of file format_wav_gsm.c.

References ast_format_unregister(), ast_format::name, and wav49_f.

00551 {
00552    return ast_format_unregister(wav49_f.name);
00553 }

static int update_header ( FILE *  f  )  [static]

Definition at line 210 of file format_wav_gsm.c.

References ast_log(), LOG_WARNING, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.

00211 {
00212    off_t cur,end,bytes;
00213    int datalen, filelen, samples;
00214 
00215    cur = ftello(f);
00216    fseek(f, 0, SEEK_END);
00217    end = ftello(f);
00218    /* in a gsm WAV, data starts 60 bytes in */
00219    bytes = end - MSGSM_DATA_OFFSET;
00220    samples = htoll(bytes / MSGSM_FRAME_SIZE * MSGSM_SAMPLES);
00221    datalen = htoll(bytes);
00222    filelen = htoll(MSGSM_DATA_OFFSET - 8 + bytes);
00223    if (cur < 0) {
00224       ast_log(LOG_WARNING, "Unable to find our position\n");
00225       return -1;
00226    }
00227    if (fseek(f, 4, SEEK_SET)) {
00228       ast_log(LOG_WARNING, "Unable to set our position\n");
00229       return -1;
00230    }
00231    if (fwrite(&filelen, 1, 4, f) != 4) {
00232       ast_log(LOG_WARNING, "Unable to write file size\n");
00233       return -1;
00234    }
00235    if (fseek(f, 48, SEEK_SET)) {
00236       ast_log(LOG_WARNING, "Unable to set our position\n");
00237       return -1;
00238    }
00239    if (fwrite(&samples, 1, 4, f) != 4) {
00240       ast_log(LOG_WARNING, "Unable to write samples\n");
00241       return -1;
00242    }
00243    if (fseek(f, 56, SEEK_SET)) {
00244       ast_log(LOG_WARNING, "Unable to set our position\n");
00245       return -1;
00246    }
00247    if (fwrite(&datalen, 1, 4, f) != 4) {
00248       ast_log(LOG_WARNING, "Unable to write datalen\n");
00249       return -1;
00250    }
00251    if (fseeko(f, cur, SEEK_SET)) {
00252       ast_log(LOG_WARNING, "Unable to return to position\n");
00253       return -1;
00254    }
00255    return 0;
00256 }

static int wav_open ( struct ast_filestream s  )  [static]

Definition at line 372 of file format_wav_gsm.c.

References ast_filestream::_private, check_header(), ast_filestream::f, and wavg_desc::secondhalf.

00373 {
00374    /* We don't have any header to read or anything really, but
00375       if we did, it would go here.  We also might want to check
00376       and be sure it's a valid file.  */
00377    struct wavg_desc *fs = (struct wavg_desc *)s->_private;
00378 
00379    if (check_header(s->f))
00380       return -1;
00381    fs->secondhalf = 0;  /* not strictly necessary */
00382    return 0;
00383 }

static struct ast_frame* wav_read ( struct ast_filestream s,
int *  whennext 
) [static]

Definition at line 396 of file format_wav_gsm.c.

References ast_filestream::_private, AST_FORMAT_GSM, AST_FRAME_SET_BUFFER, AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), ast_filestream::buf, ast_frame_subclass::codec, conv65(), ast_frame::data, errno, ast_filestream::f, ast_filestream::fr, ast_frame::frametype, GSM_FRAME_SIZE, GSM_SAMPLES, LOG_WARNING, ast_frame::mallocd, MSGSM_FRAME_SIZE, ast_frame::offset, ast_frame::ptr, ast_frame::samples, wavg_desc::secondhalf, and ast_frame::subclass.

00397 {
00398    /* Send a frame from the file to the appropriate channel */
00399    struct wavg_desc *fs = (struct wavg_desc *)s->_private;
00400 
00401    s->fr.frametype = AST_FRAME_VOICE;
00402    s->fr.subclass.codec = AST_FORMAT_GSM;
00403    s->fr.offset = AST_FRIENDLY_OFFSET;
00404    s->fr.samples = GSM_SAMPLES;
00405    s->fr.mallocd = 0;
00406    AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE);
00407    if (fs->secondhalf) {
00408       /* Just return a frame based on the second GSM frame */
00409       s->fr.data.ptr = (char *)s->fr.data.ptr + GSM_FRAME_SIZE;
00410       s->fr.offset += GSM_FRAME_SIZE;
00411    } else {
00412       /* read and convert */
00413       unsigned char msdata[MSGSM_FRAME_SIZE];
00414       int res;
00415       
00416       if ((res = fread(msdata, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) {
00417          if (res && (res != 1))
00418             ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
00419          return NULL;
00420       }
00421       /* Convert from MS format to two real GSM frames */
00422       conv65(msdata, s->fr.data.ptr);
00423    }
00424    fs->secondhalf = !fs->secondhalf;
00425    *whennext = GSM_SAMPLES;
00426    return &s->fr;
00427 }

static int wav_rewrite ( struct ast_filestream s,
const char *  comment 
) [static]

Definition at line 385 of file format_wav_gsm.c.

References ast_filestream::f, and write_header().

00386 {
00387    /* We don't have any header to read or anything really, but
00388       if we did, it would go here.  We also might want to check
00389       and be sure it's a valid file.  */
00390 
00391    if (write_header(s->f))
00392       return -1;
00393    return 0;
00394 }

static int wav_seek ( struct ast_filestream fs,
off_t  sample_offset,
int  whence 
) [static]

Definition at line 476 of file format_wav_gsm.c.

References ast_filestream::_private, ast_log(), errno, ast_filestream::f, LOG_WARNING, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, MSGSM_SAMPLES, msgsm_silence, and SEEK_FORCECUR.

00477 {
00478    off_t offset=0, distance, max;
00479    struct wavg_desc *s = (struct wavg_desc *)fs->_private;
00480 
00481    off_t min = MSGSM_DATA_OFFSET;
00482    off_t cur = ftello(fs->f);
00483    fseek(fs->f, 0, SEEK_END);
00484    max = ftello(fs->f); /* XXX ideally, should round correctly */
00485    /* Compute the distance in bytes, rounded to the block size */
00486    distance = (sample_offset/MSGSM_SAMPLES) * MSGSM_FRAME_SIZE;
00487    if (whence == SEEK_SET)
00488       offset = distance + min;
00489    else if (whence == SEEK_CUR || whence == SEEK_FORCECUR)
00490       offset = distance + cur;
00491    else if (whence == SEEK_END)
00492       offset = max - distance;
00493    /* always protect against seeking past end of header */
00494    if (offset < min)
00495       offset = min;
00496    if (whence != SEEK_FORCECUR) {
00497       if (offset > max)
00498          offset = max;
00499    } else if (offset > max) {
00500       int i;
00501       fseek(fs->f, 0, SEEK_END);
00502       for (i=0; i< (offset - max) / MSGSM_FRAME_SIZE; i++) {
00503          if (!fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f)) {
00504             ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
00505          }
00506       }
00507    }
00508    s->secondhalf = 0;
00509    return fseeko(fs->f, offset, SEEK_SET);
00510 }

static off_t wav_tell ( struct ast_filestream fs  )  [static]

Definition at line 519 of file format_wav_gsm.c.

References ast_filestream::f, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.

00520 {
00521    off_t offset;
00522    offset = ftello(fs->f);
00523    /* since this will most likely be used later in play or record, lets stick
00524     * to that level of resolution, just even frames boundaries */
00525    return (offset - MSGSM_DATA_OFFSET)/MSGSM_FRAME_SIZE*MSGSM_SAMPLES;
00526 }

static int wav_trunc ( struct ast_filestream fs  )  [static]

Definition at line 512 of file format_wav_gsm.c.

References ast_filestream::f, and update_header().

00513 {
00514    if (ftruncate(fileno(fs->f), ftello(fs->f)))
00515       return -1;
00516    return update_header(fs->f);
00517 }

static int wav_write ( struct ast_filestream s,
struct ast_frame f 
) [static]

Definition at line 429 of file format_wav_gsm.c.

References ast_filestream::_private, AST_FORMAT_GSM, AST_FRAME_VOICE, ast_getformatname(), ast_log(), ast_filestream::buf, conv66(), errno, ast_filestream::f, f, GSM_FRAME_SIZE, len(), LOG_WARNING, MSGSM_FRAME_SIZE, and wavg_desc::secondhalf.

00430 {
00431    int len;
00432    int size;
00433    struct wavg_desc *fs = (struct wavg_desc *)s->_private;
00434 
00435    if (f->frametype != AST_FRAME_VOICE) {
00436       ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
00437       return -1;
00438    }
00439    if (f->subclass.codec != AST_FORMAT_GSM) {
00440       ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec));
00441       return -1;
00442    }
00443    /* XXX this might fail... if the input is a multiple of MSGSM_FRAME_SIZE
00444     * we assume it is already in the correct format.
00445     */
00446    if (!(f->datalen % MSGSM_FRAME_SIZE)) {
00447       size = MSGSM_FRAME_SIZE;
00448       fs->secondhalf = 0;
00449    } else {
00450       size = GSM_FRAME_SIZE;
00451    }
00452    for (len = 0; len < f->datalen ; len += size) {
00453       int res;
00454       unsigned char *src, msdata[MSGSM_FRAME_SIZE];
00455       if (fs->secondhalf) {   /* second half of raw gsm to be converted */
00456          memcpy(s->buf + GSM_FRAME_SIZE, f->data.ptr + len, GSM_FRAME_SIZE);
00457          conv66((unsigned char *) s->buf, msdata);
00458          src = msdata;
00459          fs->secondhalf = 0;
00460       } else if (size == GSM_FRAME_SIZE) {   /* first half of raw gsm */
00461          memcpy(s->buf, f->data.ptr + len, GSM_FRAME_SIZE);
00462          src = NULL; /* nothing to write */
00463          fs->secondhalf = 1;
00464       } else { /* raw msgsm data */
00465          src = f->data.ptr + len;
00466       }
00467       if (src && (res = fwrite(src, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) {
00468          ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno));
00469          return -1;
00470       }
00471       update_header(s->f); /* XXX inefficient! */
00472    }
00473    return 0;
00474 }

static int write_header ( FILE *  f  )  [static]

Definition at line 258 of file format_wav_gsm.c.

References ast_log(), LOG_WARNING, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.

00259 {
00260    /* Samples per second (always 8000 for this format). */
00261    unsigned int sample_rate = htoll(8000);
00262    /* Bytes per second (always 1625 for this format). */
00263    unsigned int byte_sample_rate = htoll(1625);
00264    /* This is the size of the "fmt " subchunk */
00265    unsigned int fmtsize = htoll(20);
00266    /* WAV #49 */
00267    unsigned short fmt = htols(49);
00268    /* Mono = 1 channel */
00269    unsigned short chans = htols(1);
00270    /* Each block of data is exactly 65 bytes in size. */
00271    unsigned int block_align = htoll(MSGSM_FRAME_SIZE);
00272    /* Not actually 2, but rounded up to the nearest bit */
00273    unsigned short bits_per_sample = htols(2);
00274    /* Needed for compressed formats */
00275    unsigned short extra_format = htols(MSGSM_SAMPLES);
00276    /* This is the size of the "fact" subchunk */
00277    unsigned int factsize = htoll(4);
00278    /* Number of samples in the data chunk */
00279    unsigned int num_samples = htoll(0);
00280    /* Number of bytes in the data chunk */
00281    unsigned int size = htoll(0);
00282    /* Write a GSM header, ignoring sizes which will be filled in later */
00283 
00284    /*  0: Chunk ID */
00285    if (fwrite("RIFF", 1, 4, f) != 4) {
00286       ast_log(LOG_WARNING, "Unable to write header\n");
00287       return -1;
00288    }
00289    /*  4: Chunk Size */
00290    if (fwrite(&size, 1, 4, f) != 4) {
00291       ast_log(LOG_WARNING, "Unable to write header\n");
00292       return -1;
00293    }
00294    /*  8: Chunk Format */
00295    if (fwrite("WAVE", 1, 4, f) != 4) {
00296       ast_log(LOG_WARNING, "Unable to write header\n");
00297       return -1;
00298    }
00299    /* 12: Subchunk 1: ID */
00300    if (fwrite("fmt ", 1, 4, f) != 4) {
00301       ast_log(LOG_WARNING, "Unable to write header\n");
00302       return -1;
00303    }
00304    /* 16: Subchunk 1: Size (minus 8) */
00305    if (fwrite(&fmtsize, 1, 4, f) != 4) {
00306       ast_log(LOG_WARNING, "Unable to write header\n");
00307       return -1;
00308    }
00309    /* 20: Subchunk 1: Audio format (49) */
00310    if (fwrite(&fmt, 1, 2, f) != 2) {
00311       ast_log(LOG_WARNING, "Unable to write header\n");
00312       return -1;
00313    }
00314    /* 22: Subchunk 1: Number of channels */
00315    if (fwrite(&chans, 1, 2, f) != 2) {
00316       ast_log(LOG_WARNING, "Unable to write header\n");
00317       return -1;
00318    }
00319    /* 24: Subchunk 1: Sample rate */
00320    if (fwrite(&sample_rate, 1, 4, f) != 4) {
00321       ast_log(LOG_WARNING, "Unable to write header\n");
00322       return -1;
00323    }
00324    /* 28: Subchunk 1: Byte rate */
00325    if (fwrite(&byte_sample_rate, 1, 4, f) != 4) {
00326       ast_log(LOG_WARNING, "Unable to write header\n");
00327       return -1;
00328    }
00329    /* 32: Subchunk 1: Block align */
00330    if (fwrite(&block_align, 1, 4, f) != 4) {
00331       ast_log(LOG_WARNING, "Unable to write header\n");
00332       return -1;
00333    }
00334    /* 36: Subchunk 1: Bits per sample */
00335    if (fwrite(&bits_per_sample, 1, 2, f) != 2) {
00336       ast_log(LOG_WARNING, "Unable to write header\n");
00337       return -1;
00338    }
00339    /* 38: Subchunk 1: Extra format bytes */
00340    if (fwrite(&extra_format, 1, 2, f) != 2) {
00341       ast_log(LOG_WARNING, "Unable to write header\n");
00342       return -1;
00343    }
00344    /* 40: Subchunk 2: ID */
00345    if (fwrite("fact", 1, 4, f) != 4) {
00346       ast_log(LOG_WARNING, "Unable to write header\n");
00347       return -1;
00348    }
00349    /* 44: Subchunk 2: Size (minus 8) */
00350    if (fwrite(&factsize, 1, 4, f) != 4) {
00351       ast_log(LOG_WARNING, "Unable to write header\n");
00352       return -1;
00353    }
00354    /* 48: Subchunk 2: Number of samples */
00355    if (fwrite(&num_samples, 1, 4, f) != 4) {
00356       ast_log(LOG_WARNING, "Unable to write header\n");
00357       return -1;
00358    }
00359    /* 52: Subchunk 3: ID */
00360    if (fwrite("data", 1, 4, f) != 4) {
00361       ast_log(LOG_WARNING, "Unable to write header\n");
00362       return -1;
00363    }
00364    /* 56: Subchunk 3: Size */
00365    if (fwrite(&size, 1, 4, f) != 4) {
00366       ast_log(LOG_WARNING, "Unable to write header\n");
00367       return -1;
00368    }
00369    return 0;
00370 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Microsoft WAV format (Proprietary GSM)" , .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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } [static]

Definition at line 559 of file format_wav_gsm.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 559 of file format_wav_gsm.c.

char msgsm_silence[] [static]

Definition at line 55 of file format_wav_gsm.c.

Referenced by wav_seek().

struct ast_format wav49_f [static]

Definition at line 528 of file format_wav_gsm.c.

Referenced by load_module(), and unload_module().


Generated on Sat Mar 10 01:55:24 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7