Reading ID3v2 tag from byte array

Jack Oclee-Brown jack.ocleebrown at googlemail.com
Thu Mar 7 20:40:32 UTC 2013


Hi,

I was wondering if it was possible to read an ID3v2 tag directly from a
byte array and use TabLib to extract the artist, title etc.

I've had a first attempt but after initially looking promising I keep
getting segmentation faults when I try and extract "artist" to a variable.

I have written a small CPP class extending TagLib::ID3v2::Tag



#ifndef DSFTAG_H
#define DSFTAG_H

#include <taglib/id3v2tag.h>


class dsfTag : public TagLib::ID3v2::Tag
{
public:
    dsfTag(char* data,long unsigned int dataLen) : TagLib::ID3v2::Tag() {
        TagLib::ByteVector b =
TagLib::ByteVector::fromCString(data,dataLen);
        parse(b);
    };
};

#endif // DSFTAG_H




when I try to use the class I can successfully create the object and output
tags to cout, for example with:

dsfTag t(tag,tagLen);
cout << t.album();


but I get segfaults when I try and put album() into a char* or string. And
I also see segfaults or core dumps if I free the original byte array.


I'd be very grateful if anyone can point me in the right direction.

Thanks! Jack.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20130307/0b35ac94/attachment.html>


More information about the taglib-devel mailing list