Changeset 273 for libmpc/branches/r2d/libmpcdec/mpc_demux.c
- Timestamp:
- 04/17/07 14:10:51 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcdec/mpc_demux.c
r271 r273 364 364 } 365 365 366 voidmpc_demux_decode(mpc_demux * d, mpc_frame_info * i)366 mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i) 367 367 { 368 368 mpc_bits_reader r; … … 382 382 if (memcmp(b.key, "SE", 2) == 0) { // end block 383 383 i->bits = -1; 384 return ;384 return MPC_STATUS_OK; 385 385 } 386 386 mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0); … … 392 392 i->is_key_frame = MPC_TRUE; 393 393 } 394 // FIXME : this is not good if block size > buffer size395 mpc_demux_fill(d, (d->block_bits >> 3) + 1, 0);394 if (d->buffer + d->bytes_total - d->bits_reader.buff <= MAX_FRAME_SIZE) 395 mpc_demux_fill(d, (d->block_bits >> 3) + 1, 0); 396 396 r = d->bits_reader; 397 397 mpc_decoder_decode_frame(d->d, &d->bits_reader, i); … … 399 399 d->block_frames--; 400 400 if (d->block_bits < 0 || (d->block_frames == 0 && d->block_bits > 7)) { 401 // an error occured, stop decoding402 // FIXME : return an error code.403 401 i->bits = -1; // we pretend it's end of file 402 return MPC_STATUS_INVALIDSV; 404 403 } 405 404 } else { … … 413 412 mpc_decoder_decode_frame(d->d, &d->bits_reader, i); 414 413 if (d->block_bits != ((d->bits_reader.buff - r.buff) << 3) + r.count - d->bits_reader.count) { 415 // an error occured, stop decoding416 // FIXME : return an error code.417 414 i->bits = -1; // we pretend it's end of file 415 return MPC_STATUS_INVALIDSV; 418 416 } 419 417 } 420 418 if (d->buffer + d->bytes_total < d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3)) { 421 // we're reading outside the buffer bytes, this is an error !422 // FIXME : return an error code.423 419 i->bits = -1; // we pretend it's end of file 424 } 420 return MPC_STATUS_INVALIDSV; 421 } 422 return MPC_STATUS_OK; 425 423 } 426 424
Note: See TracChangeset
for help on using the changeset viewer.