File: Shout.html

package info (click to toggle)
ocaml-shout 0.2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 612 kB
  • sloc: ansic: 410; ml: 206; makefile: 93; sh: 4
file content (303 lines) | stat: -rw-r--r-- 20,586 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Shout" rel="Chapter" href="Shout.html"><link title="Types and exceptions." rel="Section" href="#1_Typesandexceptions">
<link title="Initialization and creation functions." rel="Section" href="#1_Initializationandcreationfunctions">
<link title="Setting and retrieving preliminary parameters." rel="Section" href="#1_Settingandretrievingpreliminaryparameters">
<link title="Managing the connection and sending data." rel="Section" href="#1_Managingtheconnectionandsendingdata">
<link title="Connection parameters" rel="Subsection" href="#2_Connectionparameters">
<link title="Directory parameters (optionnal)" rel="Subsection" href="#2_Directoryparametersoptionnal">
<link title="Multicasting" rel="Subsection" href="#2_Multicasting">
<title>Shout</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="index.html">Up</a>
&nbsp;</div>
<center><h1>Module <a href="type_Shout.html">Shout</a></h1></center>
<br>
<pre><span class="keyword">module</span> Shout: <code class="code">sig</code> <a href="Shout.html">..</a> <code class="code">end</code></pre>Libshout 2 bindings for OCaml.<br>
<b>Author(s):</b> Samuel Mimram<br>
<hr width="100%">
<br>
<a name="1_Typesandexceptions"></a>
<h1>Types and exceptions.</h1><br>
<pre><span class="keyword">type</span> <a name="TYPEshout"></a><code class="type"></code>shout </pre>
<div class="info">
A shout connection.<br>
</div>

<pre><span class="keyword">exception</span> <a name="EXCEPTIONInsane"></a>Insane</pre>
<div class="info">
Bad parameters, either nonsense or not applicable due to the current state of the connection.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONNo_connect"></a>No_connect</pre>
<div class="info">
A connection with the server could not be established.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONNo_login"></a>No_login</pre>
<div class="info">
The server refused to accept a login attemp (bad user name or password?).<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONSocket"></a>Socket</pre>
<div class="info">
An error occured while sending or receiving data.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONMalloc"></a>Malloc</pre>
<div class="info">
A problem occured while trying to allocate memory (no more memory left?). This exception could be raised by most of the functions.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONMetadata"></a>Metadata</pre>
<div class="info">
An error occured while updating the metadatas on the server.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONConnected"></a>Connected</pre>
<div class="info">
We are connected to a server.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONUnconnected"></a>Unconnected</pre>
<div class="info">
We are not connected to a server.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONUnsupported"></a>Unsupported</pre>
<div class="info">
The operation is not supported.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONSend_error"></a>Send_error</pre>
<div class="info">
An error occured while sending data.<br>
</div>
<br><code><span class="keyword">type</span> <a name="TYPEdata_format"></a><code class="type"></code>data_format = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Format_vorbis</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >ogg / vorbis</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Format_mp3</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >mp3</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
Format of audio data.<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEprotocol"></a><code class="type"></code>protocol = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Protocol_http</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >http</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Protocol_xaudiocast</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >audiocast</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Protocol_icy</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >shoutcast</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
Kind of protocol to use.<br>
</div>

<br>
<a name="1_Initializationandcreationfunctions"></a>
<h1>Initialization and creation functions.</h1><br>
<pre><span class="keyword">val</span> <a name="VALinit"></a>init : <code class="type">unit -> unit</code></pre><div class="info">
Initialize the shout library. Must be called before anything else.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALshutdown"></a>shutdown : <code class="type">unit -> unit</code></pre><div class="info">
Shut 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.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALversion"></a>version : <code class="type">unit -> string * int * int * int</code></pre><div class="info">
Get a version string as well as the value of the library major, minor, and patch levels, respectively.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_error"></a>get_error : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Get a string describing the last shout error to occur.  Only valid until the next call to a <code class="code">Shout</code> function.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_errno"></a>get_errno : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> int</code></pre><div class="info">
Get the number of the last error.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnew_shout"></a>new_shout : <code class="type">unit -> <a href="Shout.html#TYPEshout">shout</a></code></pre><div class="info">
Create a new <code class="code">shout</code> value.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALis_connected"></a>is_connected : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> bool</code></pre><div class="info">
Am I connected to a shoutcast server?<br>
</div>
<br>
<a name="1_Settingandretrievingpreliminaryparameters"></a>
<h1>Setting and retrieving preliminary parameters.</h1><br>
<br>
The following parameters may be set only <i>before</i> calling <code class="code">open_shout</code>. They might raise the <code class="code">Malloc</code> exception or the <code class="code">Connected</code> exception when attempting to change a connection attribute while the connection is open.<br>
<br>
<a name="2_Connectionparameters"></a>
<h2>Connection parameters</h2><br>
<pre><span class="keyword">val</span> <a name="VALset_host"></a>set_host : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the server's hostname or ip address (default: localhost).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_host"></a>get_host : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the server's hostname or ip address.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_port"></a>set_port : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> int -> unit</code></pre><div class="info">
Set the server's port (default: 8000).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_port"></a>get_port : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> int</code></pre><div class="info">
Retrieve the server's port.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_user"></a>set_user : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the user to authenticate as (default: source).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_user"></a>get_user : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the user to authenticate as.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_password"></a>set_password : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the password to authenticate the server with.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_password"></a>get_password : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the server's password.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_protocol"></a>set_protocol : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> <a href="Shout.html#TYPEprotocol">protocol</a> -> unit</code></pre><div class="info">
Set the protocol to connect to the server with (default: Protocol_http).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_protocol"></a>get_protocol : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> <a href="Shout.html#TYPEprotocol">protocol</a></code></pre><div class="info">
Retrieve the protocol used to connect to the server.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_format"></a>set_format : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> <a href="Shout.html#TYPEdata_format">data_format</a> -> unit</code></pre><div class="info">
Set the stream's audio format (default: Format_vorbis).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_format"></a>get_format : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> <a href="Shout.html#TYPEdata_format">data_format</a></code></pre><div class="info">
Retrieve the stream's audio format.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_mount"></a>set_mount : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the the mountpoint (not supported by the <code class="code">Protocol_icy</code> protocol).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_mount"></a>get_mount : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the mountpoint.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_dumpfile"></a>set_dumpfile : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Request that your stream be archived on the server under the specified name.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_dumpfile"></a>get_dumpfile : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the dumpfile name.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_agent"></a>set_agent : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the user agent header (default: libshout/VERSION).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_agent"></a>get_agent : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the user agent header.<br>
</div>
<br>
<a name="2_Directoryparametersoptionnal"></a>
<h2>Directory parameters (optionnal)</h2><br>
<pre><span class="keyword">val</span> <a name="VALset_public"></a>set_public : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> bool -> unit</code></pre><div class="info">
Should we ask the server to list the stream in any directories it knows about (default: <code class="code">false</code>)?<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_public"></a>get_public : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> bool</code></pre><div class="info">
Should we ask the server to list the stream in any directories it knows about?<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_name"></a>set_name : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the name of the stream.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_name"></a>get_name : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the name of the stream.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_url"></a>set_url : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the url of a site about this stream.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_url"></a>get_url : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the url of a site about this stream.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_genre"></a>set_genre : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the stream genre.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_genre"></a>get_genre : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the stream genre.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_description"></a>set_description : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the stream description.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_description"></a>get_description : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the stream description.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_audio_info"></a>set_audio_info : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> string -> unit</code></pre><div class="info">
<code class="code">set_audio_info shout name value</code> sets the stream audio parameter <code class="code">name</code> to the value <code class="code">value</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_audio_info"></a>get_audio_info : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> string</code></pre><div class="info">
Retrieve a stream audio parameter.<br>
</div>
<br>
<a name="2_Multicasting"></a>
<h2>Multicasting</h2><br>
<pre><span class="keyword">val</span> <a name="VALset_multicast_ip"></a>set_multicast_ip : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Set the ip for multicasting the stream.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALget_multicast_ip"></a>get_multicast_ip : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string</code></pre><div class="info">
Retrieve the ip for multicasting the stream.<br>
</div>
<br>
<a name="1_Managingtheconnectionandsendingdata"></a>
<h1>Managing the connection and sending data.</h1><br>
<pre><span class="keyword">val</span> <a name="VALopen_shout"></a>open_shout : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> unit</code></pre><div class="info">
Open a connection to the server.  All parameters must already be set.<br>
<b>Raises</b><ul><li><code>Insane</code> if host, port or password is unset.</li>
<li><code>Connected</code> if the connection has already been opened.</li>
<li><code>Unsupported</code> if the protocol / format combination is unsupported (e.g. ogg / vobis may only be sent via the http protocol).</li>
<li><code>No_connect</code> if a connection to the server could not be established.</li>
<li><code>Socket</code> if an error occured while talking to the server.</li>
<li><code>No_login</code> if the server refused login (authentication failed).</li>
</ul>
</div>
<pre><span class="keyword">val</span> <a name="VALclose"></a>close : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> unit</code></pre><div class="info">
Close a connection to the server.<br>
<b>Raises</b> <code>Unconnected</code> if the <code class="code">shout</code> value is not currently connected.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsend"></a>send : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> unit</code></pre><div class="info">
Send data to the server, parsing it for format specific timing info.<br>
<b>Raises</b><ul><li><code>Unconnected</code> if the <code class="code">shout</code> value is not currently connected.</li>
<li><code>Socket</code> if an error occured while talking to the server.</li>
</ul>
</div>
<pre><span class="keyword">val</span> <a name="VALsend_raw"></a>send_raw : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> string -> int</code></pre><div class="info">
<span class="warning">Deprecated.</span>Send unparsed data to the server.  Do not use this unless you know what you are doing.<br>
<b>Raises</b><ul><li><code>Unconnected</code> if the <code class="code">shout</code> value is not currently connected.</li>
<li><code>Socket</code> if an error occured while talking to the server.</li>
</ul>
<b>Returns</b> the number of bytes written.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsync"></a>sync : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> unit</code></pre><div class="info">
Put caller to sleep until it is time to send more data to the server. Should be called before every call to <code class="code">send</code> (the function <code class="code">delay</code> could also be used to determine the amout of time the caller should wait before sendig data).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdelay"></a>delay : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> int</code></pre><div class="info">
Amount of time in miliseconds caller should wait before sending again.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALset_metadata"></a>set_metadata : <code class="type"><a href="Shout.html#TYPEshout">shout</a> -> (string * string) array -> unit</code></pre><div class="info">
Set metadata for mp3 streams.<br>
<b>Raises</b><ul><li><code>No_connect</code> if the server refused the connection attempt.</li>
<li><code>No_login</code> if the server did not accept your authorization credentials.</li>
<li><code>Socket</code> if an error occured talking to the server.</li>
<li><code>Unsupported</code> if the format is not mp3.</li>
<li><code>Metadata</code> if an other error happened (e.g. bad mount point).</li>
</ul>
</div>
</body></html>