[vorbis] vorbiscomment question.

Beni Cherniavksy cben at techunix.technion.ac.il
Thu Aug 22 02:26:20 PDT 2002



On 2002-08-09, xdfisl wrote:

> Hello,
>
> I am writing a script which reads and writes vorbis comments using the
> vorbiscomment utility from vorbis-tools. I have just one question
> regarding the --raw switch.
>
>    Raw mode (--raw, -R) will read and write comments in utf8,
>    rather than converting to the user's character set. This is
>    useful for using vorbiscomment in scripts. However, this is
>    not sufficient for general round-tripping of comments in all
>    cases.
>
> What is the "user's character set" likely to be on a Debian Linux
> system?
> By round-tripping I assume it is meant to read, modify, and write back a
> set of comments -- which is exactly what I am looking to do.
> I assume not using --raw would only be appropriate if the comments do
> not contain any 'special' characters which are not supported by the
> shell character set? But why would --raw not be sufficient in some
> cases?
>
Sorry for answering so late, I understood the point just now ;-)

There is no round-tripping problem with --raw regarding character sets.
The problem is with delimiting comments.  Vorbis comment names are limited
but the content can contain any characters, including =, line endings and
even zero charcodes (IIRC).
Currently vorbiscomment outputs one comment per line (and if it contains
line endings, it will take several lines) and expects to read one comment
per line.  So a multiline comment will be read back as just one line
comment followed by some lines of garbage:

TITLE=first line of
a 2-line comment

As long as these lines are not legal comments, one could attempt to treat
them as continuation lines but this is not reliable (a comment could
contain a line `FOO=bar' that would make this ambiguous) and it deproves
vorbiscomment of almost all error checking.

However I do see a way to a syntax allowing multi-line comments:
mandatorily start all continuation lines with a syntax that can't start a
comment, for example a single `=' (IIRC 0-length named comments are not
allowed; I can't find it v-comment.html now so can somebody
confirm/disprove this?):

TITLE=first line of
=a 2-line comment
FOO=another comment

This has the draw back of more than one line per comment (bad e.g. for
grepping on comment name, etc.) so maybe an option for escape sequences
for newlines putting all the comment on one lines could be better...


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

Awake! Awake! Fear, Fire, Foes! Awake! Fire, Foes! Awake! [Tolkien, LOTR]
Fight software patents:  http://lpf.ai.mit.edu/
If you know what's the situation in Israel concerning software patent,
could you please enlighten me?

--- >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