module Encoder:sig
..end
type
t
Internal state of an encoder.
val create : int -> int -> int -> int -> int -> t
create chans rate max_br nom_br min_br
creates a new encoder with
chans
channels, with sample rate rate
Hz and with respectively max_br
,
nom_br
and min_br
as maximal, nominal and minimal bitrates (in bps).
val create_vbr : int -> int -> float -> t
create_vbr chans rate quality
creates a new encoder in variable bitrate
with chans
channels, with sample rate rate
Hz and with quality
quality
, which should be between -1 and 1 (1 is the best).
val reset : t -> unit
val headerout : ?encoder:string ->
t -> Ogg.Stream.stream -> (string * string) list -> unit
Encode a header given a list of tags.
val headerout_packetout : ?encoder:string ->
t ->
(string * string) list ->
Ogg.Stream.packet * Ogg.Stream.packet * Ogg.Stream.packet
Encoder a header, but do not submit packet to Ogg Stream. Usefull when multiplexing ogg streams since the all first packets of each streams must be packed in the initial pages.
val get_channels : t -> int
Get the number of audio channels expected by the encoder.
val encode_buffer_float : t ->
Ogg.Stream.stream -> float array array -> int -> int -> unit
Encode a buffer of PCM data.
The PCM data array must have at least the expected
number of channels. Otherwise, the function raises Invalid_channels
.
val time_of_granulepos : t -> Stdlib.Int64.t -> Stdlib.Nativeint.t
Convert a granulepos to absolute time in seconds. The granulepos is interpreted in the context of a given encoder, and gives the end time of a frame's presentation as used in Ogg mux ordering.
val end_of_stream : t -> Ogg.Stream.stream -> unit