[Theora] ogg + theora + seeking

Tom th.tom at gmx.de
Tue Apr 4 11:20:34 PDT 2006


Hi all,

I'm actually learning how to use ogg, theora and vorbis. My idea is to create 
a small program running, that is able to concatenate ogg video+audio files. 
However I have some small questions. Here I will start with the first one:

I read the following for seeking in ogg for a theora key-frame:
---- snipp (http://www.xiph.org/ogg/doc/ogg-multiplex.html) ----
[...]The third point appears trickier at first glance, but it too can be 
handled through the granule position mapping mechanism. Here we arrange the 
granule position in such a way that granule positions of key frames are easy 
to find. Divide the granule position into two fields; the most-significant 
bits are an absolute frame counter, but it's only updated at each key frame. 
The least significant bits encode the number of frames since the last key 
frame. In this way, each granule position both encodes the absolute time of 
the current frame as well as the absolute time of the last key frame.
---- snipp ------------------------------------------------------------------

And I wrote a small program to print out all ogg-packet-headers in a file. 
(Output at the end).
There I don't see any key-frame or "not key-frame" from the position 
information.

The header struct I used is
struct oggHeader {

  char    ogg[5];

  char    pack_type:1;
  char    page_type:1;
  char    last:1;
  char    reserved:5;

  // was: uint64 position; 
  uint32  position1;
  uint32  position2;
  uint32  serial;
  uint32  pageNo;
  uint32  checksum;

} __attribute__ ((packed));

The description only says: devide the position into two fields. is it 2 times 
uint32 or some other values?

Thanks in advance 

------------------------------------------

OggS continued packet | first page (bos) | not last page |  pos1: 0 pos2: 0 
serial: 2006538233 pageNo: 0 checksum: 3061487401
OggS continued packet | first page (bos) | not last page |  pos1: 0 pos2: 0 
serial: 1711341811 pageNo: 0 checksum: 1734746641
OggS continued packet | not first | not last page |  pos1: 0 pos2: 0 serial: 
2006538233 pageNo: 1 checksum: 3178517782
OggS continued packet | not first | not last page |  pos1: 22 pos2: 0 serial: 
2006538233 pageNo: 2 checksum: 2330106186
OggS continued packet | not first | not last page |  pos1: 42688 pos2: 0 
serial: 1711341811 pageNo: 3 checksum: 1301098927
OggS fresh packet | not first | not last page |  pos1: 59 pos2: 0 serial: 
2006538233 pageNo: 5 checksum: 675042733
OggS fresh packet | not first | not last page |  pos1: 4117 pos2: 0 serial: 
2006538233 pageNo: 11 checksum: 2001463665
OggS fresh packet | not first | not last page |  pos1: 5722 pos2: 0 serial: 
2006538233 pageNo: 18 checksum: 602206409
OggS continued packet | not first | not last page |  pos1: 229824 pos2: 0 
serial: 1711341811 pageNo: 12 checksum: 4208543730
OggS fresh packet | not first | not last page |  pos1: 8518 pos2: 0 serial: 
2006538233 pageNo: 23 checksum: 372078174
OggS fresh packet | not first | not last page |  pos1: 8521 pos2: 0 serial: 
2006538233 pageNo: 24 checksum: 1199444312
OggS fresh packet | not first | not last page |  pos1: 8527 pos2: 0 serial: 
2006538233 pageNo: 26 checksum: 118116702
OggS continued packet | not first | not last page |  pos1: 346816 pos2: 0 
serial: 1711341811 pageNo: 18 checksum: 768176100
OggS fresh packet | not first | not last page |  pos1: 11735 pos2: 0 serial: 
2006538233 pageNo: 37 checksum: 1583205336
OggS fresh packet | not first | not last page |  pos1: 11747 pos2: 0 serial: 
2006538233 pageNo: 39 checksum: 3819523405
OggS continued packet | not first | not last page |  pos1: 387776 pos2: 0 
serial: 1711341811 pageNo: 20 checksum: 3651565162
OggS continued packet | not first | not last page |  pos1: 408256 pos2: 0 
serial: 1711341811 pageNo: 21 checksum: 70979938
OggS fresh packet | not first | not last page |  pos1: 15296 pos2: 0 serial: 
2006538233 pageNo: 43 checksum: 682432095
OggS fresh packet | not first | not last page |  pos1: 15299 pos2: 0 serial: 
2006538233 pageNo: 44 checksum: 1212016171
OggS fresh packet | not first | not last page |  pos1: 15311 pos2: 0 serial: 
2006538233 pageNo: 48 checksum: 3549700820
OggS continued packet | not first | not last page |  pos1: 16455 pos2: 0 
serial: 2006538233 pageNo: 51 checksum: 261926953
OggS fresh packet | not first | not last page |  pos1: 16459 pos2: 0 serial: 
2006538233 pageNo: 52 checksum: 2466377924
OggS fresh packet | not first | not last page |  pos1: 16462 pos2: 0 serial: 
2006538233 pageNo: 53 checksum: 1867142785
OggS fresh packet | not first | not last page |  pos1: 16470 pos2: 0 serial: 
2006538233 pageNo: 56 checksum: 4153991290
OggS continued packet | not first | not last page |  pos1: 17925 pos2: 0 
serial: 2006538233 pageNo: 57 checksum: 193740926
OggS continued packet | not first | not last page |  pos1: 505536 pos2: 0 
serial: 1711341811 pageNo: 26 checksum: 96702406
OggS fresh packet | not first | not last page |  pos1: 17935 pos2: 0 serial: 
2006538233 pageNo: 60 checksum: 3093073246
OggS fresh packet | not first | not last page |  pos1: 17953 pos2: 0 serial: 
2006538233 pageNo: 64 checksum: 3279733993
[...]


More information about the Theora mailing list