]> git.sesse.net Git - vlc/blob - include/vlc/libvlc.h
Video resize function added in libvlc.
[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  * Core handling
97  *****************************************************************************/
98
99 /** defgroup libvlc_core Core
100  * \ingroup libvlc
101  * LibVLC Core
102  * @{
103  */
104
105 /** This structure is opaque. It represents a libvlc instance */
106 typedef struct libvlc_instance_t libvlc_instance_t;
107
108 /**
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
113  */
114 libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
115
116 /**
117  * returns a libvlc instance identifier for legacy APIs
118  * \param p_instance the instance to destroy
119  */
120 int libvlc_get_vlc_id( libvlc_instance_t *p_instance );
121
122 /**
123  * Destroy a libvlc instance
124  * \param p_instance the instance to destroy
125  */
126 void libvlc_destroy( libvlc_instance_t *);
127
128 /** @}*/
129
130 /*****************************************************************************
131  * Playlist
132  *****************************************************************************/
133 /** defgroup libvlc_playlist Playlist
134  * \ingroup libvlc
135  * LibVLC Playlist handling
136  * @{
137  */
138
139 /**
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
148  */
149 void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
150                            libvlc_exception_t * );
151
152 /**
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
156  */
157 void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
158
159 /**
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
164  */
165 int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
166
167 /**
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
172  */
173 int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
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 int libvlc_playlist_delete_item( libvlc_instance_t *, int,
243                                  libvlc_exception_t * );
244     
245 typedef struct libvlc_input_t libvlc_input_t;
246
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
251  */
252 libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
253                                            libvlc_exception_t * );
254
255
256
257 /** @}*/
258
259 /*****************************************************************************
260  * Input
261  *****************************************************************************/
262 /** defgroup libvlc_input Input
263  * \ingroup libvlc
264  * LibVLC Input handling
265  * @{
266  */
267
268 /** Free an input object
269  * \param p_input the input to free
270  */
271 void libvlc_input_free( libvlc_input_t * );
272
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 float       libvlc_input_get_position   ( libvlc_input_t *, libvlc_exception_t *);
277 vlc_bool_t  libvlc_input_will_play      ( libvlc_input_t *, libvlc_exception_t *);
278 vlc_bool_t  libvlc_input_has_vout       ( libvlc_input_t *, libvlc_exception_t *);
279 float       libvlc_input_get_fps        ( libvlc_input_t *, libvlc_exception_t *);
280         
281 /** @} */
282
283 /** defgroup libvlc_video Video
284  * \ingroup libvlc
285  * LibVLC Video handling
286  * @{
287  */
288
289 /**
290  * Toggle fullscreen status on video output
291  * \param p_input the input
292  * \param p_exception an initialized exception
293  */
294 void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
295
296 /**
297  * Enable or disable fullscreen on a video output
298  * \param p_input the input
299  * \param b_fullscreen boolean for fullscreen status
300  * \param p_exception an initialized exception
301  */
302 void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
303
304 /**
305  * Get current fullscreen status
306  * \param p_input the input
307  * \param p_exception an initialized exception
308  * \return the fullscreen status (boolean)
309  */
310 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
311     
312 /**
313  * Get current video height
314  * \param p_input the input
315  * \param p_exception an initialized exception
316  * \return the video height
317  */
318 int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
319
320 /**
321  * Get current video width
322  * \param p_input the input
323  * \param p_exception an initialized exception
324  * \return the video width
325  */
326 int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
327
328 /**
329  * Take a snapshot of the current video window
330  * \param p_input the input
331  * \param psz_filepath the path where to save the screenshot to
332  * \param p_exception an initialized exception
333  */
334 void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
335     
336 int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
337
338     
339 /**
340  * Resize the video output window
341  * \param p_instance libvlc instance
342  * \param width new width for video output window
343  * \param height new height for video output window
344  * \param p_exception an initialized exception
345  * \return the mute status (boolean)
346  */
347 void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
348     
349 /**
350 * Downcast to this general type as placeholder for a platform specific one, such as:
351 *  Drawable on X11,
352 *  CGrafPort on MacOSX,
353 *  HWND on win32
354 */
355 typedef int libvlc_drawable_t;
356
357 /**
358  * Get current mute status
359  * \param p_instance libvlc instance
360  * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
361  * \param p_exception an initialized exception
362  * \return the mute status (boolean)
363  */
364 int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
365
366
367 /** @} */
368
369 /**
370  * defgroup libvlc_vlm VLM
371  * \ingroup libvlc
372  * LibVLC VLM handling
373  * @{
374  */
375
376 /** defgroup libvlc_audio Audio
377  * \ingroup libvlc
378  * LibVLC Audio handling
379  * @{
380  */
381
382 /**
383  * Get current mute status
384  * \param p_instance libvlc instance
385  * \param p_exception an initialized exception
386  * \return the mute status (boolean)
387  */
388 vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
389
390 /**
391  * Set mute status
392  * \param p_instance libvlc instance
393  * \param status If status is VLC_TRUE then mute, otherwise unmute
394  * \param p_exception an initialized exception
395  * \return void
396  */
397 void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
398
399
400 /**
401  * Get current audio level
402  * \param p_instance libvlc instance
403  * \param p_exception an initialized exception
404  * \return the audio level (int)
405  */
406 int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
407
408
409 /**
410  * Set current audio level
411  * \param p_instance libvlc instance
412  * \param i_volume the volume (int)
413  * \param p_exception an initialized exception
414  * \return void
415  */
416 void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
417
418 /** @} */
419
420
421 /**
422  * Add a broadcast, with one input
423  * \param p_instance the instance
424  * \param psz_name the name of the new broadcast
425  * \param psz_input the input MRL
426  * \param psz_output the output MRL (the parameter to the "sout" variable)
427  * \param i_options number of additional options
428  * \param ppsz_options additional options
429  * \param b_enabled boolean for enabling the new broadcast
430  * \param b_loop Should this broadcast be played in loop ?
431  * \param p_exception an initialized exception
432  */
433 void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
434                                int, char **, int, int, libvlc_exception_t * );
435
436 /**
437  * Delete a media (vod or broadcast)
438  * \param p_instance the instance
439  * \param psz_name the media to delete
440  * \param p_exception an initialized exception
441  */
442 void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
443
444 /**
445  * Enable or disable a media (vod or broadcast)
446  * \param p_instance the instance
447  * \param psz_name the media to work on
448  * \param b_enabled the new status
449  * \param p_exception an initialized exception
450  */
451 void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
452                              libvlc_exception_t *);
453
454 /**
455  * Set the output for a media
456  * \param p_instance the instance
457  * \param psz_name the media to work on
458  * \param psz_output the output MRL (the parameter to the "sout" variable)
459  * \param p_exception an initialized exception
460  */
461 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
462                             libvlc_exception_t *);
463
464 /**
465  * Set a media's input MRL. This will delete all existing inputs and
466  * add the specified one.
467  * \param p_instance the instance
468  * \param psz_name the media to work on
469  * \param psz_input the input MRL
470  * \param p_exception an initialized exception
471  */
472 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
473                            libvlc_exception_t *);
474
475
476
477 /**
478  * Set output for a media
479  * \param p_instance the instance
480  * \param psz_name the media to work on
481  * \param b_loop the new status
482  * \param p_exception an initialized exception
483  */
484 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
485                           libvlc_exception_t *);
486
487
488
489
490 /**
491  * Edit the parameters of a media. This will delete all existing inputs and
492  * add the specified one.
493  * \param p_instance the instance
494  * \param psz_name the name of the new broadcast
495  * \param psz_input the input MRL
496  * \param psz_output the output MRL (the parameter to the "sout" variable)
497  * \param i_options number of additional options
498  * \param ppsz_options additional options
499  * \param b_enabled boolean for enabling the new broadcast
500  * \param b_loop Should this broadcast be played in loop ?
501  * \param p_exception an initialized exception
502  */
503 void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
504                               int, char **, int, int, libvlc_exception_t * );
505
506 /**
507  * Plays the named broadcast.
508  * \param p_instance the instance
509  * \param psz_name the name of the broadcast
510  * \param p_exception an initialized exception
511  */ 
512 void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
513
514 /**
515  * Stops the named broadcast.
516  * \param p_instance the instance
517  * \param psz_name the name of the broadcast
518  * \param p_exception an initialized exception
519  */ 
520 void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
521
522     
523 /**
524  * Pauses the named broadcast.
525  * \param p_instance the instance
526  * \param psz_name the name of the broadcast
527  * \param p_exception an initialized exception
528  */ 
529 void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
530     
531     
532
533 /** @} */
534 /** @} */
535
536 # ifdef __cplusplus
537 }
538 # endif
539
540 #endif /* <vlc/libvlc.h> */