[vorbis-dev] Reading OGG tags, without libvorbis?
rillian
rillian at telus.net
Wed Apr 10 10:53:55 PDT 2002
On Wednesday, April 10, 2002, at 02:13 AM, Steve Kemp wrote:
> I've grabbed a copy of vorbis-tools to look at how 'vorbiscomment'
> works - but I'm confused as to the OGG header + comment formats.
>
> Is there a simple description of the format of the header, and the
> fields?
I think you're better off adding using libogg to parse the bitstream;
it's very small and can be reasonably compiled in if you don't want the
dependency in the executable, and you'll have to write something almost
as complex to parse things properly.
You can find information on the ogg framing layer in these two documents:
http://xiph.org/ogg/doc/oggstream.html
http://xiph.org/ogg/doc/framing.html
or in the corresponding files in the libogg source distribution.
The ogg layer will parse the framing and return packets. You should find
the first substream that has a packet starting with '\001vorbis' and
ignore any other substreams. Then, look for a packet that starts
'\003vorbis'; it should be the second packet. This contains the comment
headers formatted as described in v-comment.html, starting immediately
after the magic. This kind of simplistic parsing is all you need to read
the metadata header.
If you want to do it wrong, you can search for the first occurrence of
'\003vorbis' in the bitstream and start parsing there, or start parsing
at byte 0x68. This last method will of course break on any file with a
large comment header, and may break on future vorbis files.
Hope that's helpful,
-r
<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-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