Changeset 463 for libmpc/trunk/libmpcdec/mpc_demux.c
- Timestamp:
- 07/13/10 12:34:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/mpc_demux.c
r462 r463 354 354 char * ptag; 355 355 d->chap = malloc(sizeof(mpc_chap_info) * d->chap_nb + tag_size); 356 ptag = (char*)(d->chap + d->chap_nb); 357 358 mpc_demux_seek(d, d->chap_pos, 11); 359 size = mpc_bits_get_block(&d->bits_reader, &b); 360 while (memcmp(b.key, "CT", 2) == 0) { 361 mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0); 362 size = mpc_bits_get_size(&d->bits_reader, &d->chap[i].sample) + 4; 363 d->chap[i].gain = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 364 d->chap[i].peak = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 365 memcpy(ptag, d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3), b.size - size); 366 d->bits_reader.buff += b.size - size; 367 d->chap[i].tag_size = b.size - size; 368 d->chap[i].tag = ptag; 369 ptag += b.size - size; 370 i++; 356 if (d->chap != 0) { 357 ptag = (char*)(d->chap + d->chap_nb); 358 359 mpc_demux_seek(d, d->chap_pos, 11); 371 360 size = mpc_bits_get_block(&d->bits_reader, &b); 361 while (memcmp(b.key, "CT", 2) == 0) { 362 mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0); 363 size = mpc_bits_get_size(&d->bits_reader, &d->chap[i].sample) + 4; 364 d->chap[i].gain = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 365 d->chap[i].peak = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 366 memcpy(ptag, d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3), b.size - size); 367 d->bits_reader.buff += b.size - size; 368 d->chap[i].tag_size = b.size - size; 369 d->chap[i].tag = ptag; 370 ptag += b.size - size; 371 i++; 372 size = mpc_bits_get_block(&d->bits_reader, &b); 373 } 374 } else { 375 d->chap_nb = 0; // malloc failed, chapters will not be available 372 376 } 373 377 }
Note: See TracChangeset
for help on using the changeset viewer.