Module Ogg.Page

module Page: sig .. end

The page struct encapsulates the data for an Ogg page.

Ogg pages are the fundamental unit of framing and interleave in an ogg bitstream. They are made up of packet segments of 255 bytes each. There can be as many as 255 packet segments per page, for a maximum page size of a little under 64 kB. This is not a practical limitation as the segments can be joined across page boundaries allowing packets of arbitrary size. In practice pages are usually around 4 kB.


type t = string * string 

A page is a header and a body

val serialno : t -> nativeint

Returns the unique serial number for the logical bitstream of this page. Each page contains the serial number for the logical bitstream that it belongs to.

val eos : t -> bool

Indicates whether this page is at the end of the logical bitstream.

val bos : t -> bool

Indicates whether this page is at the begining of the logical bitstream.

val continued : t -> bool

Indicates whether this page contains packet data which has been continued from the previous page.

val packets : t -> int

Returns the number of packets that are completed on this page. If the leading packet is begun on a previous page, but ends on this page, it's counted.

If a page consists of a packet begun on a previous page, and a new packet begun (but not completed) on this page, the return will be:

packets page will return 1, continued paged will return true

If a page happens to be a single packet that was begun on a previous page, and spans to the next page (in the case of a three or more page packet), the return will be:

packets page will return 0, continued page will return true.

val version : t -> int

This function returns the version of ogg_page used in this page. In current versions of libogg, all ogg_page structs have the same version, so 0 should always be returned.

val granulepos : t -> Stdlib.Int64.t

Returns the exact granular position of the packet data contained at the end of this page.

This is useful for tracking location when seeking or decoding.

For example, in audio codecs this position is the pcm sample number and in video this is the frame number.

val pageno : t -> nativeint

Returns the sequential page number.

This is useful for ordering pages or determining when pages have been lost.

val set_checksum : t -> unit

Checksums an ogg_page.