diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2002-08-23 06:36:32 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2002-08-23 06:36:32 +0000 |
commit | e255798f444c2856558e80b2078595fb2054fa08 (patch) | |
tree | 31dd52d9bcfb751be65efea4427b857ddadec173 /firmware | |
parent | 0a3589d1293224a1e2f5f7dea13f357d0dc00595 (diff) | |
download | rockbox-e255798f444c2856558e80b2078595fb2054fa08.tar.gz rockbox-e255798f444c2856558e80b2078595fb2054fa08.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/mpeg.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 17d92c25fb..e7c3638da9 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -888,9 +888,10 @@ static void mpeg_thread(void) | |||
888 | if (id3->vbr && (id3->vbrflags & VBR_TOC_FLAG)) | 888 | if (id3->vbr && (id3->vbrflags & VBR_TOC_FLAG)) |
889 | { | 889 | { |
890 | /* Use the TOC to find the new position */ | 890 | /* Use the TOC to find the new position */ |
891 | int percent = (newtime*100)/id3->length; | 891 | unsigned int percent, remainder; |
892 | int curtoc, nexttoc, nextpos, remainder; | 892 | int curtoc, nexttoc, nextpos; |
893 | 893 | ||
894 | percent = (newtime*100)/id3->length; | ||
894 | if (percent > 99) | 895 | if (percent > 99) |
895 | percent = 99; | 896 | percent = 99; |
896 | 897 | ||
@@ -901,12 +902,13 @@ static void mpeg_thread(void) | |||
901 | else | 902 | else |
902 | nexttoc = 256; | 903 | nexttoc = 256; |
903 | 904 | ||
904 | newpos = (curtoc*id3->filesize)/256; | 905 | newpos = (id3->filesize/256)*curtoc; |
905 | 906 | ||
906 | /* Use the remainder to get a more accurate position */ | 907 | /* Use the remainder to get a more accurate position */ |
907 | nextpos = (nexttoc*id3->filesize)/256; | 908 | remainder = (newtime*100)%id3->length; |
908 | remainder = (newtime*10000)/id3->length - (percent*100); | 909 | remainder = (remainder*100)/id3->length; |
909 | newpos += ((nextpos-newpos)*remainder)/100; | 910 | nextpos = (id3->filesize/256)*nexttoc; |
911 | newpos += ((nextpos-newpos)*remainder)/100; | ||
910 | } | 912 | } |
911 | else if (id3->bpf && id3->tpf) | 913 | else if (id3->bpf && id3->tpf) |
912 | newpos = (newtime*id3->bpf)/id3->tpf; | 914 | newpos = (newtime*id3->bpf)/id3->tpf; |