![]() |
|
Some goals of TagLib:
Because TagLib desires to be toolkit agnostic, in hope of being widely adopted and the most flexible in licensing TagLib provides many of its own toolkit classes; in fact the only external dependancy that TagLib has, it a semi-sane STL implementation.
As TagLib will be initially injected into the KDE community, while I am not linking to any of the KDE or Qt libraries I have tried to follow the coding style of those libraries. Again, this is in sharp contrast to id3lib, which basically provides a hybrid C/C++ API and uses a dubious object model.
I get asked rather frequently why I am replacing id3lib (mostly by people that have never worked with id3lib), if you are concerned about this please email me; I can provide my lengthy standard rant. :-)
TagLib::FileRef f("Latex Solar Beef.mp3"); TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa" f.tag()->setAlbum("Fillmore East"); f.save(); TagLib::FileRef g("Free City Rhymes.ogg"); TagLib::String album = g.tag()->album(); // album == "NYC Ghosts & Flowers" g.tag()->setTrack(1); g.save();
Note that these high level functions work for Ogg, FLAC, MPC and MP3 (or any other formats supported in the future). For this high level API, which is suitable for most applications, the differences between tag and file formats can all be ignored.
g++ taglib-test.cpp `taglib-config --cflags --libs` -o taglib-test
This should generally be integrated into the configure check for TagLib in your project.
-I/usr/local/include/taglib
. Using include <taglib/tag.h>
will not work. (Though this is usually handled by the taglib-config script mentioned above.)