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. Use of this
118 * function is discouraged, you should convert your program to use the
120 * \param p_instance the instance
122 int libvlc_get_vlc_id( libvlc_instance_t *p_instance );
125 * Destroy a libvlc instance
126 * \param p_instance the instance to destroy
128 void libvlc_destroy( libvlc_instance_t *);
132 /*****************************************************************************
134 *****************************************************************************/
135 /** defgroup libvlc_playlist Playlist
137 * LibVLC Playlist handling
142 * Start playing. You can give some additionnal playlist item options
143 * that will be added to the item before playing it.
144 * \param p_instance the instance
145 * \param i_id the item to play. If this is a negative number, the next
146 * item will be selected. Else, the item with the given ID will be played
147 * \param i_options the number of options to add to the item
148 * \param ppsz_options the options to add to the item
149 * \param p_exception an initialized exception
151 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
152 libvlc_exception_t * );
155 * Pause a running playlist, resume if it was stopped
156 * \param p_instance the instance to pause
157 * \param p_exception an initialized exception
159 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
162 * Checks if the playlist is running
163 * \param p_instance the instance
164 * \param p_exception an initialized exception
165 * \return 0 if the playlist is stopped or paused, 1 if it is running
167 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
170 * Get the number of items in the playlist
171 * \param p_instance the instance
172 * \param p_exception an initialized exception
173 * \return the number of items
175 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
179 * \param p_instance the instance to stop
180 * \param p_exception an initialized exception
182 void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
185 * Go to next playlist item (starts playback if it was stopped)
186 * \param p_instance the instance to use
187 * \param p_exception an initialized exception
189 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
192 * Go to previous playlist item (starts playback if it was stopped)
193 * \param p_instance the instance to use
194 * \param p_exception an initialized exception
196 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
199 * Remove all playlist items
200 * \param p_instance the instance
201 * \param p_exception an initialized exception
203 void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
206 * Add an item at the end of the playlist
207 * If you need more advanced options, \see libvlc_playlist_add_extended
208 * \param p_instance the instance
209 * \param psz_uri the URI to open, using VLC format
210 * \param psz_name a name that you might want to give or NULL
211 * \return the identifier of the new item
213 int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
214 libvlc_exception_t * );
217 * Add an item at the end of the playlist, with additional input options
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 * \param i_options the number of options to add
222 * \param ppsz_options strings representing the options to add
223 * \param p_exception an initialized exception
224 * \return the identifier of the new item
226 int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
227 const char *, int, const char **,
228 libvlc_exception_t * );
231 * Delete the playlist item with the given ID.
232 * \param p_instance the instance
233 * \param i_id the id to remove
234 * \param p_exception an initialized exception
237 int libvlc_playlist_delete_item( libvlc_instance_t *, int,
238 libvlc_exception_t * );
240 typedef struct libvlc_input_t libvlc_input_t;
242 /* Get the input that is currently being played by the playlist
243 * \param p_instance the instance to use
244 * \param p_exception an initialized excecption
245 * \return an input object
247 libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
248 libvlc_exception_t * );
252 /*****************************************************************************
254 *****************************************************************************/
255 /** defgroup libvlc_input Input
257 * LibVLC Input handling
261 /** Free an input object
262 * \param p_input the input to free
264 void libvlc_input_free( libvlc_input_t * );
266 /// \bug This might go away ... to be replaced by a broader system
267 vlc_int64_t libvlc_input_get_length ( libvlc_input_t *, libvlc_exception_t *);
268 vlc_int64_t libvlc_input_get_time ( libvlc_input_t *, libvlc_exception_t *);
269 void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *);
270 float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *);
271 void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *);
272 vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *);
276 /** defgroup libvlc_video Video
278 * LibVLC Video handling
283 * Does this input have a video output ?
284 * \param p_input the input
285 * \param p_exception an initialized exception
287 vlc_bool_t libvlc_input_has_vout ( libvlc_input_t *, libvlc_exception_t *);
288 float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *);
291 * Toggle fullscreen status on video output
292 * \param p_input the input
293 * \param p_exception an initialized exception
295 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
298 * Enable or disable fullscreen on a video output
299 * \param p_input the input
300 * \param b_fullscreen boolean for fullscreen status
301 * \param p_exception an initialized exception
303 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
306 * Get current fullscreen status
307 * \param p_input the input
308 * \param p_exception an initialized exception
309 * \return the fullscreen status (boolean)
311 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
314 * Get current video height
315 * \param p_input the input
316 * \param p_exception an initialized exception
317 * \return the video height
319 int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
322 * Get current video width
323 * \param p_input the input
324 * \param p_exception an initialized exception
325 * \return the video width
327 int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
330 * Take a snapshot of the current video window
331 * \param p_input the input
332 * \param psz_filepath the path where to save the screenshot to
333 * \param p_exception an initialized exception
335 void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
337 int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
341 * Resize the video output window
342 * \param p_instance libvlc instance
343 * \param width new width for video output window
344 * \param height new height for video output window
345 * \param p_exception an initialized exception
346 * \return the mute status (boolean)
348 void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
351 * Downcast to this general type as placeholder for a platform specific one, such as:
353 * CGrafPort on MacOSX,
356 typedef int libvlc_drawable_t;
359 * Get current mute status
360 * \param p_instance libvlc instance
361 * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
362 * \param p_exception an initialized exception
363 * \return the mute status (boolean)
365 int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
371 * defgroup libvlc_vlm VLM
373 * LibVLC VLM handling
377 /** defgroup libvlc_audio Audio
379 * LibVLC Audio handling
384 * Get current mute status
385 * \param p_instance libvlc instance
386 * \param p_exception an initialized exception
387 * \return the mute status (boolean)
389 vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
393 * \param p_instance libvlc instance
394 * \param status If status is VLC_TRUE then mute, otherwise unmute
395 * \param p_exception an initialized exception
398 void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
402 * Get current audio level
403 * \param p_instance libvlc instance
404 * \param p_exception an initialized exception
405 * \return the audio level (int)
407 int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
411 * Set current audio level
412 * \param p_instance libvlc instance
413 * \param i_volume the volume (int)
414 * \param p_exception an initialized exception
417 void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
423 * Add a broadcast, with one input
424 * \param p_instance the instance
425 * \param psz_name the name of the new broadcast
426 * \param psz_input the input MRL
427 * \param psz_output the output MRL (the parameter to the "sout" variable)
428 * \param i_options number of additional options
429 * \param ppsz_options additional options
430 * \param b_enabled boolean for enabling the new broadcast
431 * \param b_loop Should this broadcast be played in loop ?
432 * \param p_exception an initialized exception
434 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
435 int, char **, int, int, libvlc_exception_t * );
438 * Delete a media (vod or broadcast)
439 * \param p_instance the instance
440 * \param psz_name the media to delete
441 * \param p_exception an initialized exception
443 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
446 * Enable or disable a media (vod or broadcast)
447 * \param p_instance the instance
448 * \param psz_name the media to work on
449 * \param b_enabled the new status
450 * \param p_exception an initialized exception
452 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
453 libvlc_exception_t *);
456 * Set the output for a media
457 * \param p_instance the instance
458 * \param psz_name the media to work on
459 * \param psz_output the output MRL (the parameter to the "sout" variable)
460 * \param p_exception an initialized exception
462 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
463 libvlc_exception_t *);
466 * Set a media's input MRL. This will delete all existing inputs and
467 * add the specified one.
468 * \param p_instance the instance
469 * \param psz_name the media to work on
470 * \param psz_input the input MRL
471 * \param p_exception an initialized exception
473 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
474 libvlc_exception_t *);
477 * Set output for a media
478 * \param p_instance the instance
479 * \param psz_name the media to work on
480 * \param b_loop the new status
481 * \param p_exception an initialized exception
483 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
484 libvlc_exception_t *);
490 * Edit the parameters of a media. This will delete all existing inputs and
491 * add the specified one.
492 * \param p_instance the instance
493 * \param psz_name the name of the new broadcast
494 * \param psz_input the input MRL
495 * \param psz_output the output MRL (the parameter to the "sout" variable)
496 * \param i_options number of additional options
497 * \param ppsz_options additional options
498 * \param b_enabled boolean for enabling the new broadcast
499 * \param b_loop Should this broadcast be played in loop ?
500 * \param p_exception an initialized exception
502 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
503 int, char **, int, int, libvlc_exception_t * );
506 * Plays the named broadcast.
507 * \param p_instance the instance
508 * \param psz_name the name of the broadcast
509 * \param p_exception an initialized exception
511 void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
514 * Stops the named broadcast.
515 * \param p_instance the instance
516 * \param psz_name the name of the broadcast
517 * \param p_exception an initialized exception
519 void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
523 * Pauses the named broadcast.
524 * \param p_instance the instance
525 * \param psz_name the name of the broadcast
526 * \param p_exception an initialized exception
528 void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
539 #endif /* <vlc/libvlc.h> */