module Vorbis: sig
.. end
Decode from or encode to the Ogg Vorbis compressed audio format; or get informations about an Ogg Vorbis file.
Author(s): Samuel Mimram, Julien Cristau
Exceptions
exception Invalid_parameters
Some parameters are invalid for this function.
exception Invalid_quality
The given quality in invalid.
exception Invalid_bitrate
The given bitrate is invalid.
exception Invalid_channels
The given number of channels is invalid.
exception Invalid_sample_freq
The given sampling frequency is invalid.
exception Could_not_open_file
The given file could not be opened.
exception Not_a_vorbis_file
The given file is not in ogg/vorbis format.
exception Hole_in_data
There is a hole in the data.
exception Utf8_failure of string
Error while converting utf8.
Encoding
type
encoder
An ogg encoder.
type
enc_params = {
|
enc_bitrate : int option ; |
|
enc_min_bitrate : int option ; |
|
enc_max_bitrate : int option ; |
|
enc_quality : float ; |
|
enc_channels : int ; |
|
enc_sample_freq : int option ; |
|
enc_managed : bool ; |
|
enc_in_channels : int ; |
|
enc_in_sample_freq : int ; |
|
enc_in_sample_size : int ; |
|
enc_in_big_endian : bool ; |
}
Parameters for encoders, specifying input and output format.
val create_encoder : ?title:string ->
?artist:string ->
?genre:string ->
?date:string ->
?album:string ->
?tracknum:string -> enc_params -> encoder * string
Create a new encoder.
val create_encoder_opt : string option ->
string option ->
string option ->
string option ->
string option ->
string option -> enc_params -> encoder * string
val encode_buffer : encoder -> string -> string
Encode a wav buffer into ogg.
Decoding
type
dec_params = {
|
channels : int ; |
|
sample_freq : int ; |
|
sample_size : int ; |
|
big_endian : bool ; |
|
signed : bool ; |
}
Output wav format parameters for decoders.
type
dec_file
Ogg/vorbis file opened in input (for decoding).
val open_dec_file : string -> dec_params -> dec_file
Open an ogg/vorbis file for decoding. Can raise: Could_not_open_file
or Not_a_vorbis_file
.
val decode : dec_file -> string -> int -> int -> int
decode dec_file buf ofs len
decodes len
octets of wav and put them in buf
starting at position pos
. It can raise: End_of_file
when the whole file has been decoded, Hole_in_data
, Invalid_parameters
if all the data cannot fit in the buffer starting at the given position.
val close_dec_file : dec_file -> unit
Close an ogg/vorbis file opened for decoding. The file descriptor used for the matching open_dec_file
is closed (I think).
val encoder_reset : ?title:string ->
?artist:string ->
?genre:string ->
?date:string -> ?album:string -> ?tracknum:string -> encoder -> string
Reset the encoder state to a fresh, initialized state with the given metadata
val encoder_reset_opt : string option ->
string option ->
string option ->
string option -> string option -> string option -> encoder -> string
Informations about files
type
info = {
|
vorbis_version : int ; |
|
audio_channels : int ; |
|
audio_sample_rate : int ; |
|
bitrate_maximum : int option ; |
|
bitrate_nominal : int option ; |
|
bitrate_minimum : int option ; |
|
blocksize_0 : int ; |
|
blocksize_1 : int ; |
|
duration : int ; |
}
Vorbis informations about a file.
val get_comments : string -> string * (string * string) array
Get the vorbis comments from a file (see Vorbis.Info.get_comments
).
val get_info : string -> info
Get the vorbis information from the file header.
val file_size : string -> int
Get the size of a file (in bytes).
module type Iofile = sig
.. end
Signature of a module to access to files.
module Info:
Get info and comments from a vorbis file via the Io module.