View Full Version : Taglib: Performance and crashes problems

1st July 2012, 20:14

I'm using the taglib library (1.7.2) in my Qt application, to read some metadatas of mp3 files from a music folder.
The problem is that I find it very slow.

For example, this is the code:

QString path = "C:/Music/";
QDir d(path);
QStringList fileTypes;
fileTypes << "*.mp3" ;
QStringList pathList = d.entryList( QDir::NoDotAndDotDot | QDir::Files);

QTime t;
foreach (QString fileName, pathList) {
fileName = path + fileName;
TagLib::FileRef *f = new TagLib::FileRef(fileName.toStdWString().c_str());

This code takes about 11s to load a folder containing 400 songs, ie about 28ms for each file.
This is the line very slow:

TagLib::FileRef *f = new TagLib::FileRef(pathFile.toStdWString().c_str());

Is it normal it's so long ?
I've tried using multi threading, but it doesn't change anything, and it doesn't come from my PC, as it's enough powerful.
The weird thing is that once all the files have been loaded, the next time it load the folder again, it's done instantaneous (until i reboot the os).


I have also another problem.

Sometimes, when a tag is not set, the app crashes, and output:

Invalid address specified to RtlFreeHeap( 0ED90000, 0ED92CC0 )

On the following line for example:

if (!f->tag()->genre().isNull())

I'm using Windows 7.


1st July 2012, 23:34
28ms is slow?

check f->tag() before dereferencing it