[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    Reading ID3v2 tag from byte array
From:       Jack Oclee-Brown <jack.ocleebrown () googlemail ! com>
Date:       2013-03-07 20:40:32
Message-ID: CABuR_9YJbrobx0_dK5=A79xVN0BcmMAxwcjpCc-mi88dX1fMUg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div><div><div><div>Hi,<br><br></div>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.<br><br></div>I&#39;ve had a first attempt but after \
initially looking promising I keep getting segmentation faults when I try and extract \
&quot;artist&quot; to a variable.<br> <br></div>I have written a small CPP class \
extending TagLib::ID3v2::Tag<br><br><br><br>#ifndef DSFTAG_H<br>#define \
DSFTAG_H<br><br>#include &lt;taglib/id3v2tag.h&gt;<br><br><br>class dsfTag : public \
TagLib::ID3v2::Tag<br> {<br>public:<br>    dsfTag(char* data,long unsigned int \
dataLen) : TagLib::ID3v2::Tag() {<br>        TagLib::ByteVector b = \
TagLib::ByteVector::fromCString(data,dataLen);<br>        parse(b);<br>    \
};<br>};<br><br>#endif // DSFTAG_H<br> <br><br><br><br></div>when I try to use the \
class I can successfully create the object and output tags to cout, for example \
with:<br><br>dsfTag t(tag,tagLen);<br>cout &lt;&lt; t.album();<br><br><br></div>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.<br> <br><br></div>I&#39;d \
be very grateful if anyone can point me in the right direction.<br><br></div>Thanks! \
Jack.<br><br><br><div><div><br><div><br><div><br></div></div></div></div></div>



_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic