Results 1 to 2 of 2

Thread: Taglib: Performance and crashes problems

  1. #1

    Default Taglib: Performance and crashes problems

    Hello

    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:

    Qt Code:
    1. QString path = "C:/Music/";
    2. QDir d(path);
    3. QStringList fileTypes;
    4. fileTypes << "*.mp3" ;
    5. d.setNameFilters(fileTypes);
    6. QStringList pathList = d.entryList( QDir::NoDotAndDotDot | QDir::Files);
    7.  
    8. t.start();
    9. foreach (QString fileName, pathList) {
    10. fileName = path + fileName;
    11. TagLib::FileRef *f = new TagLib::FileRef(fileName.toStdWString().c_str());
    12. }
    13. qDebug()<<t.elapsed();
    To copy to clipboard, switch view to plain text mode 

    This code takes about 11s to load a folder containing 400 songs, ie about 28ms for each file.
    This is the line very slow:
    Qt Code:
    1. TagLib::FileRef *f = new TagLib::FileRef(pathFile.toStdWString().c_str());
    To copy to clipboard, switch view to plain text mode 

    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:
    HEAP[myapp.exe]:
    Invalid address specified to RtlFreeHeap( 0ED90000, 0ED92CC0 )
    On the following line for example:
    Qt Code:
    1. if (!f->tag()->genre().isNull())
    To copy to clipboard, switch view to plain text mode 


    I'm using Windows 7.

    Thanks.
    Last edited by monkazer; 1st July 2012 at 19:36.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Taglib: Performance and crashes problems

    28ms is slow?

    check f->tag() before dereferencing it
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Replies: 3
    Last Post: 24th February 2011, 14:46
  2. QGraphicsView performance problems
    By MarPan in forum Newbie
    Replies: 10
    Last Post: 14th August 2010, 21:24
  3. QGraphicsScene/QGraphicsView performance problems
    By bnilsson in forum Qt Programming
    Replies: 71
    Last Post: 28th January 2008, 12:08
  4. GraphicsView performance problems
    By Gopala Krishna in forum Qt Programming
    Replies: 79
    Last Post: 8th August 2007, 17:32

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.