Changeset 411 for libmpc/trunk/libmpcdec
- Timestamp:
- 10/31/08 00:20:05 (16 years ago)
- Location:
- libmpc/trunk/libmpcdec
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/internal.h
r402 r411 60 60 #define DEMUX_BUFFER_SIZE (65536 - MAX_FRAME_SIZE) // need some space as sand box 61 61 62 typedef struct {63 mpc_uint64_t sample; /// sample where the chapter starts64 mpc_uint_t tag_size; /// size of the tag element (0 if no tag is present for this chapter)65 char * tag; /// pointer to an APEv2 tag without the preamble66 } mpc_chap_t;67 68 62 struct mpc_demux_t { 69 63 mpc_reader * r; … … 86 80 mpc_seek_t chap_pos; /// supposed position of the first chapter block 87 81 mpc_int_t chap_nb; /// number of chapters (-1 if unknown, 0 if no chapter) 88 mpc_chap_ t* chap; /// chapters position and tag82 mpc_chap_info * chap; /// chapters position and tag 89 83 90 84 }; -
libmpc/trunk/libmpcdec/mpc_demux.c
r407 r411 331 331 d->chap_nb++; 332 332 chap_size += size; 333 size = mpc_bits_get_size(&d->bits_reader, &chap_sample) ;333 size = mpc_bits_get_size(&d->bits_reader, &chap_sample) + 4; 334 334 chap_size += size; 335 335 tag_size += b.size - size; … … 340 340 if (d->chap_nb > 0) { 341 341 char * ptag; 342 d->chap = malloc(sizeof(mpc_chap_ t) * d->chap_nb + tag_size);342 d->chap = malloc(sizeof(mpc_chap_info) * d->chap_nb + tag_size); 343 343 ptag = (char*)(d->chap + d->chap_nb); 344 344 … … 347 347 while (memcmp(b.key, "CT", 2) == 0) { 348 348 mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0); 349 size = mpc_bits_get_size(&d->bits_reader, &d->chap[i].sample); 349 size = mpc_bits_get_size(&d->bits_reader, &d->chap[i].sample) + 4; 350 d->chap[i].gain = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 351 d->chap[i].peak = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16); 350 352 memcpy(ptag, d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3), b.size - size); 351 353 d->bits_reader.buff += b.size - size; … … 375 377 /** 376 378 * Gets datas associated to a given chapter 377 * You can pass 0 for tag and tag_size if you don't needs the tag information378 379 * The chapter tag is an APEv2 tag without the preamble 379 380 * @param d pointer to a musepack demuxer 380 381 * @param chap_nb chapter number you want datas (from 0 to mpc_demux_chap_nb(d) - 1) 381 * @param tag will return a pointer to the chapter tag datas 382 * @param tag_size will be filed with the tag data size (0 if no tag for this chapter) 383 * @return the sample where the chapter starts 382 * @return the chapter information structure 384 383 */ 385 mpc_ uint64_t mpc_demux_chap(mpc_demux * d, int chap_nb, char ** tag, mpc_uint_t * tag_size)384 mpc_chap_info * mpc_demux_chap(mpc_demux * d, int chap_nb) 386 385 { 387 386 if (d->chap_nb == -1) … … 389 388 if (chap_nb >= d->chap_nb || chap_nb < 0) 390 389 return 0; 391 if (tag != 0 && tag_size != 0) { 392 *tag = d->chap[chap_nb].tag; 393 *tag_size = d->chap[chap_nb].tag_size; 394 } 395 return d->chap[chap_nb].sample; 390 return &d->chap[chap_nb]; 396 391 } 397 392
Note: See TracChangeset
for help on using the changeset viewer.