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 | |
parent | d96b78b5a56a1776875f72e04878370f578544b5 (diff) | |
download | rockbox-aa287bb8ccf6de699f30031406537489aa863912.tar.gz rockbox-aa287bb8ccf6de699f30031406537489aa863912.zip |
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')
-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) | |||
815 | paused = false; | 815 | paused = false; |
816 | 816 | ||
817 | current_track_counter++; | 817 | current_track_counter++; |
818 | update_playlist(); | ||
818 | break; | 819 | break; |
819 | 820 | ||
820 | case MPEG_STOP: | 821 | case MPEG_STOP: |
@@ -954,30 +955,38 @@ static void mpeg_thread(void) | |||
954 | 955 | ||
955 | id3->elapsed = newtime; | 956 | id3->elapsed = newtime; |
956 | 957 | ||
957 | if (id3->vbr && (id3->vbrflags & VBR_TOC_FLAG)) | 958 | if (id3->vbr) |
958 | { | 959 | { |
959 | /* Use the TOC to find the new position */ | 960 | if (id3->vbrflags & VBR_TOC_FLAG) |
960 | unsigned int percent, remainder; | 961 | { |
961 | int curtoc, nexttoc, plen; | 962 | /* Use the TOC to find the new position */ |
962 | 963 | unsigned int percent, remainder; | |
963 | percent = (newtime*100)/id3->length; | 964 | int curtoc, nexttoc, plen; |
964 | if (percent > 99) | 965 | |
965 | percent = 99; | 966 | percent = (newtime*100)/id3->length; |
966 | 967 | if (percent > 99) | |
967 | curtoc = id3->toc[percent]; | 968 | percent = 99; |
968 | 969 | ||
969 | if (percent < 99) | 970 | curtoc = id3->toc[percent]; |
970 | nexttoc = id3->toc[percent+1]; | 971 | |
972 | if (percent < 99) | ||
973 | nexttoc = id3->toc[percent+1]; | ||
974 | else | ||
975 | nexttoc = 256; | ||
976 | |||
977 | newpos = (id3->filesize/256)*curtoc; | ||
978 | |||
979 | /* Use the remainder to get a more accurate position */ | ||
980 | remainder = (newtime*100)%id3->length; | ||
981 | remainder = (remainder*100)/id3->length; | ||
982 | plen = (nexttoc - curtoc)*(id3->filesize/256); | ||
983 | newpos += (plen/100)*remainder; | ||
984 | } | ||
971 | else | 985 | else |
972 | nexttoc = 256; | 986 | { |
973 | 987 | /* No TOC exists, estimate the new position */ | |
974 | newpos = (id3->filesize/256)*curtoc; | 988 | newpos = (id3->filesize/id3->length)*newtime; |
975 | 989 | } | |
976 | /* Use the remainder to get a more accurate position */ | ||
977 | remainder = (newtime*100)%id3->length; | ||
978 | remainder = (remainder*100)/id3->length; | ||
979 | plen = (nexttoc - curtoc)*(id3->filesize/256); | ||
980 | newpos += (plen/100)*remainder; | ||
981 | } | 990 | } |
982 | else if (id3->bpf && id3->tpf) | 991 | else if (id3->bpf && id3->tpf) |
983 | newpos = (newtime/id3->tpf)*id3->bpf; | 992 | newpos = (newtime/id3->tpf)*id3->bpf; |