APETag parsing in MPEGfile.cpp
Sander Jansen
s.jansen at gmail.com
Thu Aug 22 14:36:33 UTC 2013
On Thu, Aug 22, 2013 at 7:48 AM, harish jenny <harishjennykn at yahoo.com>wrote:
> Hi,
>
> I have a file which has APEtag as well as Id3V1 tag.
>
> However , MPEG::File::findAPE() function is not able to detect APE
> footerLocation.
>
> When I add the code something like -
>
> seek(d->hasID3v1 ? -160 : -32, End);
>
> long p = tell();
>
> if(readBlock(8) == APE::Tag::fileIdentifier()) {
> d->APEFooterLocation = p;
> seek(d->APEFooterLocation);
> APE::Footer footer(readBlock(APE::Footer::size()));
> d->APELocation = d->APEFooterLocation - footer.completeTagSize()
> + APE::Footer::size();
> return;
> }
> ++ else
> ++ {
> ++ seek(!d->hasID3v1 ? -160 : -32, End);
>
> ++ long p = tell();
>
> ++ if(readBlock(8) == APE::Tag::fileIdentifier()) {
> ++ d->APEFooterLocation = p;
> ++ seek(d->APEFooterLocation);
> ++ APE::Footer footer(readBlock(APE::Footer::size()));
> ++ d->APELocation = d->APEFooterLocation -
> footer.completeTagSize()
> ++ + APE::Footer::size();
> ++ return;
> ++ }
> ++ }
>
> it is able to parse APEtag.
>
> Does the standard say , if ID3V1 tag is present , then check for APETAGEX
> in -160 location from end ?
>
According to this:
http://wiki.hydrogenaudio.org/index.php?title=APEv2_specification
The id3v1 tag should come last. I don't think you'll find many players that
can support a id3v1 tag not located at the end.
Is it fine to parse again from -32 location since I was able to find proper
> metadata?
>
No, as a matter of fact, if you can read a id3v1 tag at -128 and read a
apetag at -32, it means the file is most likely broken (ie. overlapping
tags, id3v1 is truncated by the apetag).
Cheers,
Sander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20130822/e897a633/attachment.html>
More information about the taglib-devel
mailing list