APIC frame for ID3v2.2

Marc Halbrügge marc.halbruegge at native-instruments.de
Mon Mar 16 10:50:32 CET 2009


Hi,

there's already a patch for this problem, see
https://bugs.kde.org/show_bug.cgi?id=167786

Greetz
Marc

Richard Low schrieb:
> Hi all,
> 
> It seems as though taglib assumes that the APIC frame is for ID3 version 
> 2.3 or above, yet the format is different for v2.2.  I've modified 
> attachedpictureframe.cpp to check for v2.2. frames.  Below is a working 
> AttachedPictureFrame::parseFields() (also attached as a patch against 
> latest in SVN repository).
> 
> Thanks a lot for taglib - it's by far the best tagging library I've seen.
> 
> Richard.
> 
> 
> 
> void AttachedPictureFrame::parseFields(const ByteVector &data)
> {
>   if (this->header()->version() == 2)
>   {
>     if(data.size() < 7) {
>       debug("A picture frame must contain at least 7 bytes.");
>       return;
>     }
> 
>     int pos = 0;
>     d->textEncoding = String::Type(data[pos]);
>     pos += 1;
> 
>     d->mimeType = String(data.mid(pos, 3), String::Latin1);
>     pos += 3;
> 
>     d->type = (TagLib::ID3v2::AttachedPictureFrame::Type)data[pos];
>     pos += 1;
> 
>     d->description = readStringField(data, d->textEncoding, &pos);
> 
>     d->data = data.mid(pos);
>   }
>   else
>   {
>     if(data.size() < 5) {
>       debug("A picture frame must contain at least 5 bytes.");
>       return;
>     }
> 
>     d->textEncoding = String::Type(data[0]);
> 
>     int pos = 1;
> 
>     d->mimeType = readStringField(data, String::Latin1, &pos);
>     d->type = (TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];
>     d->description = readStringField(data, d->textEncoding, &pos);
> 
>     d->data = data.mid(pos);
>   }
> }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel



More information about the taglib-devel mailing list