Changeset 376 for libmpc/trunk/libmpcdec/mpc_demux.c
- Timestamp:
- 12/18/07 23:55:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/mpc_demux.c
r358 r376 115 115 */ 116 116 static void 117 mpc_demux_seek(mpc_demux * d, mpc_size_t fpos, mpc_uint32_t min_bytes) { 118 // mpc_uint32_t cur_pos = d->r->tell(d->r); 119 mpc_size_t next_pos; 117 mpc_demux_seek(mpc_demux * d, mpc_seek_t fpos, mpc_uint32_t min_bytes) { 118 mpc_seek_t next_pos; 120 119 mpc_int_t bit_offset; 121 120 … … 142 141 * @return current stream position in bits 143 142 */ 144 mpc_size_t mpc_demux_pos(mpc_demux * d) 145 { 146 return ((d->r->tell(d->r) - d->bytes_total + d->bits_reader.buff - d->buffer) << 3) + 8 - d->bits_reader.count; 143 mpc_seek_t mpc_demux_pos(mpc_demux * d) 144 { 145 return (((mpc_seek_t)(d->r->tell(d->r)) - d->bytes_total + 146 d->bits_reader.buff - d->buffer) << 3) + 8 - d->bits_reader.count; 147 147 } 148 148 … … 208 208 if (d->si.block_pwr > d->seek_pwr) 209 209 d->seek_pwr = d->si.block_pwr; 210 d->seek_table = malloc((size_t)(2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_ uint32_t));210 d->seek_table = malloc((size_t)(2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_seek_t)); 211 211 if (d->seek_table == 0) 212 212 return MPC_STATUS_FILE; 213 d->seek_table[0] = (mpc_ uint32_t)mpc_demux_pos(d);213 d->seek_table[0] = (mpc_seek_t)mpc_demux_pos(d); 214 214 d->seek_table_size = 1; 215 215 … … 220 220 { 221 221 mpc_uint64_t tmp; 222 mpc_ uint32_t * table;222 mpc_seek_t * table; 223 223 mpc_bits_reader r = d->bits_reader; 224 224 mpc_uint_t i; … … 228 228 229 229 mpc_bits_get_size(&r, &tmp); 230 d->seek_table_size = (mpc_ uint32_t) tmp;230 d->seek_table_size = (mpc_seek_t) tmp; 231 231 d->seek_pwr = d->si.block_pwr + mpc_bits_read(&r, 4); 232 232 tmp = 2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr); 233 233 if (tmp < d->seek_table_size) tmp = d->seek_table_size; 234 d->seek_table = malloc((size_t)(tmp * sizeof(mpc_ uint32_t)));234 d->seek_table = malloc((size_t)(tmp * sizeof(mpc_seek_t))); 235 235 236 236 table = d->seek_table; 237 237 mpc_bits_get_size(&r, &tmp); 238 table[0] = (mpc_ uint32_t) (tmp + d->si.header_position) * 8;238 table[0] = (mpc_seek_t) (tmp + d->si.header_position) * 8; 239 239 240 240 if (d->seek_table_size == 1) … … 242 242 243 243 mpc_bits_get_size(&r, &tmp); 244 table[1] = (mpc_ uint32_t) (tmp + d->si.header_position) * 8;244 table[1] = (mpc_seek_t) (tmp + d->si.header_position) * 8; 245 245 246 246 for (i = 2; i < d->seek_table_size; i++) { … … 255 255 static void mpc_demux_SP(mpc_demux * d, int size, int block_size) 256 256 { 257 mpc_s ize_t cur;257 mpc_seek_t cur; 258 258 mpc_uint64_t ptr; 259 259 mpc_block b; … … 376 376 d->bits_reader.count &= -8; 377 377 if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) { 378 d->seek_table[d->seek_table_size] = (mpc_ uint32_t) mpc_demux_pos(d);378 d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d); 379 379 d->seek_table_size ++; 380 380 } … … 407 407 } else { 408 408 if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) { 409 d->seek_table[d->seek_table_size] = (mpc_ uint32_t) mpc_demux_pos(d);409 d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d); 410 410 d->seek_table_size ++; 411 411 } … … 434 434 mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample) 435 435 { 436 mpc_uint32_t fwd, samples_to_skip, fpos,i;436 mpc_uint32_t fwd, samples_to_skip, i; 437 437 mpc_uint32_t block_samples = MPC_FRAME_LENGTH << d->si.block_pwr; 438 mpc_seek_t fpos; 438 439 439 440 destsample += d->si.beg_silence; … … 467 468 if (memcmp(b.key, "AP", 2) == 0) { 468 469 if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) { 469 d->seek_table[d->seek_table_size] = (mpc_ uint32_t) mpc_demux_pos(d) - 8 * size;470 d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d) - 8 * size; 470 471 d->seek_table_size ++; 471 472 } … … 483 484 for( ; i < fwd; i++){ 484 485 if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) { 485 d->seek_table[d->seek_table_size] = (mpc_ uint32_t) mpc_demux_pos(d);486 d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d); 486 487 d->seek_table_size ++; 487 488 }
Note: See TracChangeset
for help on using the changeset viewer.