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 $
7 * Authors: Clément Stenac <zorglub@videolan.org>
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.
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.
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 *****************************************************************************/
25 * \defgroup libvlc Libvlc
26 * This is libvlc, the base library of the VLC program.
41 /*****************************************************************************
43 *****************************************************************************/
44 /** defgroup libvlc_exception Exceptions
46 * LibVLC Exceptions handling
50 struct libvlc_exception_t
55 typedef struct libvlc_exception_t libvlc_exception_t;
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
62 void libvlc_exception_init( libvlc_exception_t *p_exception );
65 * Has an exception been raised ?
66 * \param p_exception the exception to query
67 * \return 0 if no exception raised, 1 else
69 int libvlc_exception_raised( libvlc_exception_t *p_exception );
73 * \param p_exception the exception to raise
74 * \param psz_message the exception message
76 void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... );
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
83 void libvlc_exception_clear( libvlc_exception_t * );
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
91 char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
95 /*****************************************************************************
97 *****************************************************************************/
99 /** defgroup libvlc_core Core
105 /** This structure is opaque. It represents a libvlc instance */
106 typedef struct libvlc_instance_t libvlc_instance_t;
109 * Create an initialized libvlc instance
110 * \param argc the number of arguments
111 * \param argv command-line-type arguments
112 * \param exception an initialized exception pointer
114 libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
117 * returns a libvlc instance identifier for legacy APIs
118 * \param p_instance the instance to destroy
120 int libvlc_get_vlc_id( libvlc_instance_t *p_instance );
123 * Destroy a libvlc instance
124 * \param p_instance the instance to destroy
126 void libvlc_destroy( libvlc_instance_t *);
130 /*****************************************************************************
132 *****************************************************************************/
133 /** defgroup libvlc_playlist Playlist
135 * LibVLC Playlist handling
140 * Start playing. You can give some additionnal playlist item options
141 * that will be added to the item before playing it.
142 * \param p_instance the instance
143 * \param i_id the item to play. If this is a negative number, the next
144 * item will be selected. Else, the item with the given ID will be played
145 * \param i_options the number of options to add to the item
146 * \param ppsz_options the options to add to the item
147 * \param p_exception an initialized exception
149 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
150 libvlc_exception_t * );
153 * Pause a running playlist, resume if it was stopped
154 * \param p_instance the instance to pause
155 * \param p_exception an initialized exception
157 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
160 * Checks if the playlist is running
161 * \param p_instance the instance
162 * \param p_exception an initialized exception
163 * \return 0 if the playlist is stopped or paused, 1 if it is running
165 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
168 * Get the number of items in the playlist
169 * \param p_instance the instance
170 * \param p_exception an initialized exception
171 * \return the number of items
173 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
177 * \param p_instance the instance to stop
178 * \param p_exception an initialized exception
180 void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
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
187 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
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
194 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
197 * Remove all playlist items
198 * \param p_instance the instance
199 * \param p_exception an initialized exception
201 void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
204 * Go to next playlist item
205 * \param p_instance the instance
206 * \param p_exception an initialized exception
208 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
211 * Go to Previous playlist item
212 * \param p_instance the instance
213 * \param p_exception an initialized exception
215 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
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
225 int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
226 libvlc_exception_t * );
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
237 int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
238 const char *, int, const char **,
239 libvlc_exception_t * );
242 int libvlc_playlist_delete_item( libvlc_instance_t *, int,
243 libvlc_exception_t * );
245 typedef struct libvlc_input_t libvlc_input_t;
247 /* Get the input that is currently being played by the playlist
248 * \param p_instance the instance to use
249 * \param p_exception an initialized excecption
250 * \return an input object
252 libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
253 libvlc_exception_t * );
259 /*****************************************************************************
261 *****************************************************************************/
262 /** defgroup libvlc_input Input
264 * LibVLC Input handling
268 /** Free an input object
269 * \param p_input the input to free
271 void libvlc_input_free( libvlc_input_t * );
273 /// \bug This might go away ... to be replaced by a broader system
274 vlc_int64_t libvlc_input_get_length ( libvlc_input_t *, libvlc_exception_t *);
275 vlc_int64_t libvlc_input_get_time ( libvlc_input_t *, libvlc_exception_t *);
276 void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *);
277 float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *);
278 void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *);
279 vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *);
280 vlc_bool_t libvlc_input_has_vout ( libvlc_input_t *, libvlc_exception_t *);
281 float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *);
285 /** defgroup libvlc_video Video
287 * LibVLC Video handling
292 * Toggle fullscreen status on video output
293 * \param p_input the input
294 * \param p_exception an initialized exception
296 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
299 * Enable or disable fullscreen on a video output
300 * \param p_input the input
301 * \param b_fullscreen boolean for fullscreen status
302 * \param p_exception an initialized exception
304 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
307 * Get current fullscreen status
308 * \param p_input the input
309 * \param p_exception an initialized exception
310 * \return the fullscreen status (boolean)
312 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
315 * Get current video height
316 * \param p_input the input
317 * \param p_exception an initialized exception
318 * \return the video height
320 int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
323 * Get current video width
324 * \param p_input the input
325 * \param p_exception an initialized exception
326 * \return the video width
328 int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
331 * Take a snapshot of the current video window
332 * \param p_input the input
333 * \param psz_filepath the path where to save the screenshot to
334 * \param p_exception an initialized exception
336 void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
338 int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
342 * Resize the video output window
343 * \param p_instance libvlc instance
344 * \param width new width for video output window
345 * \param height new height for video output window
346 * \param p_exception an initialized exception
347 * \return the mute status (boolean)
349 void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
352 * Downcast to this general type as placeholder for a platform specific one, such as:
354 * CGrafPort on MacOSX,
357 typedef int libvlc_drawable_t;
360 * Get current mute status
361 * \param p_instance libvlc instance
362 * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
363 * \param p_exception an initialized exception
364 * \return the mute status (boolean)
366 int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
372 * defgroup libvlc_vlm VLM
374 * LibVLC VLM handling
378 /** defgroup libvlc_audio Audio
380 * LibVLC Audio handling
385 * Get current mute status
386 * \param p_instance libvlc instance
387 * \param p_exception an initialized exception
388 * \return the mute status (boolean)
390 vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
394 * \param p_instance libvlc instance
395 * \param status If status is VLC_TRUE then mute, otherwise unmute
396 * \param p_exception an initialized exception
399 void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
403 * Get current audio level
404 * \param p_instance libvlc instance
405 * \param p_exception an initialized exception
406 * \return the audio level (int)
408 int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
412 * Set current audio level
413 * \param p_instance libvlc instance
414 * \param i_volume the volume (int)
415 * \param p_exception an initialized exception
418 void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
424 * Add a broadcast, with one input
425 * \param p_instance the instance
426 * \param psz_name the name of the new broadcast
427 * \param psz_input the input MRL
428 * \param psz_output the output MRL (the parameter to the "sout" variable)
429 * \param i_options number of additional options
430 * \param ppsz_options additional options
431 * \param b_enabled boolean for enabling the new broadcast
432 * \param b_loop Should this broadcast be played in loop ?
433 * \param p_exception an initialized exception
435 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
436 int, char **, int, int, libvlc_exception_t * );
439 * Delete a media (vod or broadcast)
440 * \param p_instance the instance
441 * \param psz_name the media to delete
442 * \param p_exception an initialized exception
444 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
447 * Enable or disable a media (vod or broadcast)
448 * \param p_instance the instance
449 * \param psz_name the media to work on
450 * \param b_enabled the new status
451 * \param p_exception an initialized exception
453 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
454 libvlc_exception_t *);
457 * Set the output for a media
458 * \param p_instance the instance
459 * \param psz_name the media to work on
460 * \param psz_output the output MRL (the parameter to the "sout" variable)
461 * \param p_exception an initialized exception
463 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
464 libvlc_exception_t *);
467 * Set a media's input MRL. This will delete all existing inputs and
468 * add the specified one.
469 * \param p_instance the instance
470 * \param psz_name the media to work on
471 * \param psz_input the input MRL
472 * \param p_exception an initialized exception
474 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
475 libvlc_exception_t *);
480 * Set output for a media
481 * \param p_instance the instance
482 * \param psz_name the media to work on
483 * \param b_loop the new status
484 * \param p_exception an initialized exception
486 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
487 libvlc_exception_t *);
493 * Edit the parameters of a media. This will delete all existing inputs and
494 * add the specified one.
495 * \param p_instance the instance
496 * \param psz_name the name of the new broadcast
497 * \param psz_input the input MRL
498 * \param psz_output the output MRL (the parameter to the "sout" variable)
499 * \param i_options number of additional options
500 * \param ppsz_options additional options
501 * \param b_enabled boolean for enabling the new broadcast
502 * \param b_loop Should this broadcast be played in loop ?
503 * \param p_exception an initialized exception
505 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
506 int, char **, int, int, libvlc_exception_t * );
509 * Plays the named broadcast.
510 * \param p_instance the instance
511 * \param psz_name the name of the broadcast
512 * \param p_exception an initialized exception
514 void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
517 * Stops the named broadcast.
518 * \param p_instance the instance
519 * \param psz_name the name of the broadcast
520 * \param p_exception an initialized exception
522 void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
526 * Pauses the named broadcast.
527 * \param p_instance the instance
528 * \param psz_name the name of the broadcast
529 * \param p_exception an initialized exception
531 void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
542 #endif /* <vlc/libvlc.h> */