[vorbis] comment tags

Beni Cherniavsky cben at techunix.technion.ac.il
Sun Nov 17 02:42:58 PST 2002



On 2002-11-15, Rigel Freden wrote:

> I'm trying to write comment writer thing for zinf, because I love the
> program, but it doesn't fully support ogg.I've found how to read
> comments, but can't figure how to write them.There has been some
> discussion about this previously in the archives, but I couldn't find
> any specifics, only references to code not posted to the list.The
> api documentation page is (painfully) lacking, and vorbiscomment is
> nasty, as its author has mentioned, so I'd rather not continue using
> that as a reference.I can get this on my own, but a little help
> would be much appreciated.Thanks in advance.
>
I've read vorbiscomment and it's not that bad.  One can understand it
rather quickly and it's mostly command-line user interface anyway.  Since
you don't need the command-line interface, just look at print_comments()
and add_comment().  What do you mean by "nasty" (didn't see that post)?

Whether you look at it or not, here are some points to consider (written
under assumption that you do everything, ignore the parts that zinf
implements/constrains for you):

Proper vorbis comments rewriting w.r.t. the ogg bitstream is rather
tricky.  You'll do yourself a big favour by using the vcedit.c file from
vorbiscomment's distribution - it's the next best thing to an official
comment reading/writing library.

You need to handle internationaliztion issues.  Vorbis comments come in
UTF-8 and you need to make sure they show properly.  Avoid the temptation
to store them in current locale during processing in your comment editor.
If you can't show/enter a comment in the UI since it contains characters
you can't handle, try to make sure that if they are not edited they will
be written back without change, or at least ask for confirmation when you
are about to lose characters...

Vorbis comments can contain any characters, including new-lines and even
zero bytes.  The latter are very unconvenient to handle (the API doesn't
even take them into account, you need to meddle with the '->comments[]'
array yourself to avoid trancation on zeros) and nobody is known to care
for them.  Feel free to drop them, after all comments are for human
readable stuff ;-)  As for multi-line comments, there are some people who
use them (I for example find occasional needs).  So please allow some way
to edit them or at least see that more lines are present.  See also my
patch on these issues to vorbiscomment:
http://www.xiph.org/archives/vorbis-dev/200210/0009.html

Comment semantics / UI:

Please don't constrain the UI to a fixed set of comment names (if zinf
leaves you choice).  Allow some way to edit arbitrarily named tags, for
example a listbox of name=value pairs with add/delete/edit[/move-up/down]
operations.  Some people (like me) would be happy with just a list, no
fixed names at all but your taste may differ.

Note that multiple comments with same name are possible and are the
standard way to list e.g. several artists.  This is another point why a
fixed field set UI is problematic; typical solution is to put the first
value in the fixed field (if there is one for this type) and to put
following values in the list.

Comment order is considered meaningful between comments of same name and
not significant among coments of different names (Segher disagreed and
said he wants all order to be preserved; I don't think he would use a GUI
tool anyway ;).

If choosing specific comment names (for fixed fields or suggested in
some way while typing custom names), consult
  http://www.xiph.org/ogg/vorbis/doc/v-comment.html
and
  http://reactor-core.org/ogg-tag-standard.html
(unofficial but laborously discuassed on vorbis ML).  If you feel like
doing a fancy UI, there are many ways to encourage good tagging, for
example upon seeing an ARTIST tag, show a dropdown box suggesting to
elaborate by renaming it to COMPOSER, PERFORMER, ARRENGER, etc...

If you want to generate titles (for playlist/main window display) from the
tags, everybody has his own preferences.  You'll need some
template/interpolation system, preferably with support for abbreviations,
conditionals, etc... ;-(

Conclusion:

As you see, writing a fit-all comment editor is rather tricky.  There will
always be features that "could be added" (think multiple file tagging,
think online database integrations ...:-).  Consider having an "external
editor" button for launching an extranal program on the current file.  In
fact, consider having just that (and maybe only tag reading for title
construction) and avoid reimplementing everything.  This would be
especially acceptable practice for unix people, windows users could live
with it too.

References (if you need more details on any mentioned subject, I can give
more):

http://www.blorp.com/~peter/wa2.htm
Peter's winamp 2 vorbis plugin.  Does most things mentioned above right
(especially the interface parts, good approach for genres - initialize to
default list and update list whith anything the user types).  Close source
but still can be learnt from.

http://members.ozemail.com.au/~spitsw/VorbisExt/
VorbisExt, former VCE.  Also does many things right, especially
unicode (under windows).  Open source.

http://winvorbis.stationplaylist.com/
WinVorbis & Vorbix.  Multi-file Ogg Vorbis Comment Editor/Encoder for
Windows & Linux.  Open source.

P.S. One last point: if you are reading tags, zinf could get ReplayGain
support (if it doesn't) have one.

Whatever you do, good luck.  I think I could use tag editor in zinf ;-)


-- 
Beni Cherniavsky <cben at tx.technion.ac.il>

<p><p><p>--- >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-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 mailing list