[Vorbis] Byte order in ogg vorbis headers

Ryan Rix phrkonaleash at gmail.com
Sun Jul 6 00:07:48 PDT 2008


Hello all,

I am currently writing an application for PalmOS handheld devices that 
organizes media files on a memory card and allows the user to easily create 
playlists.

The tracks I am using for testing (totalling about 1.5 GB) are nearly all in 
Ogg Vorbis format.

Throughout my testing I have had very little trouble in parsing the comment 
fields from mp3, asf and ogg files.
That is, all except for one or two files.

PalmOS runs on m68k hardware (or emulated m68k on newer devices) so the byte 
order is big endian. 
The issue I seem to be having is that when parsing the comments I use a for 
loop limited by the number of fields, which is a value stored within the ogg 
file, one or two bytes before the comments begin (I don't have my code handy 
to check atm) According to the Vorbis docs this is stored as unsigned integer 
of 32 bits. I assume that it is x86 little endian and thus byte swap it using 
an OS provided macro. 
On these one or two files I've encountered the application seems to hang. 
However on debugging the application I discover that the number of fields is 
exorbinately large. After byte swapping the value by hand I discover that it 
represents the correct number of fields for that file.

My question is, I guess, is there a standard endianness for Ogg encapsulated 
Vorbis files' meta data?

Thanks and best regards,
Ryan Rix
TamsPalm - The PalmOS Blog

My heart is human, my blood is boiling, my brain: IBM


More information about the Vorbis mailing list