How to manipulate both V1 and V2 tags in the same file

Cedric Tefft <[email protected]> Fri, 03 Sep 2004 01:40:42 -0700
Newsgroups gmane.comp.audio.mad.user
Message-ID <[email protected]>
I've been playing around with libid3tag 0.15.1b for a couple days now, 
and I'm at a loss when it comes to manipulating multiple tags in the 
same file.

When reading a file with only one tag (either V1 or V2), reading/parsing 
the frames and fields works more or less as I'd expect given the API 
functions in id3tag.h.

Where I run into trouble is when I read an MP3 file with both V1 and V2 
tags.  The first thing I do after opening the file is call 
id3_file_tag() to get a pointer to a tag.  What I find confusing is that 
even though the tag's ID3_TAG_OPTION_ID3V1 option is set, walking the 
field list only gives me the frames from the V2 tag:

for(i=0;i<tag->nframes;i++) {
     frame=tag->frames[i];
     /* etc. */
}

Poking around a bit in file.c it appears the id3_file structure 
maintains references to all of the individual tags in the file, but 
looking through the API functions available in id3tag.h,  I don't see 
how to access any tag other than the primary (via the id3_file_tag() 
function).

So my question is, how do I access the fields of a V1 tag when a file 
has both V1 and V2 tags?  Are the V1 fields stored in the primary tag 
structure along with the V2 fields?  If so, why can't I access them when 
I walk the list of the other (V2) frames?  If they're stored in a tag 
structure other than the primary, how do I access it?

Thanks,

- Cedric