Ignore:
Timestamp:
11/25/11 00:45:02 (13 years ago)
Author:
r2d
Message:

changes a seeking behavior that confused some people using the library.
mpc_demux_decode() would return zero samples a couple of times requiring the caller to loop over.
patch by DEATH

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/mpc_demux.c

    r473 r476  
    638638
    639639mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i) {
    640         mpc_status s = mpc_demux_decode_inner(d, i);
    641         if (MPC_IS_FAILURE(s))
    642                 i->bits = -1; // we pretend it's end of file
    643         return s;
     640        for(;;) {
     641                // mpc_demux_decode_inner may return 0 samples and require repeated calls after a seek. Loop over until we have data to return.
     642                mpc_status s = mpc_demux_decode_inner(d, i);
     643                if (MPC_IS_FAILURE(s))
     644                        i->bits = -1; // we pretend it's end of file
     645
     646                if (MPC_IS_FAILURE(s) || i->samples > 0)
     647                        return s;
     648        }
    644649}
    645650
Note: See TracChangeset for help on using the changeset viewer.