named comments support in taglib?

Alan Ezust alan.ezust at
Mon May 15 18:46:36 CEST 2006

Hi Scott,

I tried your function (sorry it took me so long to get around to it,
but I had a broken system and was unable to build certain apps for a
while)... Anway, I get a segfault when I try to get a list of pairs...

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1222449472 (LWP 23855)]
0xb7f6c368 in TagLib::ByteVector::operator< () from /usr/lib/
(gdb) where
#0  0xb7f6c368 in TagLib::ByteVector::operator< () from /usr/lib/
#1  0xb7f544eb in std::_Rb_tree<TagLib::ByteVector,
std::pair<TagLib::ByteVector const,
TagLib::List<TagLib::ID3v2::Frame*> >,
std::_Select1st<std::pair<TagLib::ByteVector const,
TagLib::List<TagLib::ID3v2::Frame*> > >,
std::allocator<std::pair<TagLib::ByteVector const,
TagLib::List<TagLib::ID3v2::Frame*> > > >::lower_bound () from
#2  0xb7f54b22 in TagLib::Map<TagLib::ByteVector,
TagLib::List<TagLib::ID3v2::Frame*> >::operator[] ()
   from /usr/lib/
#3  0xb7f52e86 in TagLib::ID3v2::Tag::frameList () from /usr/lib/
#4  0x08049bfc in RatingTagger::findByDescription ()
#5  0x08049dcb in RatingTagger::getPreference ()
#6  0x0804a89f in RatingTagger::getRating ()
#7  0x0804aad9 in RatingTagger::getRating ()
#8  0x0804c3b6 in main ()

I get a seg fault when I call frameList().

The test program I am working on is here:

creator.mp3 already has tags set, the journey.mp3 does not.

This reproduces on the SVN version of taglib too. Any idea why I get a
segfault there?

CommentsFrame *RatingTagger::findByDescription(const Tag *tag, String
d) // static
    using namespace TagLib::ID3v2;

    FrameList comments = tag->frameList("COMM"); // SEGFAULT HERE

    for(FrameList::ConstIterator it = comments.begin();
        it != comments.end(); ++it)
        CommentsFrame *frame = dynamic_cast<CommentsFrame *>(*it);
        if(frame && frame->description() == d)
            return frame;
  return 0;

On 1/19/06, Scott Wheeler <wheeler at> wrote:
> On Thursday 19 January 2006 5:07, Alan Ezust wrote:
> > Does TagLib support named comments, like
> > libid3? There is a method like this:
> >
> >      return ID3_GetComment(&tag, "MusicMatch_Preference");
> >
> > Which returns the musicmatch preference. What would be the equivalent in
> > taglib?
> There's nothing that currently does that, but it's rather trivial to
> implement.  I've attached a (currently untested) patch to TagLib that does
> it, which I'll probably commit.
> You can just copy the same function into your application for now.
> -Scott

More information about the taglib-devel mailing list