]> git.sesse.net Git - vlc/blob - include/vlc/libvlc.h
Real VOUT_REPARENT (UNIX only ATM).
[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 #ifndef WIN32
38 #include <X11/Xlib.h>
39 #endif
40
41 # ifdef __cplusplus
42 extern "C" {
43 # endif
44
45 /*****************************************************************************
46  * Exception handling
47  *****************************************************************************/
48 /** defgroup libvlc_exception Exceptions
49  * \ingroup libvlc
50  * LibVLC Exceptions handling
51  * @{
52  */
53
54 struct libvlc_exception_t
55 {
56     int b_raised;
57     char *psz_message;
58 };
59 typedef struct libvlc_exception_t libvlc_exception_t;
60
61 /**
62  * Initialize an exception structure. This can be called several times to reuse
63  * an exception structure.
64  * \param p_exception the exception to initialize
65  */
66 void libvlc_exception_init( libvlc_exception_t *p_exception );
67
68 /**
69  * Has an exception been raised ?
70  * \param p_exception the exception to query
71  * \return 0 if no exception raised, 1 else
72  */
73 int libvlc_exception_raised( libvlc_exception_t *p_exception );
74
75 /**
76  * Raise an exception
77  * \param p_exception the exception to raise
78  * \param psz_message the exception message
79  */
80 void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... );
81
82 /**
83  * Clear an exception object so it can be reused.
84  * The exception object must be initialized
85  * \param p_exception the exception to clear
86  */
87 void libvlc_exception_clear( libvlc_exception_t * );
88
89 /**
90  * Get exception message
91  * \param p_exception the exception to query
92  * \return the exception message or NULL if not applicable (exception not raised
93  * for example)
94  */
95 char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
96
97 /**@} */
98
99 /*****************************************************************************
100  * Core handling
101  *****************************************************************************/
102
103 /** defgroup libvlc_core Core
104  * \ingroup libvlc
105  * LibVLC Core
106  * @{
107  */
108
109 /** This structure is opaque. It represents a libvlc instance */
110 typedef struct libvlc_instance_t libvlc_instance_t;
111
112 /**
113  * Create an initialized libvlc instance
114  * \param argc the number of arguments
115  * \param argv command-line-type arguments
116  * \param exception an initialized exception pointer
117  */
118 libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
119
120 /**
121  * Destroy a libvlc instance
122  * \param p_instance the instance to destroy
123  */
124 void libvlc_destroy( libvlc_instance_t *);
125
126 /** @}*/
127
128 /*****************************************************************************
129  * Playlist
130  *****************************************************************************/
131 /** defgroup libvlc_playlist Playlist
132  * \ingroup libvlc
133  * LibVLC Playlist handling
134  * @{
135  */
136
137 /**
138  * Start playing. You can give some additionnal playlist item options
139  * that will be added to the item before playing it.
140  * \param p_instance the instance
141  * \param i_id the item to play. If this is a negative number, the next
142  * item will be selected. Else, the item with the given ID will be played
143  * \param i_options the number of options to add to the item
144  * \param ppsz_options the options to add to the item
145  * \param p_exception an initialized exception
146  */
147 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
148                            libvlc_exception_t * );
149
150 /**
151  * Pause a running playlist, resume if it was stopped
152  * \param p_instance the instance to pause
153  * \param p_exception an initialized exception
154  */
155 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
156
157 /**
158  * Checks if the playlist is running
159  * \param p_instance the instance
160  * \param p_exception an initialized exception
161  * \return 0 if the playlist is stopped or paused, 1 if it is running
162  */
163 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
164
165 /**
166  * Get the number of items in the playlist
167  * \param p_instance the instance
168  * \param p_exception an initialized exception
169  * \return the number of items
170  */
171 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
172
173 /**
174  * Stop playing
175  * \param p_instance the instance to stop
176  * \param p_exception an initialized exception
177  */
178 void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
179
180 /**
181  * Go to next playlist item (starts playback if it was stopped)
182  * \param p_instance the instance to use
183  * \param p_exception an initialized exception
184  */
185 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
186
187 /**
188  * Go to previous playlist item (starts playback if it was stopped)
189  * \param p_instance the instance to use
190  * \param p_exception an initialized exception
191  */
192 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
193
194 /**
195  * Remove all playlist items
196  * \param p_instance the instance
197  * \param p_exception an initialized exception
198  */
199 void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
200
201 /**
202  * Go to next playlist item
203  * \param p_instance the instance
204  * \param p_exception an initialized exception
205  */
206 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
207
208 /**
209  * Go to Previous playlist item
210  * \param p_instance the instance
211  * \param p_exception an initialized exception
212  */
213 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
214
215 /**
216  * Add an item at the end of the playlist
217  * If you need more advanced options, \see libvlc_playlist_add_extended
218  * \param p_instance the instance
219  * \param psz_uri the URI to open, using VLC format
220  * \param psz_name a name that you might want to give or NULL
221  * \return the identifier of the new item
222  */
223 int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
224                          libvlc_exception_t * );
225
226 /**
227  * Add an item at the end of the playlist, with additional input options
228  * \param p_instance the instance
229  * \param psz_uri the URI to open, using VLC format
230  * \param psz_name a name that you might want to give or NULL
231  * \param i_options the number of options to add
232  * \param ppsz_options strings representing the options to add
233  * \return the identifier of the new item
234  */
235 int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
236                                   const char *, int, const char **,
237                                   libvlc_exception_t * );
238
239
240 int libvlc_playlist_delete_item( libvlc_instance_t *, int,
241                                  libvlc_exception_t * );
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 vlc_bool_t  libvlc_input_will_play      ( libvlc_input_t *, libvlc_exception_t *);
276 vlc_bool_t  libvlc_input_has_vout       ( libvlc_input_t *, libvlc_exception_t *);
277 float       libvlc_input_get_fps        ( libvlc_input_t *, libvlc_exception_t *);
278         
279 /** @} */
280
281 /** defgroup libvlc_video Video
282  * \ingroup libvlc
283  * LibVLC Video handling
284  * @{
285  */
286
287 /**
288  * Toggle fullscreen status on video output
289  * \param p_input the input
290  * \param p_exception an initialized exception
291  */
292 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
293
294 /**
295  * Enable or disable fullscreen on a video output
296  * \param p_input the input
297  * \param b_fullscreen boolean for fullscreen status
298  * \param p_exception an initialized exception
299  */
300 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
301
302 /**
303  * Get current fullscreen status
304  * \param p_input the input
305  * \param p_exception an initialized exception
306  * \return the fullscreen status (boolean)
307  */
308 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
309     
310 /**
311  * Get current video height
312  * \param p_input the input
313  * \param p_exception an initialized exception
314  * \return the video height
315  */
316 int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
317
318 /**
319  * Get current video width
320  * \param p_input the input
321  * \param p_exception an initialized exception
322  * \return the video width
323  */
324 int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
325
326 /**
327  * Take a snapshot of the current video window
328  * \param p_input the input
329  * \param psz_filepath the path where to save the screenshot to
330  * \param p_exception an initialized exception
331  */
332 void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
333     
334 int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
335
336 #ifndef WIN32
337 int libvlc_video_reparent( libvlc_input_t *, Drawable, libvlc_exception_t * );
338 #endif    
339
340
341 /** @} */
342
343 /**
344  * defgroup libvlc_vlm VLM
345  * \ingroup libvlc
346  * LibVLC VLM handling
347  * @{
348  */
349
350 /** defgroup libvlc_audio Audio
351  * \ingroup libvlc
352  * LibVLC Audio handling
353  * @{
354  */
355
356 /**
357  * Get current mute status
358  * \param p_instance libvlc instance
359  * \param p_exception an initialized exception
360  * \return the mute status (boolean)
361  */
362 vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
363
364 /**
365  * Set mute status
366  * \param p_instance libvlc instance
367  * \param status If status is VLC_TRUE then mute, otherwise unmute
368  * \param p_exception an initialized exception
369  * \return void
370  */
371 void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
372
373
374 /**
375  * Get current audio level
376  * \param p_instance libvlc instance
377  * \param p_exception an initialized exception
378  * \return the audio level (int)
379  */
380 int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
381
382
383 /**
384  * Set current audio level
385  * \param p_instance libvlc instance
386  * \param i_volume the volume (int)
387  * \param p_exception an initialized exception
388  * \return void
389  */
390 void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
391
392 /** @} */
393
394
395 /**
396  * Add a broadcast, with one input
397  * \param p_instance the instance
398  * \param psz_name the name of the new broadcast
399  * \param psz_input the input MRL
400  * \param psz_output the output MRL (the parameter to the "sout" variable)
401  * \param i_options number of additional options
402  * \param ppsz_options additional options
403  * \param b_enabled boolean for enabling the new broadcast
404  * \param b_loop Should this broadcast be played in loop ?
405  * \param p_exception an initialized exception
406  */
407 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
408                                int, char **, int, int, libvlc_exception_t * );
409
410 /**
411  * Delete a media (vod or broadcast)
412  * \param p_instance the instance
413  * \param psz_name the media to delete
414  * \param p_exception an initialized exception
415  */
416 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
417
418 /**
419  * Enable or disable a media (vod or broadcast)
420  * \param p_instance the instance
421  * \param psz_name the media to work on
422  * \param b_enabled the new status
423  * \param p_exception an initialized exception
424  */
425 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
426                              libvlc_exception_t *);
427
428 /**
429  * Set the output for a media
430  * \param p_instance the instance
431  * \param psz_name the media to work on
432  * \param psz_output the output MRL (the parameter to the "sout" variable)
433  * \param p_exception an initialized exception
434  */
435 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
436                             libvlc_exception_t *);
437
438 /**
439  * Set a media's input MRL. This will delete all existing inputs and
440  * add the specified one.
441  * \param p_instance the instance
442  * \param psz_name the media to work on
443  * \param psz_input the input MRL
444  * \param p_exception an initialized exception
445  */
446 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
447                            libvlc_exception_t *);
448
449
450
451 /**
452  * Set output for a media
453  * \param p_instance the instance
454  * \param psz_name the media to work on
455  * \param b_loop the new status
456  * \param p_exception an initialized exception
457  */
458 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
459                           libvlc_exception_t *);
460
461
462
463
464 /**
465  * Edit the parameters of a media. This will delete all existing inputs and
466  * add the specified one.
467  * \param p_instance the instance
468  * \param psz_name the name of the new broadcast
469  * \param psz_input the input MRL
470  * \param psz_output the output MRL (the parameter to the "sout" variable)
471  * \param i_options number of additional options
472  * \param ppsz_options additional options
473  * \param b_enabled boolean for enabling the new broadcast
474  * \param b_loop Should this broadcast be played in loop ?
475  * \param p_exception an initialized exception
476  */
477 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
478                               int, char **, int, int, libvlc_exception_t * );
479
480 /**
481  * Plays the named broadcast.
482  * \param p_instance the instance
483  * \param psz_name the name of the broadcast
484  * \param p_exception an initialized exception
485  */ 
486 void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
487
488 /**
489  * Stops the named broadcast.
490  * \param p_instance the instance
491  * \param psz_name the name of the broadcast
492  * \param p_exception an initialized exception
493  */ 
494 void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
495
496     
497 /**
498  * Pauses the named broadcast.
499  * \param p_instance the instance
500  * \param psz_name the name of the broadcast
501  * \param p_exception an initialized exception
502  */ 
503 void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
504     
505     
506
507 /** @} */
508 /** @} */
509
510 # ifdef __cplusplus
511 }
512 # endif
513
514 #endif /* <vlc/libvlc.h> */