TagLib

Introduction

TagLib, is well, a library for reading and editing audio meta data, commonly know as tags.

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.

Why TagLib?

TagLib was written to fill a gap in the Open Source/Free Software community. Currently there is a lack in the OSS/FS for a homogenous API to the most common music types.

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. :-)

Examples:

I've talked a lot about the homogenous API to common music formats. Here's an example of how things (will) work:

 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.

Building

TagLib provides a script called taglib-config that returns the necessary compiler and linker flags, as well as the version number. To build a small sample program one would use:

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.

Note:
TagLib includes assume that you have the TagLib include path specified in the compile line, by default -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.)

Contact

Author:
Scott Wheeler <wheeler@kde.org>