[vorbis-dev] Reading tags (again)...

Michael Smith msmith at labyrinth.net.au
Mon Nov 12 00:19:57 PST 2001



At 12:16 AM 11/12/01 -0500, you wrote:
>Ok, so I finally got the id3/mp3 end of things worked out for the next 
>release of QTagger and I'm back to implementing tag reading for Ogg Vorbis.  
>
>I've got some code that will read tags, but I haven't been able to figure out 
>how to write them.  Here's the code that I'm using.  It's a fine C/C++ mix.  
>The code will eventually be in a C++ app, so I don't mind throwing in some 
>C++'isms.

See vorbis-tools/vorbiscomment/vcedit.c
It does everything required to write comments out. Yes, it's complex. It's
probably more complex than it needs to be, because it handles nasty special
cases which don't occur in valid files (but this makes it useful as a tool
for cleaning up slightly-broken files).

Feel free to use the code as-is, there are a couple of other programs (on
multiple platforms) which do, and the license (LGPL) is sufficient to allow
this even if your program isn't open source (which it may well be, I'm 
saying this for other potential users as well). I suggest using the code
from cvs though, not rc2 (for vorbiscomment, not for libvorbis), there have
been some bugfixes since then. It's now pretty stable complete code.

>
>So, this reads things just fine.  And, yes, I know it's ugly.  I don't care 
>at the moment.  The two commented out lines:
>
>// vorbis_comment_add_tag(ovComment, "title", "Cheese Bar");
>// ovComment->user_comments[0]="title=Cheese Bar";
>
>Do little more than cause seg faults.  I found the undocumented function 
>vorbis_comment_add_tag() and hoped to do something useful with it.  It seems 
>that I can update the tags, but can't write them back to the files.

Erm. Well, I don't think it should segfault, but it shouldn't do what you
want, either. vorbis_comment_add_tag() is just a convenience interface for
adding things to the vorbis_comment structure, which is written out when
you encode things. vorbiscomment (see above) uses it, but there's a lot of
other work to write the finished comments out to the file.

Michael

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list