1
0
Fork 0
forked from len0rd/rockbox

Fixed a flaw in the ffw/rew logic for large vbr files

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1939 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2002-08-23 06:36:32 +00:00
parent 0a3589d129
commit e255798f44

View file

@ -888,9 +888,10 @@ static void mpeg_thread(void)
if (id3->vbr && (id3->vbrflags & VBR_TOC_FLAG))
{
/* Use the TOC to find the new position */
int percent = (newtime*100)/id3->length;
int curtoc, nexttoc, nextpos, remainder;
unsigned int percent, remainder;
int curtoc, nexttoc, nextpos;
percent = (newtime*100)/id3->length;
if (percent > 99)
percent = 99;
@ -901,12 +902,13 @@ static void mpeg_thread(void)
else
nexttoc = 256;
newpos = (curtoc*id3->filesize)/256;
newpos = (id3->filesize/256)*curtoc;
/* Use the remainder to get a more accurate position */
nextpos = (nexttoc*id3->filesize)/256;
remainder = (newtime*10000)/id3->length - (percent*100);
newpos += ((nextpos-newpos)*remainder)/100;
remainder = (newtime*100)%id3->length;
remainder = (remainder*100)/id3->length;
nextpos = (id3->filesize/256)*nexttoc;
newpos += ((nextpos-newpos)*remainder)/100;
}
else if (id3->bpf && id3->tpf)
newpos = (newtime*id3->bpf)/id3->tpf;