Fetch length of track in milliseconds (patch attached)
canidae at exent.net
Sun Jan 11 01:20:03 CET 2009
I'm working on a software that compares audio files with metadata from
MusicBrainz (yes, I'm aware of Picard) and I also compare the duration
of the audio file with the duration of the track. Granularity of seconds
is a bit crude in this context, milliseconds would be more helpful.
I'm also aware that certain formats, such as MP3 may return an
inaccurate duration, but I don't feel that this fact should prevent you
from getting a more accurate duration from other formats (such as Ogg
I've added a new method to AudioProperties, "lengthMilliseconds()" and
updated the code for all subclasses. Instead of adding a new variable I
made the "length" variable contain the duration in milliseconds and made
the "length()" method return "d->length / 1000;". If i did my math
right, this means the longest duration of a track before length goes
negative is about 49 days on a system where "int" is 32 bits.
Any thoughts? :)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15238 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20090111/af4dd7db/attachment-0001.bin
More information about the taglib-devel