module Decoder:sig
..end
type
t
Internal state of a decoder.
val create : (int -> string * int) ->
(int -> Unix.seek_command -> int) -> (unit -> int) -> t
create read_func seek_func tell_func params
opens a
stream like openfile
for decoding but callbacks are used to
manipulate the data. read_func
should return the requested amount of bytes
(or less if it is the end of file), seek_funk
should return 0 if the seek
was ok or -1 if the stream is not seekable, tell_func
should return the current
offset or -1 if there is no notion of offset in the stream.
Raises: Read_error
, Not_vorbis
, Version_mismatch
, Bad_header
, Internal_fault
.
val openfile : string -> t * Unix.file_descr
Open a vorbis file for decoding.
val openfile_with_fd : Unix.file_descr -> t
val decode_float : t -> float array array -> int -> int -> int
decode_float dec buff ofs len
decodes len
samples in each channel and puts
the result in buff
starting at position ofs
.
Hole_in_data
if there was an interruption of the data.Invalid_parameters
if all the data cannot fit in the buffer starting at the given position.val decode_float_alloc : t -> int -> float array array
val decode : t ->
?big_endian:bool ->
?sample_size:int -> ?signed:bool -> string -> int -> int -> int
Same as decode_float
but decodes to integers.
val streams : t -> int
Get the number of logical bitstreams within a physical bitstream.
val bitstream : t -> Vorbis.bitstream
Get the index of the sequential logical bitstream currently being decoded (incremented at chaining boundaries even for non-seekable streams). For seekable streams, it represents the actual chaining index within the physical bitstream.
val comments : t -> Vorbis.bitstream -> string * (string * string) list
Get the vorbis comments from a vorbis file. The second argument is the
number of the logical bitstream (the current bitstream is used if it is set
to None
).
val info : t -> Vorbis.bitstream -> Vorbis.info
Get the vorbis information from the stream header of a bitstream.
val bitrate : t -> Vorbis.bitstream -> int
Get the bitrate of a bitsream (in bps).
val samples : t -> Vorbis.bitstream -> int
Get the total pcm samples of a bitstream.
val duration : t -> Vorbis.bitstream -> float
Get the duration in seconds of a bitstream.
val serialnumber : t -> Vorbis.bitstream -> int
Get the serial number of a bitstream.