]> git.sesse.net Git - vlc/blob - include/vlc/libvlc.h
More VLM API stuff
[vlc] / include / vlc / libvlc.h
1 /*****************************************************************************
2  * libvlc.h:  libvlc_* new external API
3  *****************************************************************************
4  * Copyright (C) 1998-2005 the VideoLAN team
5  * $Id: vlc.h 13701 2005-12-12 17:58:56Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /**
25  * \defgroup libvlc Libvlc
26  * This is libvlc, the base library of the VLC program.
27  *
28  * @{
29  */
30
31
32 #ifndef _LIBVLC_H
33 #define _LIBVLC_H 1
34
35 #include <vlc/vlc.h>
36
37 # ifdef __cplusplus
38 extern "C" {
39 # endif
40
41 /*****************************************************************************
42  * Exception handling
43  *****************************************************************************/
44 /** defgroup libvlc_exception Exceptions
45  * \ingroup libvlc
46  * LibVLC Exceptions handling
47  * @{
48  */
49
50 struct libvlc_exception_t
51 {
52     int b_raised;
53     char *psz_message;
54 };
55 typedef struct libvlc_exception_t libvlc_exception_t;
56
57 /**
58  * Initialize an exception structure. This can be called several times to reuse
59  * an exception structure.
60  * \param p_exception the exception to initialize
61  */
62 void libvlc_exception_init( libvlc_exception_t *p_exception );
63
64 /**
65  * Has an exception been raised ?
66  * \param p_exception the exception to query
67  * \return 0 if no exception raised, 1 else
68  */
69 int libvlc_exception_raised( libvlc_exception_t *p_exception );
70
71 /**
72  * Raise an exception
73  * \param p_exception the exception to raise
74  * \param psz_message the exception message
75  */
76 void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... );
77
78 /**
79  * Clear an exception object so it can be reused.
80  * The exception object must be initialized
81  * \param p_exception the exception to clear
82  */
83 void libvlc_exception_clear( libvlc_exception_t * );
84
85 /**
86  * Get exception message
87  * \param p_exception the exception to query
88  * \return the exception message or NULL if not applicable (exception not raised
89  * for example)
90  */
91 char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
92
93
94
95 /** @} */
96
97 /*****************************************************************************
98  * Core handling
99  *****************************************************************************/
100
101 /** defgroup libvlc_core Core
102  * \ingroup libvlc
103  * LibVLC Core
104  * @{
105  */
106
107 /** This structure is opaque. It represents a libvlc instance */
108 typedef struct libvlc_instance_t libvlc_instance_t;
109
110 /**
111  * Create an initialized libvlc instance
112  * \param argc the number of arguments
113  * \param argv command-line-type arguments
114  * \param exception an initialized exception pointer
115  */
116 libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
117
118 /**
119  * Destroy a libvlc instance
120  * \param p_instance the instance to destroy
121  */
122 void libvlc_destroy( libvlc_instance_t *);
123
124 /** @}*/
125
126 /*****************************************************************************
127  * Playlist
128  *****************************************************************************/
129 /** defgroup libvlc_playlist Playlist
130  * \ingroup libvlc
131  * LibVLC Playlist handling
132  * @{
133  */
134
135 /**
136  * Start playing. You can give some additionnal playlist item options
137  * that will be added to the item before playing it.
138  * \param p_instance the instance
139  * \param i_id the item to play. If this is a negative number, the next
140  * item will be selected. Else, the item with the given ID will be played
141  * \param i_options the number of options to add to the item
142  * \param ppsz_options the options to add to the item
143  * \param p_exception an initialized exception
144  */
145 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
146                            libvlc_exception_t * );
147
148 /**
149  * Pause a running playlist, resume if it was stopped
150  * \param p_instance the instance to pause
151  * \param p_exception an initialized exception
152  */
153 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
154
155 /**
156  * Checks if the playlist is running
157  * \param p_instance the instance
158  * \param p_exception an initialized exception
159  * \return 0 if the playlist is stopped or paused, 1 if it is running
160  */
161 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
162
163 /**
164  * Get the number of items in the playlist
165  * \param p_instance the instance
166  * \param p_exception an initialized exception
167  * \return the number of items
168  */
169 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
170
171
172
173
174
175 /**
176  * Stop playing
177  * \param p_instance the instance to stop
178  * \param p_exception an initialized exception
179  */
180 void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
181
182 /**
183  * Go to next playlist item (starts playback if it was stopped)
184  * \param p_instance the instance to use
185  * \param p_exception an initialized exception
186  */
187 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
188
189 /**
190  * Go to previous playlist item (starts playback if it was stopped)
191  * \param p_instance the instance to use
192  * \param p_exception an initialized exception
193  */
194 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
195
196 /**
197  * Remove all playlist items
198  * \param p_instance the instance
199  * \param p_exception an initialized exception
200  */
201 void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
202
203 /**
204  * Go to next playlist item
205  * \param p_instance the instance
206  * \param p_exception an initialized exception
207  */
208 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
209
210 /**
211  * Go to Previous playlist item
212  * \param p_instance the instance
213  * \param p_exception an initialized exception
214  */
215 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
216
217 /**
218  * Add an item at the end of the playlist
219  * If you need more advanced options, \see libvlc_playlist_add_extended
220  * \param p_instance the instance
221  * \param psz_uri the URI to open, using VLC format
222  * \param psz_name a name that you might want to give or NULL
223  * \return the identifier of the new item
224  */
225 int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
226                          libvlc_exception_t * );
227
228 /**
229  * Add an item at the end of the playlist, with additional input options
230  * \param p_instance the instance
231  * \param psz_uri the URI to open, using VLC format
232  * \param psz_name a name that you might want to give or NULL
233  * \param i_options the number of options to add
234  * \param ppsz_options strings representing the options to add
235  * \return the identifier of the new item
236  */
237 int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
238                                   const char *, int, const char **,
239                                   libvlc_exception_t * );
240
241
242
243 typedef struct libvlc_input_t libvlc_input_t;
244
245 /* Get the input that is currently being played by the playlist
246  * \param p_instance the instance to use
247  * \param p_exception an initialized excecption
248  * \return an input object
249  */
250 libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
251                                            libvlc_exception_t * );
252
253
254
255 /** @}*/
256
257 /*****************************************************************************
258  * Input
259  *****************************************************************************/
260 /** defgroup libvlc_input Input
261  * \ingroup libvlc
262  * LibVLC Input handling
263  * @{
264  */
265
266 /** Free an input object
267  * \param p_input the input to free
268  */
269 void libvlc_input_free( libvlc_input_t * );
270
271 /// \bug This might go away ... to be replaced by a broader system
272 vlc_int64_t libvlc_input_get_length( libvlc_input_t *, libvlc_exception_t *);
273 vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *);
274 float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
275
276
277 /** @} */
278
279 /** defgroup libvlc_video Video
280  * \ingroup libvlc
281  * LibVLC Video handling
282  * @{
283  */
284
285 /**
286  * Toggle fullscreen status on video output
287  * \param p_input the input
288  * \param p_exception an initialized exception
289  */
290 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
291
292 /**
293  * Enable or disable fullscreen on a video output
294  * \param p_input the input
295  * \param b_fullscreen boolean for fullscreen status
296  * \param p_exception an initialized exception
297  */
298 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
299
300 /**
301  * Get current fullscreen status
302  * \param p_input the input
303  * \param p_exception an initialized exception
304  * \return the fullscreen status (boolean)
305  */
306 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
307
308 /** @}
309  * defgroup libvlc_vlm VLM
310  * \ingroup libvlc
311  * LibVLC VLM handling
312  * @{
313  */
314
315
316 /**
317  * Add a broadcast, with one input
318  * \param p_instance the instance
319  * \param psz_name the name of the new broadcast
320  * \param psz_input the input MRL
321  * \param psz_output the output MRL (the parameter to the "sout" variable)
322  * \param i_options number of additional options
323  * \param ppsz_options additional options
324  * \param b_enabled boolean for enabling the new broadcast
325  * \param b_loop Should this broadcast be played in loop ?
326  * \param p_exception an initialized exception
327  */
328 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
329                                int, char **, int, int, libvlc_exception_t * );
330
331 /**
332  * Delete a media (vod or broadcast)
333  * \param p_instance the instance
334  * \param psz_name the media to delete
335  * \param p_exception an initialized exception
336  */
337 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
338
339 /**
340  * Enable or disable a media (vod or broadcast)
341  * \param p_instance the instance
342  * \param psz_name the media to work on
343  * \param b_enabled the new status
344  * \param p_exception an initialized exception
345  */
346 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
347                              libvlc_exception_t *);
348
349 /**
350  * Set the output for a media
351  * \param p_instance the instance
352  * \param psz_name the media to work on
353  * \param psz_output the output MRL (the parameter to the "sout" variable)
354  * \param p_exception an initialized exception
355  */
356 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
357                             libvlc_exception_t *);
358
359 /**
360  * Set a media's input MRL. This will delete all existing inputs and
361  * add the specified one.
362  * \param p_instance the instance
363  * \param psz_name the media to work on
364  * \param psz_input the input MRL
365  * \param p_exception an initialized exception
366  */
367 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
368                            libvlc_exception_t *);
369
370
371
372 /**
373  * Set output for a media
374  * \param p_instance the instance
375  * \param psz_name the media to work on
376  * \param b_loop the new status
377  * \param p_exception an initialized exception
378  */
379 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
380                           libvlc_exception_t *);
381
382
383
384
385 /**
386  * Edit the parameters of a media. This will delete all existing inputs and
387  * add the specified one.
388  * \param p_instance the instance
389  * \param psz_name the name of the new broadcast
390  * \param psz_input the input MRL
391  * \param psz_output the output MRL (the parameter to the "sout" variable)
392  * \param i_options number of additional options
393  * \param ppsz_options additional options
394  * \param b_enabled boolean for enabling the new broadcast
395  * \param b_loop Should this broadcast be played in loop ?
396  * \param p_exception an initialized exception
397  */
398 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
399                               int, char **, int, int, libvlc_exception_t * );
400
401
402 /** @} */
403
404 # ifdef __cplusplus
405 }
406 # endif
407
408 #endif /* <vlc/libvlc.h> */