Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: header packet length computaion in .ogm (Read 3300 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

header packet length computaion in .ogm

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 ?

header packet length computaion in .ogm

Reply #1
You've just found out why AVI-Mux GUI will most likely never support OGM files, not even for reading 

A really simple question, and no one able to help you within over 40 days. What a discontinued format...

 

header packet length computaion in .ogm

Reply #2
Quote
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: [Select]
/// 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: [Select]
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);
 }