Rob,
I finished writing my libid3tag code, and it seems to work pretty well.
A couple of notes:
* I couldn't get the "comment" tag to work. I tried to import "comment" from files that I know have valid ID3V1 comments, and got nothing, and I tried to export both ID3V1 and ID3V2 comments and nothing got written.
All of the other standard tags I tried worked. Have you seen this problem before? Can you reproduce it?
* To keep things simple, Audacity provides the user with a choice control to set the genre - i.e. they can't type in their own. This keeps the dialog box compatible with both ID3V1 and ID3V2.
It would be nice if libid3tag made it easier to work with genres by number. Currently I'm using the id3_genre_name function in a rather roundabout way - when I want to retrieve the 29th genre name, I sprintf 29 to a string, convert it to a ucs4 string, then pass that to id3_genre_name.
All I want is for you to export two functions: one which returns the number of genres, and another which returns the nth genre.
* I discovered that if I try to output a genre name to an ID3V1 file, nothing gets written. However, if I output a genre number (i.e. the string "29") it works.
For symmetry, it seems that if I try to write a genre name which is in the list, libid3tag should write out the appropriate index number to the ID3V1 tag.
Thanks, Dominic
Rob Leslie wrote:
On Thursday, April 11, 2002, at 01:50 AM, Dominic Mazzoni wrote:
It's funny, I didn't notice id3_frame_new because I assumed that all of the functions I would need were in id3tag.h (since most of them were already there).
Hmm, this is an oversight. The prototype should have been put in id3tag.h.
Your ::ExportID3() looks good; try the following MakeID3Frame() instead:
Strange, I tried to add your functions and I'm getting linker errors with all of the functions I try to call which are not in id3tag.h. Does this make any sense? (It's possible it's my fault, but I did a make clean, I'm linking to libid3tag.a from mad-0.14.2b, and there were no compiler warnings...):
obj/Tags.o: In function `MakeID3Frame(char const *, char const *)': /home/dmazzoni/audacity/src/Tags.cpp:214: undefined reference to `id3_frame_new(char const *)' /home/dmazzoni/audacity/src/Tags.cpp:217: undefined reference to `id3_latin1_length(unsigned char const *)' /home/dmazzoni/audacity/src/Tags.cpp:219: undefined reference to `id3_latin1_decode(unsigned char const *, unsigned long *)' collect2: ld returned 1 exit status
Is it possible that these functions are not being exported?
Probably since they do not appear in id3tag.h, the prototype is being inferred from use, and since you're using C++ the compiler assumes they are C++ functions and does name mangling prior to linking.
I think you can work around this by explicitly adding some prototypes:
extern "C" { struct id3_frame *id3_frame_new(char const *); id3_length_t id3_latin1_length(id3_latin1_t const *); void id3_latin1_decode(id3_latin1_t const *, id3_ucs4_t *); }
Sorry about this. I'll have to update the library to put the prototypes in id3tag.h.
-- Rob Leslie rob@mars.org