module Shout:sig..end
Libshout 2 bindings for OCaml.
type shout
A shout connection.
exception Insane
Bad parameters, either nonsense or not applicable due to the current state of the connection.
exception No_connect
A connection with the server could not be established.
exception No_login
The server refused to accept a login attemp (bad user name or password?).
exception Socket
An error occured while sending or receiving data.
exception Malloc
A problem occured while trying to allocate memory (no more memory left?). This exception could be raised by most of the functions.
exception Metadata
An error occured while updating the metadatas on the server.
exception Connected
We are connected to a server.
exception Unconnected
We are not connected to a server.
exception Unsupported
The operation is not supported.
exception Send_error
An error occured while sending data.
type data_format =
| |
Format_vorbis |
(* | ogg / vorbis | *) |
| |
Format_mp3 |
(* | mp3 | *) |
Format of audio data.
type protocol =
| |
Protocol_http |
(* | http | *) |
| |
Protocol_xaudiocast |
(* | audiocast | *) |
| |
Protocol_icy |
(* | shoutcast | *) |
Kind of protocol to use.
val init : unit -> unitInitialize the shout library. Must be called before anything else.
val shutdown : unit -> unitShut down the shout library, deallocating any global storage. Don't call anything afterwards. This function should be called after having finished to use the shout library.
val version : unit -> string * int * int * intGet a version string as well as the value of the library major, minor, and patch levels, respectively.
val get_error : shout -> stringGet a string describing the last shout error to occur. Only valid until the next call to a Shout function.
val get_errno : shout -> intGet the number of the last error.
val new_shout : unit -> shoutCreate a new shout value.
val is_connected : shout -> boolAm I connected to a shoutcast server?
The following parameters may be set only before calling open_shout. They might raise the Malloc exception or the Connected exception when attempting to change a connection attribute while the connection is open.
val set_host : shout -> string -> unitSet the server's hostname or ip address (default: localhost).
val get_host : shout -> stringRetrieve the server's hostname or ip address.
val set_port : shout -> int -> unitSet the server's port (default: 8000).
val get_port : shout -> intRetrieve the server's port.
val set_user : shout -> string -> unitSet the user to authenticate as (default: source).
val get_user : shout -> stringRetrieve the user to authenticate as.
val set_password : shout -> string -> unitSet the password to authenticate the server with.
val get_password : shout -> stringRetrieve the server's password.
val set_protocol : shout -> protocol -> unitSet the protocol to connect to the server with (default: Protocol_http).
val get_protocol : shout -> protocolRetrieve the protocol used to connect to the server.
val set_format : shout -> data_format -> unitSet the stream's audio format (default: Format_vorbis).
val get_format : shout -> data_formatRetrieve the stream's audio format.
val set_mount : shout -> string -> unitSet the the mountpoint (not supported by the Protocol_icy protocol).
val get_mount : shout -> stringRetrieve the mountpoint.
val set_dumpfile : shout -> string -> unitRequest that your stream be archived on the server under the specified name.
val get_dumpfile : shout -> stringRetrieve the dumpfile name.
val set_agent : shout -> string -> unitSet the user agent header (default: libshout/VERSION).
val get_agent : shout -> stringRetrieve the user agent header.
val set_public : shout -> bool -> unitShould we ask the server to list the stream in any directories it knows about (default: false)?
val get_public : shout -> boolShould we ask the server to list the stream in any directories it knows about?
val set_name : shout -> string -> unitSet the name of the stream.
val get_name : shout -> stringRetrieve the name of the stream.
val set_url : shout -> string -> unitSet the url of a site about this stream.
val get_url : shout -> stringRetrieve the url of a site about this stream.
val set_genre : shout -> string -> unitSet the stream genre.
val get_genre : shout -> stringRetrieve the stream genre.
val set_description : shout -> string -> unitSet the stream description.
val get_description : shout -> stringRetrieve the stream description.
val set_audio_info : shout -> string -> string -> unitset_audio_info shout name value sets the stream audio parameter name to the value value.
val get_audio_info : shout -> string -> stringRetrieve a stream audio parameter.
val set_multicast_ip : shout -> string -> unitSet the ip for multicasting the stream.
val get_multicast_ip : shout -> stringRetrieve the ip for multicasting the stream.
val open_shout : shout -> unitOpen a connection to the server. All parameters must already be set.
Insane if host, port or password is unset.Connected if the connection has already been opened.Unsupported if the protocol / format combination is unsupported (e.g. ogg / vobis may only be sent via the http protocol).No_connect if a connection to the server could not be established.Socket if an error occured while talking to the server.No_login if the server refused login (authentication failed).val close : shout -> unitClose a connection to the server.
Unconnected if the shout value is not currently connected.val send : shout -> string -> unitSend data to the server, parsing it for format specific timing info.
Unconnected if the shout value is not currently connected.Socket if an error occured while talking to the server.val send_raw : shout -> string -> intUnconnected if the shout value is not currently connected.Socket if an error occured while talking to the server.val sync : shout -> unitPut caller to sleep until it is time to send more data to the server. Should be called before every call to send (the function delay could also be used to determine the amout of time the caller should wait before sendig data).
val delay : shout -> intAmount of time in miliseconds caller should wait before sending again.
val set_metadata : shout -> (string * string) array -> unitSet metadata for mp3 streams.
No_connect if the server refused the connection attempt.No_login if the server did not accept your authorization credentials.Socket if an error occured talking to the server.Unsupported if the format is not mp3.Metadata if an other error happened (e.g. bad mount point).