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 *, libvlc_exception_t * );
132 /*****************************************************************************
134 *****************************************************************************/
135 /** defgroup libvlc_playlist Playlist
137 * LibVLC Playlist handling
143 void libvlc_playlist_loop( libvlc_instance_t* , vlc_bool_t, libvlc_exception_t * );
145 * Start playing. You can give some additionnal playlist item options
146 * that will be added to the item before playing it.
147 * \param p_instance the instance
148 * \param i_id the item to play. If this is a negative number, the next
149 * item will be selected. Else, the item with the given ID will be played
150 * \param i_options the number of options to add to the item
151 * \param ppsz_options the options to add to the item
152 * \param p_exception an initialized exception
154 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
155 libvlc_exception_t * );
158 * Pause a running playlist, resume if it was stopped
159 * \param p_instance the instance to pause
160 * \param p_exception an initialized exception
162 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
165 * Checks if the playlist is running
166 * \param p_instance the instance
167 * \param p_exception an initialized exception
168 * \return 0 if the playlist is stopped or paused, 1 if it is running
170 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
173 * Get the number of items in the playlist
174 * \param p_instance the instance
175 * \param p_exception an initialized exception
176 * \return the number of items
178 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
182 * \param p_instance the instance to stop
183 * \param p_exception an initialized exception
185 void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
188 * Go to next playlist item (starts playback if it was stopped)
189 * \param p_instance the instance to use
190 * \param p_exception an initialized exception
192 void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
195 * Go to previous playlist item (starts playback if it was stopped)
196 * \param p_instance the instance to use
197 * \param p_exception an initialized exception
199 void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
202 * Remove all playlist items
203 * \param p_instance the instance
204 * \param p_exception an initialized exception
206 void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
209 * Add an item at the end of the playlist
210 * If you need more advanced options, \see libvlc_playlist_add_extended
211 * \param p_instance the instance
212 * \param psz_uri the URI to open, using VLC format
213 * \param psz_name a name that you might want to give or NULL
214 * \return the identifier of the new item
216 int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
217 libvlc_exception_t * );
220 * Add an item at the end of the playlist, with additional input options
221 * \param p_instance the instance
222 * \param psz_uri the URI to open, using VLC format
223 * \param psz_name a name that you might want to give or NULL
224 * \param i_options the number of options to add
225 * \param ppsz_options strings representing the options to add
226 * \param p_exception an initialized exception
227 * \return the identifier of the new item
229 int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
230 const char *, int, const char **,
231 libvlc_exception_t * );
234 * Delete the playlist item with the given ID.
235 * \param p_instance the instance
236 * \param i_id the id to remove
237 * \param p_exception an initialized exception
240 int libvlc_playlist_delete_item( libvlc_instance_t *, int,
241 libvlc_exception_t * );
243 typedef struct libvlc_input_t libvlc_input_t;
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
250 libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
251 libvlc_exception_t * );
255 /*****************************************************************************
257 *****************************************************************************/
258 /** defgroup libvlc_input Input
260 * LibVLC Input handling
264 /** Free an input object
265 * \param p_input the input to free
267 void libvlc_input_free( libvlc_input_t * );
269 /// \bug This might go away ... to be replaced by a broader system
270 vlc_int64_t libvlc_input_get_length ( libvlc_input_t *, libvlc_exception_t *);
271 vlc_int64_t libvlc_input_get_time ( libvlc_input_t *, libvlc_exception_t *);
272 void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *);
273 float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *);
274 void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *);
275 vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *);
276 float libvlc_input_get_rate ( libvlc_input_t *, libvlc_exception_t *);
277 void libvlc_input_set_rate ( libvlc_input_t *, float, libvlc_exception_t *);
278 int libvlc_input_get_state ( libvlc_input_t *, libvlc_exception_t *);
282 /** defgroup libvlc_video Video
284 * LibVLC Video handling
289 * Does this input have a video output ?
290 * \param p_input the input
291 * \param p_exception an initialized exception
293 vlc_bool_t libvlc_input_has_vout ( libvlc_input_t *, libvlc_exception_t *);
294 float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *);
297 * Toggle fullscreen status on video output
298 * \param p_input the input
299 * \param p_exception an initialized exception
301 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
304 * Enable or disable fullscreen on a video output
305 * \param p_input the input
306 * \param b_fullscreen boolean for fullscreen status
307 * \param p_exception an initialized exception
309 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
312 * Get current fullscreen status
313 * \param p_input the input
314 * \param p_exception an initialized exception
315 * \return the fullscreen status (boolean)
317 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
320 * Get current video height
321 * \param p_input the input
322 * \param p_exception an initialized exception
323 * \return the video height
325 int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
328 * Get current video width
329 * \param p_input the input
330 * \param p_exception an initialized exception
331 * \return the video width
333 int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
336 * Take a snapshot of the current video window
337 * \param p_input the input
338 * \param psz_filepath the path where to save the screenshot to
339 * \param p_exception an initialized exception
341 void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
343 int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
347 * Resize the video output window
348 * \param p_instance libvlc instance
349 * \param width new width for video output window
350 * \param height new height for video output window
351 * \param p_exception an initialized exception
352 * \return the mute status (boolean)
354 void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
357 * Downcast to this general type as placeholder for a platform specific one, such as:
359 * CGrafPort on MacOSX,
362 typedef int libvlc_drawable_t;
365 * change the video output parent
366 * \param p_instance libvlc instance
367 * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
368 * \param p_exception an initialized exception
369 * \return the mute status (boolean)
371 int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
374 * Set the video output parent
375 * \param p_instance libvlc instance
376 * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
377 * \param p_exception an initialized exception
379 void libvlc_video_set_parent( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );
382 * Set the video output size
383 * \param p_instance libvlc instance
384 * \param width new width for video drawable
385 * \param height new height for video drawable
386 * \param p_exception an initialized exception
388 void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc_exception_t * );
391 * Downcast to this general type as placeholder for a platform specific one, such as:
393 * CGrafPort on MacOSX,
404 * Set the video output viewport for a windowless video output (MacOS X only)
405 * \param p_instance libvlc instance
406 * \param view coordinates within video drawable
407 * \param clip coordinates within video drawable
408 * \param p_exception an initialized exception
410 void libvlc_video_set_viewport( libvlc_instance_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
416 * defgroup libvlc_vlm VLM
418 * LibVLC VLM handling
422 /** defgroup libvlc_audio Audio
424 * LibVLC Audio handling
430 * \param p_instance libvlc instance
431 * \param p_exception an initialized exception
434 void libvlc_audio_toggle_mute( libvlc_instance_t *, libvlc_exception_t * );
437 * Get current mute status
438 * \param p_instance libvlc instance
439 * \param p_exception an initialized exception
440 * \return the mute status (boolean)
442 vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
446 * \param p_instance libvlc instance
447 * \param status If status is VLC_TRUE then mute, otherwise unmute
448 * \param p_exception an initialized exception
451 void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
455 * Get current audio level
456 * \param p_instance libvlc instance
457 * \param p_exception an initialized exception
458 * \return the audio level (int)
460 int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
464 * Set current audio level
465 * \param p_instance libvlc instance
466 * \param i_volume the volume (int)
467 * \param p_exception an initialized exception
470 void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
476 * Add a broadcast, with one input
477 * \param p_instance the instance
478 * \param psz_name the name of the new broadcast
479 * \param psz_input the input MRL
480 * \param psz_output the output MRL (the parameter to the "sout" variable)
481 * \param i_options number of additional options
482 * \param ppsz_options additional options
483 * \param b_enabled boolean for enabling the new broadcast
484 * \param b_loop Should this broadcast be played in loop ?
485 * \param p_exception an initialized exception
487 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
488 int, char **, int, int, libvlc_exception_t * );
491 * Delete a media (vod or broadcast)
492 * \param p_instance the instance
493 * \param psz_name the media to delete
494 * \param p_exception an initialized exception
496 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
499 * Enable or disable a media (vod or broadcast)
500 * \param p_instance the instance
501 * \param psz_name the media to work on
502 * \param b_enabled the new status
503 * \param p_exception an initialized exception
505 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
506 libvlc_exception_t *);
509 * Set the output for a media
510 * \param p_instance the instance
511 * \param psz_name the media to work on
512 * \param psz_output the output MRL (the parameter to the "sout" variable)
513 * \param p_exception an initialized exception
515 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
516 libvlc_exception_t *);
519 * Set a media's input MRL. This will delete all existing inputs and
520 * add the specified one.
521 * \param p_instance the instance
522 * \param psz_name the media to work on
523 * \param psz_input the input MRL
524 * \param p_exception an initialized exception
526 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
527 libvlc_exception_t *);
530 * Set output for a media
531 * \param p_instance the instance
532 * \param psz_name the media to work on
533 * \param b_loop the new status
534 * \param p_exception an initialized exception
536 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
537 libvlc_exception_t *);
543 * Edit the parameters of a media. This will delete all existing inputs and
544 * add the specified one.
545 * \param p_instance the instance
546 * \param psz_name the name of the new broadcast
547 * \param psz_input the input MRL
548 * \param psz_output the output MRL (the parameter to the "sout" variable)
549 * \param i_options number of additional options
550 * \param ppsz_options additional options
551 * \param b_enabled boolean for enabling the new broadcast
552 * \param b_loop Should this broadcast be played in loop ?
553 * \param p_exception an initialized exception
555 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
556 int, char **, int, int, libvlc_exception_t * );
559 * Plays the named broadcast.
560 * \param p_instance the instance
561 * \param psz_name the name of the broadcast
562 * \param p_exception an initialized exception
564 void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
567 * Stops the named broadcast.
568 * \param p_instance the instance
569 * \param psz_name the name of the broadcast
570 * \param p_exception an initialized exception
572 void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
576 * Pauses the named broadcast.
577 * \param p_instance the instance
578 * \param psz_name the name of the broadcast
579 * \param p_exception an initialized exception
581 void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
584 * Seeks in the named broadcast.
585 * \param p_instance the instance
586 * \param psz_name the name of the broadcast
587 * \param f_percentage the percentage to seek to
588 * \param p_exception an initialized exception
590 void libvlc_vlm_seek_media( libvlc_instance_t *, char *,
591 float, libvlc_exception_t * );
594 * Return information of the named broadcast.
595 * \param p_instance the instance
596 * \param psz_name the name of the broadcast
597 * \param p_exception an initialized exception
599 char* libvlc_vlm_show_media( libvlc_instance_t *, char *, libvlc_exception_t * );
601 #define LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( attr, returnType, getType, default)\
602 returnType libvlc_vlm_get_media_## attr( libvlc_instance_t *, \
603 char *, int , libvlc_exception_t * );
605 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( position, float, Float, -1);
606 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( time, int, Integer, -1);
607 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( length, int, Integer, -1);
608 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( rate, int, Integer, -1);
609 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( title, int, Integer, 0);
610 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( chapter, int, Integer, 0);
611 LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( seekable, int, Bool, 0);
613 #undef LIBVLC_VLM_GET_MEDIA_ATTRIBUTE
622 #endif /* <vlc/libvlc.h> */