module Stream:sig
..end
type
stream
stream
values track the current encode/decode state of the
current logical bitstream.type
packet
val create : ?serial:nativeint -> unit -> stream
stream
.val serialno : stream -> nativeint
val eos : stream -> bool
val get_page : ?fill:int -> stream -> Ogg.Page.t
If no fill
argument is passed, this function will only return
a page when a "reasonable" amount of packet data is available.
Normally this is appropriate since it limits the overhead of the
Ogg page headers in the bitstream.
If a fill
argument is passed, this function will return a page when at
least four packets have been accumulated and accumulated packet data meets
or exceeds the specified number of bytes, and/or when the accumulated
packet data meets/exceeds the maximum page size regardless of accumulated
packet count.
Call flush_page
if immediate page generation is desired. This
may be occasionally necessary, for example, to limit the temporal
latency of a variable bitrate stream.
val put_page : stream -> Ogg.Page.t -> unit
In a typical decoding situation, this function would be called after
using Sync.read
to create a valid Page.t
Raises Bad_data
if the serial number of the page did not match the
serial number of the bitstream, or the page version was incorrect.
val get_packet : stream -> packet
Each successive call returns the next complete packet built from those segments.
In a typical decoding situation, this should be used after calling
put_page
to submit a page of data to the bitstream.
This function should *not* be used. Because of ocaml's paradigm, it is necessary to copy each packet since they are only valid until this function is called again. When dealing with many packets, this will lead to multiple unecessary memory allocation and desallocation.
Raises Not_enough_data
if more data is needed and another page should be submitted.
Raises Out_of_sync
if we are out of sync and there is a gap in the data.
val peek_packet : stream -> packet
Raises Not_enough_data
if more data is needed and another page should be submitted.
Raises Out_of_sync
if we are out of sync and there is a gap in the data
val peek_granulepos : stream -> Int64.t
Raises Not_enough_data
if more data is needed and another page should be submitted.
Raises Out_of_sync
if we are out of sync and there is a gap in the data
val skip_packet : stream -> unit
Raises Not_enough_data
if more data is needed and another page should be submitted.
Raises Out_of_sync
if we are out of sync and there is a gap in the data
val put_packet : stream -> packet -> unit
This function is provided to ease ogg strea multiplexing, where packet submission
order is important. It should not be used to encoder further data.
val flush_page : stream -> Ogg.Page.t
This should only be used when you want to flush an undersized page from the
middle of the stream. Otherwise, get_page
should always be used.
This function can be used to verify that all packets have been flushed.
Raises Not_enough_data
if all packet data has already been flushed into pages,
and there are no packets to put into the page.
val packet_granulepos : packet -> Int64.t
typet =
stream
val pageout : t -> string
val pagesout : t -> string
val flush : t -> string
val pagesout_eos : t -> string