diff options
Diffstat (limited to 'firmware/mpeg.c')
-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; |