libkate 0.4.1
|
Ogg leaves the encoding of granules up to a particular codec, only mandating that granules be non decreasing with time.
The Kate bitstream format uses a linear mapping between time and granule, described here.
A Kate granule position is composed of two different parts:
+----------------+----------------+ | base | offset | +----------------+----------------+
The number of bits these parts occupy is variable, and each stream may choose how many bits to dedicate to each. The kate_info structure for a stream holds that information in the granule_shift field, so each part may be reconstructed from a granulepos.
The kate_info structure for a stream also holds a rational fraction representing the time span of granule units.
The granule rate is defined by the two fields:
The number of bits reserved for the offset is defined by the field: