AW: AW: [ogg-dev] packets and OGG pages
Mathias Kunter
mathiaskunter at yahoo.de
Wed Mar 14 07:36:47 PDT 2007
OK, I've found the answer for one of my previous question myself in the meantime.
The comment header can of course be split over more than 1 ogg page since the comment header can be greater than 64K. It also seems to be possible that both comment AND setup headers are placed on a single ogg page only (as stated in the Voribs specs).
Due to the fact that the first audio packet also begins on a new ogg page I can use the ogg page boundaries to extract the comment + setup headers from the stream. My question is now, how can I determine within this binary data where the comment header ends and where the setup header starts? Well, the length of the comment header is indeed known, but if I'm right I can't assume that the setup header immedeately follows the comment header (this also would be bad because the comment header doesn't end with a fully used byte because of the framing bit). Padding also wouldn't be possible in that case.
The other way would be to search for the header fields of the setup header from the end of the comment header, which is the binary data of:
0x05 (setup header identifier)
0x76 0x6F 0x72 0x62 0x69 0x73 ("vorbis" characters)
As long as the data between the end of the comment header and the begin of the setup header is all 0's, this should work just fine, and this could also be used to include padding to the file if it has to be rewritten anyway. Good practice would then be to create a single ogg page for the comment header with a size of e.g. 8K (which should be enough for most cases), filling up the rest of the page with 0's to be able to re-tag the files at least in future without rewriting the entire file.
What do you say, would this tagging behaviour be correct and in accordance to the specs?
(well, this may is more related to vorbis rather than to ogg, but I started posting within this mailing list ;)
Thanks
Mathias
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
More information about the ogg-dev
mailing list