diff options
-rw-r--r-- | firmware/mpeg.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 49b0804cb9..6fd411282d 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -286,7 +286,7 @@ static void set_elapsed(struct mp3entry* id3) | |||
286 | 286 | ||
287 | /* calculate remainder time */ | 287 | /* calculate remainder time */ |
288 | plen = (nextpos - relpos) * (id3->filesize / 256); | 288 | plen = (nextpos - relpos) * (id3->filesize / 256); |
289 | id3->elapsed += remainder * 1000 / plen ; | 289 | id3->elapsed += (((remainder * 100) / plen) * id3->length) / 10000; |
290 | } | 290 | } |
291 | else { | 291 | else { |
292 | /* no TOC exists. set a rough estimate using average bitrate */ | 292 | /* no TOC exists. set a rough estimate using average bitrate */ |
@@ -921,9 +921,9 @@ static void mpeg_thread(void) | |||
921 | } | 921 | } |
922 | 922 | ||
923 | case MPEG_FF_REWIND: { | 923 | case MPEG_FF_REWIND: { |
924 | struct mp3entry *id3 = mpeg_current_track(); | 924 | struct mp3entry *id3 = mpeg_current_track(); |
925 | int oldtime = id3->elapsed; | 925 | unsigned int oldtime = id3->elapsed; |
926 | int newtime = oldtime + (int)ev.data; | 926 | unsigned int newtime = oldtime + (int)ev.data; |
927 | int curpos, newpos, diffpos; | 927 | int curpos, newpos, diffpos; |
928 | DEBUGF("MPEG_FF_REWIND\n"); | 928 | DEBUGF("MPEG_FF_REWIND\n"); |
929 | 929 | ||
@@ -933,7 +933,7 @@ static void mpeg_thread(void) | |||
933 | { | 933 | { |
934 | /* Use the TOC to find the new position */ | 934 | /* Use the TOC to find the new position */ |
935 | unsigned int percent, remainder; | 935 | unsigned int percent, remainder; |
936 | int curtoc, nexttoc, nextpos; | 936 | int curtoc, nexttoc, plen; |
937 | 937 | ||
938 | percent = (newtime*100)/id3->length; | 938 | percent = (newtime*100)/id3->length; |
939 | if (percent > 99) | 939 | if (percent > 99) |
@@ -951,11 +951,11 @@ static void mpeg_thread(void) | |||
951 | /* Use the remainder to get a more accurate position */ | 951 | /* Use the remainder to get a more accurate position */ |
952 | remainder = (newtime*100)%id3->length; | 952 | remainder = (newtime*100)%id3->length; |
953 | remainder = (remainder*100)/id3->length; | 953 | remainder = (remainder*100)/id3->length; |
954 | nextpos = (id3->filesize/256)*nexttoc; | 954 | plen = (nexttoc - curtoc)*(id3->filesize/256); |
955 | newpos += ((nextpos-newpos)*remainder)/100; | 955 | newpos += (plen/100)*remainder; |
956 | } | 956 | } |
957 | else if (id3->bpf && id3->tpf) | 957 | else if (id3->bpf && id3->tpf) |
958 | newpos = (newtime*id3->bpf)/id3->tpf; | 958 | newpos = (newtime/id3->tpf)*id3->bpf; |
959 | else | 959 | else |
960 | { | 960 | { |
961 | /* Not enough information to FF/Rewind */ | 961 | /* Not enough information to FF/Rewind */ |