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
Hello.... anybody out there??
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
[ Once again developer-oriented messages as this one should be sent to mad-dev and not this list. Please note Reply-To: and subscribe to mad-dev if necessary to respond to this message. ]
On Sep 3, 2004, at 1:40 AM, Cedric Tefft wrote:
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?
The file API of libid3tag presents a single view of all the tags contained in a file, and does not differentiate between V1 and V2 tags. The idea is that V1 and V2 tags should represent the same information about a file, and if both are present then V2 information is preferred because its field lengths are not constrained as in V1. (When writing tags back to a file, the intent is that the file interface will generate both V1 and V2 tags from the same source, ensuring consistency.)
Accordingly, it's not possible to access the V1 and V2 information as separate tags with the file interface. If you really want to do this, you can use the tag parsing and rendering routines to maintain separate tag structures and data, but you'll have to read and write the data from the file yourself.