diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2002-09-17 07:04:43 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2002-09-17 07:04:43 +0000 |
commit | aa287bb8ccf6de699f30031406537489aa863912 (patch) | |
tree | 115fe49e6645b27895fff0478367226775f2ac71 /firmware/mpeg.c | |
parent | d96b78b5a56a1776875f72e04878370f578544b5 (diff) |
1. Update the playlist index when starting the list (fixes invalid track num when playing from directory). 2. Estimate new position when ffw/rew VBR file with no TOC (eg. tracks recorded with AJBR).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2308 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r-- | firmware/mpeg.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 75a8b56468..fa482593b8 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -815,6 +815,7 @@ static void mpeg_thread(void) paused = false; current_track_counter++; + update_playlist(); break; case MPEG_STOP: @@ -954,30 +955,38 @@ static void mpeg_thread(void) id3->elapsed = newtime; - if (id3->vbr && (id3->vbrflags & VBR_TOC_FLAG)) + if (id3->vbr) { - /* Use the TOC to find the new position */ - unsigned int percent, remainder; - int curtoc, nexttoc, plen; - - percent = (newtime*100)/id3->length; - if (percent > 99) - percent = 99; - - curtoc = id3->toc[percent]; - - if (percent < 99) - nexttoc = id3->toc[percent+1]; + if (id3->vbrflags & VBR_TOC_FLAG) + { + /* Use the TOC to find the new position */ + unsigned int percent, remainder; + int curtoc, nexttoc, plen; + + percent = (newtime*100)/id3->length; + if (percent > 99) + percent = 99; + + curtoc = id3->toc[percent]; + + if (percent < 99) + nexttoc = id3->toc[percent+1]; + else + nexttoc = 256; + + newpos = (id3->filesize/256)*curtoc; + + /* Use the remainder to get a more accurate position */ + remainder = (newtime*100)%id3->length; + remainder = (remainder*100)/id3->length; + plen = (nexttoc - curtoc)*(id3->filesize/256); + newpos += (plen/100)*remainder; + } else - nexttoc = 256; - - newpos = (id3->filesize/256)*curtoc; - - /* Use the remainder to get a more accurate position */ - remainder = (newtime*100)%id3->length; - remainder = (remainder*100)/id3->length; - plen = (nexttoc - curtoc)*(id3->filesize/256); - newpos += (plen/100)*remainder; + { + /* No TOC exists, estimate the new position */ + newpos = (id3->filesize/id3->length)*newtime; + } } else if (id3->bpf && id3->tpf) newpos = (newtime/id3->tpf)*id3->bpf; |