forked from len0rd/rockbox
Fixes backward seeking on resumed files and backward seeking to positions to which formerly was seeked forward to (sounds complicated and it is).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17606 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e1e0bc2675
commit
5670ca18bb
1 changed files with 13 additions and 7 deletions
|
|
@ -1609,18 +1609,15 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample)
|
|||
// seek to the first frame
|
||||
mpc_decoder_seek_to(d, fpos);
|
||||
|
||||
// reset number of decoded frames
|
||||
d->DecodedFrames = 0;
|
||||
|
||||
// jump to the last frame via parsing, updating seek table
|
||||
d->SeekTable[0] = (mpc_uint32_t)fpos;
|
||||
d->SeekTableCounter = d->SeekTable[0];
|
||||
for (d->DecodedFrames = 1; d->DecodedFrames < lastFrame; d->DecodedFrames++)
|
||||
d->SeekTableCounter = 0;
|
||||
for (d->DecodedFrames = 0; d->DecodedFrames < lastFrame; d->DecodedFrames++)
|
||||
{
|
||||
d->SeekTableCounter += mpc_decoder_jump_frame(d);
|
||||
if (0 == (d->DecodedFrames % d->SeekTable_Step))
|
||||
if (0 == ((d->DecodedFrames+1) % d->SeekTable_Step))
|
||||
{
|
||||
d->SeekTable[d->DecodedFrames/d->SeekTable_Step] = d->SeekTableCounter;
|
||||
d->SeekTable[(d->DecodedFrames+1)/d->SeekTable_Step] = d->SeekTableCounter;
|
||||
d->MaxDecodedFrames = d->DecodedFrames;
|
||||
d->SeekTableCounter = 0;
|
||||
}
|
||||
|
|
@ -1703,6 +1700,15 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample)
|
|||
// Bug in perform_jump;
|
||||
return FALSE;
|
||||
|
||||
// update seek table, if there new entries to fill
|
||||
d->SeekTableCounter += d->FwdJumpInfo + 20;
|
||||
if (0 == (d->DecodedFrames+1) % d->SeekTable_Step)
|
||||
{
|
||||
d->SeekTable[(d->DecodedFrames+1)/d->SeekTable_Step] = d->SeekTableCounter;
|
||||
d->MaxDecodedFrames = d->DecodedFrames;
|
||||
d->SeekTableCounter = 0;
|
||||
}
|
||||
|
||||
// update buffer
|
||||
mpc_decoder_update_buffer(d);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue