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 | htoll(b) (b) |
| #define | htols(b) (b) |
| #define | ltohl(b) (b) |
| #define | ltohs(b) (b) |
| #define | MSGSM_DATA_OFFSET 60 |
| #define | MSGSM_FRAME_SIZE 65 |
| #define | MSGSM_SAMPLES (2*GSM_SAMPLES) |
Functions | |
| AST_MODULE_INFO (ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,"Microsoft WAV format (Proprietary GSM)",.load=load_module,.unload=unload_module,.load_pri=10,) | |
| 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_frame * | wav_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 | |
| char | msgsm_silence [] |
| static struct ast_format | wav49_f |
Save GSM in the proprietary Microsoft format.
Microsoft WAV format (Proprietary GSM)
Definition in file format_wav_gsm.c.
| #define GSM_FRAME_SIZE 33 |
Definition at line 44 of file format_wav_gsm.c.
| #define GSM_SAMPLES 160 |
Definition at line 47 of file format_wav_gsm.c.
| #define htoll | ( | b | ) | (b) |
Definition at line 66 of file format_wav_gsm.c.
| #define htols | ( | b | ) | (b) |
Definition at line 67 of file format_wav_gsm.c.
| #define ltohl | ( | b | ) | (b) |
Definition at line 68 of file format_wav_gsm.c.
| #define ltohs | ( | b | ) | (b) |
Definition at line 69 of file format_wav_gsm.c.
| #define MSGSM_DATA_OFFSET 60 |
Definition at line 46 of file format_wav_gsm.c.
Referenced by update_header(), wav_seek(), and wav_tell().
| #define MSGSM_FRAME_SIZE 65 |
Definition at line 45 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 48 of file format_wav_gsm.c.
Referenced by update_header(), wav_seek(), wav_tell(), and write_header().
| AST_MODULE_INFO | ( | ASTERISK_GPL_KEY | , | |
| AST_MODFLAG_LOAD_ORDER | , | |||
| "Microsoft WAV format (Proprietary GSM)" | , | |||
| . | load = load_module, |
|||
| . | unload = unload_module, |
|||
| . | load_pri = 10 | |||
| ) |
| static int check_header | ( | FILE * | f | ) | [static] |
Definition at line 88 of file format_wav_gsm.c.
References ast_log(), DEFAULT_SAMPLE_RATE, format, LOG_WARNING, ltohl, ltohs, and type.
Referenced by wav_open().
00089 { 00090 int type, size, formtype; 00091 int fmt, hsize, fact; 00092 short format, chans; 00093 int freq; 00094 int data; 00095 if (fread(&type, 1, 4, f) != 4) { 00096 ast_log(LOG_WARNING, "Read failed (type)\n"); 00097 return -1; 00098 } 00099 if (fread(&size, 1, 4, f) != 4) { 00100 ast_log(LOG_WARNING, "Read failed (size)\n"); 00101 return -1; 00102 } 00103 size = ltohl(size); 00104 if (fread(&formtype, 1, 4, f) != 4) { 00105 ast_log(LOG_WARNING, "Read failed (formtype)\n"); 00106 return -1; 00107 } 00108 if (memcmp(&type, "RIFF", 4)) { 00109 ast_log(LOG_WARNING, "Does not begin with RIFF\n"); 00110 return -1; 00111 } 00112 if (memcmp(&formtype, "WAVE", 4)) { 00113 ast_log(LOG_WARNING, "Does not contain WAVE\n"); 00114 return -1; 00115 } 00116 if (fread(&fmt, 1, 4, f) != 4) { 00117 ast_log(LOG_WARNING, "Read failed (fmt)\n"); 00118 return -1; 00119 } 00120 if (memcmp(&fmt, "fmt ", 4)) { 00121 ast_log(LOG_WARNING, "Does not say fmt\n"); 00122 return -1; 00123 } 00124 if (fread(&hsize, 1, 4, f) != 4) { 00125 ast_log(LOG_WARNING, "Read failed (formtype)\n"); 00126 return -1; 00127 } 00128 if (ltohl(hsize) != 20) { 00129 ast_log(LOG_WARNING, "Unexpected header size %d\n", ltohl(hsize)); 00130 return -1; 00131 } 00132 if (fread(&format, 1, 2, f) != 2) { 00133 ast_log(LOG_WARNING, "Read failed (format)\n"); 00134 return -1; 00135 } 00136 if (ltohs(format) != 49) { 00137 ast_log(LOG_WARNING, "Not a GSM file %d\n", ltohs(format)); 00138 return -1; 00139 } 00140 if (fread(&chans, 1, 2, f) != 2) { 00141 ast_log(LOG_WARNING, "Read failed (format)\n"); 00142 return -1; 00143 } 00144 if (ltohs(chans) != 1) { 00145 ast_log(LOG_WARNING, "Not in mono %d\n", ltohs(chans)); 00146 return -1; 00147 } 00148 if (fread(&freq, 1, 4, f) != 4) { 00149 ast_log(LOG_WARNING, "Read failed (freq)\n"); 00150 return -1; 00151 } 00152 if (ltohl(freq) != DEFAULT_SAMPLE_RATE) { 00153 ast_log(LOG_WARNING, "Unexpected frequency %d\n", ltohl(freq)); 00154 return -1; 00155 } 00156 /* Ignore the byte frequency */ 00157 if (fread(&freq, 1, 4, f) != 4) { 00158 ast_log(LOG_WARNING, "Read failed (X_1)\n"); 00159 return -1; 00160 } 00161 /* Ignore the two weird fields */ 00162 if (fread(&freq, 1, 4, f) != 4) { 00163 ast_log(LOG_WARNING, "Read failed (X_2/X_3)\n"); 00164 return -1; 00165 } 00166 /* Ignore the byte frequency */ 00167 if (fread(&freq, 1, 4, f) != 4) { 00168 ast_log(LOG_WARNING, "Read failed (Y_1)\n"); 00169 return -1; 00170 } 00171 /* Check for the word fact */ 00172 if (fread(&fact, 1, 4, f) != 4) { 00173 ast_log(LOG_WARNING, "Read failed (fact)\n"); 00174 return -1; 00175 } 00176 if (memcmp(&fact, "fact", 4)) { 00177 ast_log(LOG_WARNING, "Does not say fact\n"); 00178 return -1; 00179 } 00180 /* Ignore the "fact value" */ 00181 if (fread(&fact, 1, 4, f) != 4) { 00182 ast_log(LOG_WARNING, "Read failed (fact header)\n"); 00183 return -1; 00184 } 00185 if (fread(&fact, 1, 4, f) != 4) { 00186 ast_log(LOG_WARNING, "Read failed (fact value)\n"); 00187 return -1; 00188 } 00189 /* Check for the word data */ 00190 if (fread(&data, 1, 4, f) != 4) { 00191 ast_log(LOG_WARNING, "Read failed (data)\n"); 00192 return -1; 00193 } 00194 if (memcmp(&data, "data", 4)) { 00195 ast_log(LOG_WARNING, "Does not say data\n"); 00196 return -1; 00197 } 00198 /* Ignore the data length */ 00199 if (fread(&data, 1, 4, f) != 4) { 00200 ast_log(LOG_WARNING, "Read failed (data)\n"); 00201 return -1; 00202 } 00203 return 0; 00204 }
| static int load_module | ( | void | ) | [static] |
Definition at line 539 of file format_wav_gsm.c.
References ast_format_register, AST_MODULE_LOAD_FAILURE, and AST_MODULE_LOAD_SUCCESS.
00540 { 00541 if (ast_format_register(&wav49_f)) 00542 return AST_MODULE_LOAD_FAILURE; 00543 return AST_MODULE_LOAD_SUCCESS; 00544 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 546 of file format_wav_gsm.c.
References ast_format_unregister(), and ast_format::name.
00547 { 00548 return ast_format_unregister(wav49_f.name); 00549 }
| static int update_header | ( | FILE * | f | ) | [static] |
Definition at line 206 of file format_wav_gsm.c.
References ast_log(), fwrite, htoll, LOG_WARNING, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.
Referenced by wav_trunc(), and wav_write().
00207 { 00208 off_t cur,end,bytes; 00209 int datalen, filelen, samples; 00210 00211 cur = ftello(f); 00212 fseek(f, 0, SEEK_END); 00213 end = ftello(f); 00214 /* in a gsm WAV, data starts 60 bytes in */ 00215 bytes = end - MSGSM_DATA_OFFSET; 00216 samples = htoll(bytes / MSGSM_FRAME_SIZE * MSGSM_SAMPLES); 00217 datalen = htoll(bytes); 00218 filelen = htoll(MSGSM_DATA_OFFSET - 8 + bytes); 00219 if (cur < 0) { 00220 ast_log(LOG_WARNING, "Unable to find our position\n"); 00221 return -1; 00222 } 00223 if (fseek(f, 4, SEEK_SET)) { 00224 ast_log(LOG_WARNING, "Unable to set our position\n"); 00225 return -1; 00226 } 00227 if (fwrite(&filelen, 1, 4, f) != 4) { 00228 ast_log(LOG_WARNING, "Unable to write file size\n"); 00229 return -1; 00230 } 00231 if (fseek(f, 48, SEEK_SET)) { 00232 ast_log(LOG_WARNING, "Unable to set our position\n"); 00233 return -1; 00234 } 00235 if (fwrite(&samples, 1, 4, f) != 4) { 00236 ast_log(LOG_WARNING, "Unable to write samples\n"); 00237 return -1; 00238 } 00239 if (fseek(f, 56, SEEK_SET)) { 00240 ast_log(LOG_WARNING, "Unable to set our position\n"); 00241 return -1; 00242 } 00243 if (fwrite(&datalen, 1, 4, f) != 4) { 00244 ast_log(LOG_WARNING, "Unable to write datalen\n"); 00245 return -1; 00246 } 00247 if (fseeko(f, cur, SEEK_SET)) { 00248 ast_log(LOG_WARNING, "Unable to return to position\n"); 00249 return -1; 00250 } 00251 return 0; 00252 }
| static int wav_open | ( | struct ast_filestream * | s | ) | [static] |
Definition at line 368 of file format_wav_gsm.c.
References ast_filestream::_private, check_header(), ast_filestream::f, and wavg_desc::secondhalf.
00369 { 00370 /* We don't have any header to read or anything really, but 00371 if we did, it would go here. We also might want to check 00372 and be sure it's a valid file. */ 00373 struct wavg_desc *fs = (struct wavg_desc *)s->_private; 00374 00375 if (check_header(s->f)) 00376 return -1; 00377 fs->secondhalf = 0; /* not strictly necessary */ 00378 return 0; 00379 }
| static struct ast_frame* wav_read | ( | struct ast_filestream * | s, | |
| int * | whennext | |||
| ) | [static, read] |
Definition at line 392 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, 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.
00393 { 00394 /* Send a frame from the file to the appropriate channel */ 00395 struct wavg_desc *fs = (struct wavg_desc *)s->_private; 00396 00397 s->fr.frametype = AST_FRAME_VOICE; 00398 s->fr.subclass = AST_FORMAT_GSM; 00399 s->fr.offset = AST_FRIENDLY_OFFSET; 00400 s->fr.samples = GSM_SAMPLES; 00401 s->fr.mallocd = 0; 00402 AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE); 00403 if (fs->secondhalf) { 00404 /* Just return a frame based on the second GSM frame */ 00405 s->fr.data.ptr = (char *)s->fr.data.ptr + GSM_FRAME_SIZE; 00406 s->fr.offset += GSM_FRAME_SIZE; 00407 } else { 00408 /* read and convert */ 00409 unsigned char msdata[MSGSM_FRAME_SIZE]; 00410 int res; 00411 00412 if ((res = fread(msdata, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) { 00413 if (res && (res != 1)) 00414 ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno)); 00415 return NULL; 00416 } 00417 /* Convert from MS format to two real GSM frames */ 00418 conv65(msdata, s->fr.data.ptr); 00419 } 00420 fs->secondhalf = !fs->secondhalf; 00421 *whennext = GSM_SAMPLES; 00422 return &s->fr; 00423 }
| static int wav_rewrite | ( | struct ast_filestream * | s, | |
| const char * | comment | |||
| ) | [static] |
Definition at line 381 of file format_wav_gsm.c.
References ast_filestream::f, and write_header().
00382 { 00383 /* We don't have any header to read or anything really, but 00384 if we did, it would go here. We also might want to check 00385 and be sure it's a valid file. */ 00386 00387 if (write_header(s->f)) 00388 return -1; 00389 return 0; 00390 }
| static int wav_seek | ( | struct ast_filestream * | fs, | |
| off_t | sample_offset, | |||
| int | whence | |||
| ) | [static] |
Definition at line 472 of file format_wav_gsm.c.
References ast_filestream::_private, ast_log(), errno, ast_filestream::f, fwrite, LOG_WARNING, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, MSGSM_SAMPLES, s, wavg_desc::secondhalf, and SEEK_FORCECUR.
00473 { 00474 off_t offset=0, distance, max; 00475 struct wavg_desc *s = (struct wavg_desc *)fs->_private; 00476 00477 off_t min = MSGSM_DATA_OFFSET; 00478 off_t cur = ftello(fs->f); 00479 fseek(fs->f, 0, SEEK_END); 00480 max = ftello(fs->f); /* XXX ideally, should round correctly */ 00481 /* Compute the distance in bytes, rounded to the block size */ 00482 distance = (sample_offset/MSGSM_SAMPLES) * MSGSM_FRAME_SIZE; 00483 if (whence == SEEK_SET) 00484 offset = distance + min; 00485 else if (whence == SEEK_CUR || whence == SEEK_FORCECUR) 00486 offset = distance + cur; 00487 else if (whence == SEEK_END) 00488 offset = max - distance; 00489 /* always protect against seeking past end of header */ 00490 if (offset < min) 00491 offset = min; 00492 if (whence != SEEK_FORCECUR) { 00493 if (offset > max) 00494 offset = max; 00495 } else if (offset > max) { 00496 int i; 00497 fseek(fs->f, 0, SEEK_END); 00498 for (i=0; i< (offset - max) / MSGSM_FRAME_SIZE; i++) { 00499 if (!fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f)) { 00500 ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); 00501 } 00502 } 00503 } 00504 s->secondhalf = 0; 00505 return fseeko(fs->f, offset, SEEK_SET); 00506 }
| static off_t wav_tell | ( | struct ast_filestream * | fs | ) | [static] |
Definition at line 515 of file format_wav_gsm.c.
References ast_filestream::f, MSGSM_DATA_OFFSET, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.
00516 { 00517 off_t offset; 00518 offset = ftello(fs->f); 00519 /* since this will most likely be used later in play or record, lets stick 00520 * to that level of resolution, just even frames boundaries */ 00521 return (offset - MSGSM_DATA_OFFSET)/MSGSM_FRAME_SIZE*MSGSM_SAMPLES; 00522 }
| static int wav_trunc | ( | struct ast_filestream * | fs | ) | [static] |
Definition at line 508 of file format_wav_gsm.c.
References ast_filestream::f, and update_header().
00509 { 00510 if (ftruncate(fileno(fs->f), ftello(fs->f))) 00511 return -1; 00512 return update_header(fs->f); 00513 }
| static int wav_write | ( | struct ast_filestream * | s, | |
| struct ast_frame * | f | |||
| ) | [static] |
Definition at line 425 of file format_wav_gsm.c.
References ast_filestream::_private, AST_FORMAT_GSM, AST_FRAME_VOICE, ast_log(), ast_filestream::buf, conv66(), ast_frame::data, ast_frame::datalen, errno, ast_filestream::f, ast_frame::frametype, fwrite, GSM_FRAME_SIZE, len(), LOG_WARNING, MSGSM_FRAME_SIZE, ast_frame::ptr, wavg_desc::secondhalf, ast_frame::subclass, and update_header().
00426 { 00427 int len; 00428 int size; 00429 struct wavg_desc *fs = (struct wavg_desc *)s->_private; 00430 00431 if (f->frametype != AST_FRAME_VOICE) { 00432 ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); 00433 return -1; 00434 } 00435 if (f->subclass != AST_FORMAT_GSM) { 00436 ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass); 00437 return -1; 00438 } 00439 /* XXX this might fail... if the input is a multiple of MSGSM_FRAME_SIZE 00440 * we assume it is already in the correct format. 00441 */ 00442 if (!(f->datalen % MSGSM_FRAME_SIZE)) { 00443 size = MSGSM_FRAME_SIZE; 00444 fs->secondhalf = 0; 00445 } else { 00446 size = GSM_FRAME_SIZE; 00447 } 00448 for (len = 0; len < f->datalen ; len += size) { 00449 int res; 00450 unsigned char *src, msdata[MSGSM_FRAME_SIZE]; 00451 if (fs->secondhalf) { /* second half of raw gsm to be converted */ 00452 memcpy(s->buf + GSM_FRAME_SIZE, f->data.ptr + len, GSM_FRAME_SIZE); 00453 conv66((unsigned char *) s->buf, msdata); 00454 src = msdata; 00455 fs->secondhalf = 0; 00456 } else if (size == GSM_FRAME_SIZE) { /* first half of raw gsm */ 00457 memcpy(s->buf, f->data.ptr + len, GSM_FRAME_SIZE); 00458 src = NULL; /* nothing to write */ 00459 fs->secondhalf = 1; 00460 } else { /* raw msgsm data */ 00461 src = f->data.ptr + len; 00462 } 00463 if (src && (res = fwrite(src, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) { 00464 ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno)); 00465 return -1; 00466 } 00467 update_header(s->f); /* XXX inefficient! */ 00468 } 00469 return 0; 00470 }
| static int write_header | ( | FILE * | f | ) | [static] |
Definition at line 254 of file format_wav_gsm.c.
References ast_log(), fwrite, htoll, htols, LOG_WARNING, MSGSM_FRAME_SIZE, and MSGSM_SAMPLES.
Referenced by wav_rewrite().
00255 { 00256 /* Samples per second (always 8000 for this format). */ 00257 unsigned int sample_rate = htoll(8000); 00258 /* Bytes per second (always 1625 for this format). */ 00259 unsigned int byte_sample_rate = htoll(1625); 00260 /* This is the size of the "fmt " subchunk */ 00261 unsigned int fmtsize = htoll(20); 00262 /* WAV #49 */ 00263 unsigned short fmt = htols(49); 00264 /* Mono = 1 channel */ 00265 unsigned short chans = htols(1); 00266 /* Each block of data is exactly 65 bytes in size. */ 00267 unsigned int block_align = htoll(MSGSM_FRAME_SIZE); 00268 /* Not actually 2, but rounded up to the nearest bit */ 00269 unsigned short bits_per_sample = htols(2); 00270 /* Needed for compressed formats */ 00271 unsigned short extra_format = htols(MSGSM_SAMPLES); 00272 /* This is the size of the "fact" subchunk */ 00273 unsigned int factsize = htoll(4); 00274 /* Number of samples in the data chunk */ 00275 unsigned int num_samples = htoll(0); 00276 /* Number of bytes in the data chunk */ 00277 unsigned int size = htoll(0); 00278 /* Write a GSM header, ignoring sizes which will be filled in later */ 00279 00280 /* 0: Chunk ID */ 00281 if (fwrite("RIFF", 1, 4, f) != 4) { 00282 ast_log(LOG_WARNING, "Unable to write header\n"); 00283 return -1; 00284 } 00285 /* 4: Chunk Size */ 00286 if (fwrite(&size, 1, 4, f) != 4) { 00287 ast_log(LOG_WARNING, "Unable to write header\n"); 00288 return -1; 00289 } 00290 /* 8: Chunk Format */ 00291 if (fwrite("WAVE", 1, 4, f) != 4) { 00292 ast_log(LOG_WARNING, "Unable to write header\n"); 00293 return -1; 00294 } 00295 /* 12: Subchunk 1: ID */ 00296 if (fwrite("fmt ", 1, 4, f) != 4) { 00297 ast_log(LOG_WARNING, "Unable to write header\n"); 00298 return -1; 00299 } 00300 /* 16: Subchunk 1: Size (minus 8) */ 00301 if (fwrite(&fmtsize, 1, 4, f) != 4) { 00302 ast_log(LOG_WARNING, "Unable to write header\n"); 00303 return -1; 00304 } 00305 /* 20: Subchunk 1: Audio format (49) */ 00306 if (fwrite(&fmt, 1, 2, f) != 2) { 00307 ast_log(LOG_WARNING, "Unable to write header\n"); 00308 return -1; 00309 } 00310 /* 22: Subchunk 1: Number of channels */ 00311 if (fwrite(&chans, 1, 2, f) != 2) { 00312 ast_log(LOG_WARNING, "Unable to write header\n"); 00313 return -1; 00314 } 00315 /* 24: Subchunk 1: Sample rate */ 00316 if (fwrite(&sample_rate, 1, 4, f) != 4) { 00317 ast_log(LOG_WARNING, "Unable to write header\n"); 00318 return -1; 00319 } 00320 /* 28: Subchunk 1: Byte rate */ 00321 if (fwrite(&byte_sample_rate, 1, 4, f) != 4) { 00322 ast_log(LOG_WARNING, "Unable to write header\n"); 00323 return -1; 00324 } 00325 /* 32: Subchunk 1: Block align */ 00326 if (fwrite(&block_align, 1, 4, f) != 4) { 00327 ast_log(LOG_WARNING, "Unable to write header\n"); 00328 return -1; 00329 } 00330 /* 36: Subchunk 1: Bits per sample */ 00331 if (fwrite(&bits_per_sample, 1, 2, f) != 2) { 00332 ast_log(LOG_WARNING, "Unable to write header\n"); 00333 return -1; 00334 } 00335 /* 38: Subchunk 1: Extra format bytes */ 00336 if (fwrite(&extra_format, 1, 2, f) != 2) { 00337 ast_log(LOG_WARNING, "Unable to write header\n"); 00338 return -1; 00339 } 00340 /* 40: Subchunk 2: ID */ 00341 if (fwrite("fact", 1, 4, f) != 4) { 00342 ast_log(LOG_WARNING, "Unable to write header\n"); 00343 return -1; 00344 } 00345 /* 44: Subchunk 2: Size (minus 8) */ 00346 if (fwrite(&factsize, 1, 4, f) != 4) { 00347 ast_log(LOG_WARNING, "Unable to write header\n"); 00348 return -1; 00349 } 00350 /* 48: Subchunk 2: Number of samples */ 00351 if (fwrite(&num_samples, 1, 4, f) != 4) { 00352 ast_log(LOG_WARNING, "Unable to write header\n"); 00353 return -1; 00354 } 00355 /* 52: Subchunk 3: ID */ 00356 if (fwrite("data", 1, 4, f) != 4) { 00357 ast_log(LOG_WARNING, "Unable to write header\n"); 00358 return -1; 00359 } 00360 /* 56: Subchunk 3: Size */ 00361 if (fwrite(&size, 1, 4, f) != 4) { 00362 ast_log(LOG_WARNING, "Unable to write header\n"); 00363 return -1; 00364 } 00365 return 0; 00366 }
| char msgsm_silence[] |
Definition at line 51 of file format_wav_gsm.c.
struct ast_format wav49_f [static] |
Definition at line 524 of file format_wav_gsm.c.
1.6.1