Page Structure
Every Ogg page begins with the four-byte magic string "OggS". If sync is lost a decoder can look for the next occurrence of this sequence to begin decoding again. This string is followed by a null byte for Ogg version 0. The version field had originally been intended to allow multiple Ogg page types tuned for different payloads to coexist in the same stream. At the 2000s it became clear that only one page version will be used.
The sixth byte of each page specifies type flags. The value of 1 specifies that contained data is continued from the last page. The value of 2 specifies that this is the first page of the stream, and the value of 4 specifies that this is the last page of the stream. These values can be combined with addition or logical OR.
The next 8 bytes, or 64 bits, is called the absolute granule position which is a synthetic value that encodes the Decode Timestamp, the Presentation time stamp and distance to first-needed reference. The exact encoding of the granule position is up to a specific codec.
The following 4 bytes are the stream serial number to which this page belongs. Each logical stream must have a unique serial number within a physical stream. It is also intended to be used like a weak hash so that a collision is very unlikely when multiplexing different streams, which eliminates the need for continuous recalculation of page headers at every multiplexing step.
The following 4 bytes are the page sequence number within the stream. Its a Page counter that lets you know if a page is lost. In comparison to other container formats, the large number of bits also allows direct UDP unicast/multicast with Ogg handling reordering and reassembly.
The next 4 bytes, starting at the 23rd byte of the page, is the CRC checksum of the page. Because the value of this field changes the result of the check is computed with this field equal to zero.
Next, the 27th byte of each page specifies the number of segments it contains which ranges from 0 to 255. This is also the size of the following segment table in bytes. Each byte of the segment table provides the length of a segment.
Each segment can be up to 255 bytes in length and is bounded by the page. If a segment is less than 255 it marks the end of a packet, the next segment will begin a new packet. If a packet ends on a multiple of 255, it will end in a segment 0 bytes long. If the last segment of the page is 255 bytes then the last packet is continued on the following page.
Read more about this topic: Ogg Page
Famous quotes containing the words page and/or structure:
“So here they are, the dog-faced soldiers, the regulars, the fifty-cents-a-day professionals riding the outposts of the nation, from Fort Reno to Fort Apache, from Sheridan to Stark. They were all the same. Men in dirty-shirt blue and only a cold page in the history books to mark their passing. But wherever they rode and whatever they fought for, that place became the United States.”
—Frank S. Nugent (19081965)
“A committee is organic rather than mechanical in its nature: it is not a structure but a plant. It takes root and grows, it flowers, wilts, and dies, scattering the seed from which other committees will bloom in their turn.”
—C. Northcote Parkinson (19091993)