I'm not sure about the segfault, but the best way to do this in TagLib 1.8 is to use the new IOStream API. You construct a ByteVectorStream with the complete tag data, and then create a MPEG file instance with stream instead of a file name. http://taglib.github.io/api/classTagLib_1_1ByteVectorStream.html http://taglib.github.io/api/classTagLib_1_1MPEG_1_1File.html#ad3ac226309beb3989abf70b9ff02ed2f Lukas On Thu, Mar 7, 2013 at 9:40 PM, Jack Oclee-Brown wrote: > 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 > > > 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. > > > > > > > _______________________________________________ > taglib-devel mailing list > taglib-devel@kde.org > https://mail.kde.org/mailman/listinfo/taglib-devel > _______________________________________________ taglib-devel mailing list taglib-devel@kde.org https://mail.kde.org/mailman/listinfo/taglib-devel