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 "asterisk/format_cache.h"
#include "msgsm.h"

Include dependency graph for format_wav_gsm.c:

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 void wav_close (struct ast_filestream *s)
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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .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_def 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 49 of file format_wav_gsm.c.

#define GSM_SAMPLES   160

Definition at line 52 of file format_wav_gsm.c.

#define MSGSM_DATA_OFFSET   60

Definition at line 51 of file format_wav_gsm.c.

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

#define MSGSM_FRAME_SIZE   65

Definition at line 50 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 53 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 587 of file format_wav_gsm.c.

static void __unreg_module ( void   )  [static]

Definition at line 587 of file format_wav_gsm.c.

static int check_header ( FILE *  f  )  [static]

Definition at line 93 of file format_wav_gsm.c.

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

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

static int load_module ( void   )  [static]

static int unload_module ( void   )  [static]

Definition at line 577 of file format_wav_gsm.c.

References ast_format_def_unregister(), and ast_format_def::name.

00578 {
00579    return ast_format_def_unregister(wav49_f.name);
00580 }

static int update_header ( FILE *  f  )  [static]

Definition at line 213 of file format_wav_gsm.c.

References ast_log, end, LOG_WARNING, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.

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

static void wav_close ( struct ast_filestream s  )  [static]

Definition at line 399 of file format_wav_gsm.c.

References ast_filestream::f, ast_filestream::filename, ast_filestream::mode, and update_header().

00400 {
00401    if (s->mode == O_RDONLY) {
00402       return;
00403    }
00404 
00405    if (s->filename) {
00406       update_header(s->f);
00407    }
00408 }

static int wav_open ( struct ast_filestream s  )  [static]

Definition at line 375 of file format_wav_gsm.c.

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

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

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

Definition at line 410 of file format_wav_gsm.c.

References ast_filestream::_private, AST_FRAME_SET_BUFFER, AST_FRIENDLY_OFFSET, ast_log, ast_filestream::buf, conv65(), ast_frame::data, errno, ast_filestream::f, ast_filestream::fr, GSM_FRAME_SIZE, GSM_SAMPLES, LOG_WARNING, MSGSM_FRAME_SIZE, NULL, ast_frame::offset, ast_frame::ptr, ast_frame::samples, and wavg_desc::secondhalf.

00411 {
00412    /* Send a frame from the file to the appropriate channel */
00413    struct wavg_desc *fs = (struct wavg_desc *)s->_private;
00414 
00415    s->fr.samples = GSM_SAMPLES;
00416    AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE);
00417    if (fs->secondhalf) {
00418       /* Just return a frame based on the second GSM frame */
00419       s->fr.data.ptr = (char *)s->fr.data.ptr + GSM_FRAME_SIZE;
00420       s->fr.offset += GSM_FRAME_SIZE;
00421    } else {
00422       /* read and convert */
00423       unsigned char msdata[MSGSM_FRAME_SIZE];
00424       int res;
00425       
00426       if ((res = fread(msdata, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) {
00427          if (res && (res != 1))
00428             ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
00429          return NULL;
00430       }
00431       /* Convert from MS format to two real GSM frames */
00432       conv65(msdata, s->fr.data.ptr);
00433    }
00434    fs->secondhalf = !fs->secondhalf;
00435    *whennext = GSM_SAMPLES;
00436    return &s->fr;
00437 }

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

Definition at line 388 of file format_wav_gsm.c.

References ast_filestream::f, and write_header().

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

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

Definition at line 477 of file format_wav_gsm.c.

References ast_filestream::_private, ast_log, AST_LOG_WARNING, errno, ast_filestream::f, LOG_WARNING, max, min, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, MSGSM_SAMPLES, wavg_desc::secondhalf, and SEEK_FORCECUR.

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

static off_t wav_tell ( struct ast_filestream fs  )  [static]

Definition at line 545 of file format_wav_gsm.c.

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

00546 {
00547    off_t offset;
00548    offset = ftello(fs->f);
00549    /* since this will most likely be used later in play or record, lets stick
00550     * to that level of resolution, just even frames boundaries */
00551    return (offset - MSGSM_DATA_OFFSET)/MSGSM_FRAME_SIZE*MSGSM_SAMPLES;
00552 }

static int wav_trunc ( struct ast_filestream fs  )  [static]

Definition at line 525 of file format_wav_gsm.c.

References ast_log, AST_LOG_WARNING, errno, ast_filestream::f, and update_header().

00526 {
00527    int fd;
00528    off_t cur;
00529 
00530    if ((fd = fileno(fs->f)) < 0) {
00531       ast_log(AST_LOG_WARNING, "Unable to determine file descriptor for WAV filestream %p: %s\n", fs, strerror(errno));
00532       return -1;
00533    }
00534    if ((cur = ftello(fs->f)) < 0) {
00535       ast_log(AST_LOG_WARNING, "Unable to determine current position in WAV filestream %p: %s\n", fs, strerror(errno));
00536       return -1;
00537    }
00538    /* Truncate file to current length */
00539    if (ftruncate(fd, cur)) {
00540       return -1;
00541    }
00542    return update_header(fs->f);
00543 }

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

Definition at line 439 of file format_wav_gsm.c.

References ast_filestream::_private, ast_log, ast_filestream::buf, conv66(), ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, GSM_FRAME_SIZE, len(), LOG_WARNING, MSGSM_FRAME_SIZE, NULL, ast_frame::ptr, and wavg_desc::secondhalf.

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

static int write_header ( FILE *  f  )  [static]

Definition at line 261 of file format_wav_gsm.c.

References ast_log, LOG_WARNING, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.

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


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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } [static]

Definition at line 587 of file format_wav_gsm.c.

Definition at line 587 of file format_wav_gsm.c.

char msgsm_silence[] [static]

Definition at line 56 of file format_wav_gsm.c.

struct ast_format_def wav49_f [static]

Definition at line 554 of file format_wav_gsm.c.


Generated on Thu Apr 16 06:31:08 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6