Help - Search - Members - Calendar
Full Version: header packet length computaion in .ogm
Hydrogenaudio Forums > Digital Audio/Video > General A/V
ercole
quick question about .ogm files (ie the changes made by tobias to .ogg to support multi a/v streams).

there's something I'm not clear about in the "specs": at the beginning of non-vorbis streams, for data packets, some bytes are added (see http://tobias.everwicked.com/packfmt.htm/)
In this header are specified, for example, for video if the frame is a key frame or not...

From the spec (ie the link specified before), it looks like it is a fixed size... well, in practice it is not...

My question: how can we know how many bytes are used by this header: it seems to vary from packets to packets ?

By checking, the source code it seems it is based on the packet length.

Is there a way to know the header length without having to find out the packet length ?
alexnoe
You've just found out why AVI-Mux GUI will most likely never support OGM files, not even for reading rolleyes.gif

A really simple question, and no one able to help you within over 40 days. What a discontinued format...
mosu
QUOTE(ercole @ Jun 17 2004, 10:56 PM)
My question: how can we know how many bytes are used by this header: it seems to vary from packets to packets ?


One byte for the flags, 'duration_len' bytes for the 'duration of this packets in media units'. duration_len is...

CODE
/// Some defines from OggDS
#define PACKET_TYPE_HEADER       0x01
#define PACKET_TYPE_COMMENT      0x03
#define PACKET_TYPE_BITS         0x07
#define PACKET_LEN_BITS01        0xc0
#define PACKET_LEN_BITS2         0x02
#define PACKET_IS_SYNCPOINT      0x08

duration_len = (*op.packet & PACKET_LEN_BITS01) >> 6;
duration_len |= (*op.packet & PACKET_LEN_BITS2) << 1;


with op being the Ogg packet (so *op.packet is the packet's first byte). So the duration itself is...

CODE
if ((duration_len > 0) && (op.bytes >= (duration_len + 1)))
 for (i = 0, duration = 0; i < duration_len; i++) {
   duration = duration << 8;
   duration += *((unsigned char *)op.packet + duration_len - i);
 }
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.