Russell O'Connor wrote:
I'm a little concerned about do_straight_multiplication(); If the file has extra headers randomly placed about it, you can be off by a small amount (or perhaps large amount).
In my experience this isn't really an issue.
For my application, I'd tempted to try finding the time in the following order:
- check file's extended attribute (OS/2ism here)
- check for xing header
- check for TLEN in ID3 v2 tag.
- count frames
- assume CBR and just multiply
- give up
Don't underestimate the amount of time it takes to count the frames. This added around 5 seconds to the start of each song when I did it. Some minimal inaccuracy with frame numbers would probably be acceptable if it increased speed that much.