[vorbis-dev] Reading OGG tags, without libvorbis?

Steve Kemp skx at tardis.ed.ac.uk
Wed Apr 10 11:52:45 PDT 2002



On Wed, Apr 10, 2002 at 10:53:55AM -0700, rillian wrote:

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

  I think I've come to the same conclusion now too, I was hoping
 people needing the library - but it hadn't occurred to me that I
 could just include the source myself.

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

  I think that some, simple, information like this should be put in
 a developer FAQ somewhere - to avoid repetition.  I imagine it could
 be useful to people who don't know the library terribly well.

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

  I did it even wronger that that - I searched for the start of comments
 by looking for strings of the form 'foo=bar' in the first 1024 bytes of
 the file.

  I probably shouldn't tell anybody that ;) 

> Hope that's helpful,

  Very, thank you.

Steve

---
Please Hire Me:
 Edinburgh SysAdmin - Linux / Windows - Toolsmith - Perl / C / C++ / Java

<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