diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-09-09 07:19:41 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-09-09 07:19:41 +0000 |
commit | 4a939ecdcd1e32bd3d77e485d137f58ba35329d8 (patch) | |
tree | c86a9e1fad6f722cdda59926eea3d82b7adb7dea | |
parent | c2779e5ef3740781c30b8c2b5d9f876709b091d9 (diff) | |
download | rockbox-4a939ecdcd1e32bd3d77e485d137f58ba35329d8.tar.gz rockbox-4a939ecdcd1e32bd3d77e485d137f58ba35329d8.zip |
Exact song length calculation for CBR mpeg audio files (without Info header).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7502 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/id3.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index 8240e0d846..f1aa821fba 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -906,17 +906,16 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
906 | 906 | ||
907 | if(filetime == 0) | 907 | if(filetime == 0) |
908 | { | 908 | { |
909 | /* | 909 | filetime = (entry->filesize - bytecount) / (info.bitrate / 8); |
910 | * Now song length is | 910 | /* bitrate is in kbps so this delivers milliseconds. Doing bitrate / 8 |
911 | * ((filesize)/(bytes per frame))*(time per frame) | 911 | * instead of filesize * 8 is exact, because mpeg audio bitrates are |
912 | */ | 912 | * always multiples of 8, and it avoids overflows. */ |
913 | filetime = entry->filesize/info.frame_size*info.frame_time; | ||
914 | } | 913 | } |
915 | 914 | ||
916 | entry->tpf = info.frame_time; | 915 | entry->tpf = info.frame_time; |
917 | entry->bpf = info.frame_size; | 916 | entry->bpf = info.frame_size; |
918 | entry->frame_count = info.frame_count; | 917 | entry->frame_count = info.frame_count; |
919 | 918 | ||
920 | entry->vbr = info.is_vbr; | 919 | entry->vbr = info.is_vbr; |
921 | entry->has_toc = info.has_toc; | 920 | entry->has_toc = info.has_toc; |
922 | 921 | ||