]> git.sesse.net Git - vlc/blob - include/vlc/libvlc.h
* Start cleaning up libvlc playlist API (Refs:#457)
[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  *          Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /**
26  * \defgroup libvlc Libvlc
27  * This is libvlc, the base library of the VLC program.
28  *
29  * @{
30  */
31
32
33 #ifndef _LIBVLC_H
34 #define _LIBVLC_H 1
35
36 #include <vlc/vlc.h>
37
38 # ifdef __cplusplus
39 extern "C" {
40 # endif
41
42 /*****************************************************************************
43  * Exception handling
44  *****************************************************************************/
45 /** defgroup libvlc_exception Exceptions
46  * \ingroup libvlc
47  * LibVLC Exceptions handling
48  * @{
49  */
50
51 typedef struct
52 {
53     int b_raised;
54     int i_code;
55     char *psz_message;
56 } libvlc_exception_t;
57
58 /**
59  * Initialize an exception structure. This can be called several times to reuse
60  * an exception structure.
61  * \param p_exception the exception to initialize
62  */
63 VLC_PUBLIC_API void libvlc_exception_init( libvlc_exception_t *p_exception );
64
65 /**
66  * Has an exception been raised ?
67  * \param p_exception the exception to query
68  * \return 0 if no exception raised, 1 else
69  */
70 VLC_PUBLIC_API int libvlc_exception_raised( libvlc_exception_t *p_exception );
71
72 /**
73  * Raise an exception
74  * \param p_exception the exception to raise
75  * \param psz_message the exception message
76  */
77 VLC_PUBLIC_API void libvlc_exception_raise( libvlc_exception_t *p_exception, const char *psz_format, ... );
78
79 /**
80  * Clear an exception object so it can be reused.
81  * The exception object must be initialized
82  * \param p_exception the exception to clear
83  */
84 VLC_PUBLIC_API void libvlc_exception_clear( libvlc_exception_t * );
85
86 /**
87  * Get exception message
88  * \param p_exception the exception to query
89  * \return the exception message or NULL if not applicable (exception not raised
90  * for example)
91  */
92 VLC_PUBLIC_API char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
93
94 /**@} */
95
96 /*****************************************************************************
97  * Core handling
98  *****************************************************************************/
99
100 /** defgroup libvlc_core Core
101  * \ingroup libvlc
102  * LibVLC Core
103  * @{
104  */
105
106 /** This structure is opaque. It represents a libvlc instance */
107 typedef struct libvlc_instance_t libvlc_instance_t;
108
109 /**
110  * Create an initialized libvlc instance
111  * \param argc the number of arguments
112  * \param argv command-line-type arguments
113  * \param exception an initialized exception pointer
114  */
115 VLC_PUBLIC_API libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
116
117 /**
118  * Returns a libvlc instance identifier for legacy APIs. Use of this
119  * function is discouraged, you should convert your program to use the
120  * new API.
121  * \param p_instance the instance
122  */
123 VLC_PUBLIC_API int libvlc_get_vlc_id( libvlc_instance_t *p_instance );
124
125 /**
126  * Destroy a libvlc instance.
127  * \param p_instance the instance to destroy
128  */
129 VLC_PUBLIC_API void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * );
130
131 /** @}*/
132
133 /*****************************************************************************
134  * Playlist
135  *****************************************************************************/
136 /** defgroup libvlc_playlist Playlist
137  * \ingroup libvlc
138  * LibVLC Playlist handling
139  * @{
140  */
141
142 typedef struct {
143     int i_id;
144     char * psz_uri;
145     char * psz_name
146
147 } libvlc_playlist_item_t;
148
149 /**
150  * Set loop variable
151  */
152 VLC_PUBLIC_API void libvlc_playlist_loop( libvlc_instance_t* , vlc_bool_t,
153                                           libvlc_exception_t * );
154
155 /**
156  * Start playing. You can give some additionnal playlist item options
157  * that will be added to the item before playing it.
158  * \param p_instance the instance
159  * \param i_id the item to play. If this is a negative number, the next
160  * item will be selected. Else, the item with the given ID will be played
161  * \param i_options the number of options to add to the item
162  * \param ppsz_options the options to add to the item
163  * \param p_exception an initialized exception
164  */
165 VLC_PUBLIC_API void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
166                                           libvlc_exception_t * );
167
168 /**
169  * Pause a running playlist, resume if it was stopped
170  * \param p_instance the instance to pause
171  * \param p_exception an initialized exception
172  */
173 VLC_PUBLIC_API void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
174
175 /**
176  * Checks if the playlist is running
177  * \param p_instance the instance
178  * \param p_exception an initialized exception
179  * \return 0 if the playlist is stopped or paused, 1 if it is running
180  */
181 VLC_PUBLIC_API int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
182
183 /**
184  * Get the number of items in the playlist
185  * \param p_instance the instance
186  * \param p_exception an initialized exception
187  * \return the number of items
188  */
189 VLC_PUBLIC_API int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
190
191 /**
192  * Stop playing
193  * \param p_instance the instance to stop
194  * \param p_exception an initialized exception
195  */
196 VLC_PUBLIC_API void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
197
198 /**
199  * Go to next playlist item (starts playback if it was stopped)
200  * \param p_instance the instance to use
201  * \param p_exception an initialized exception
202  */
203 VLC_PUBLIC_API void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
204
205 /**
206  * Go to previous playlist item (starts playback if it was stopped)
207  * \param p_instance the instance to use
208  * \param p_exception an initialized exception
209  */
210 VLC_PUBLIC_API void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
211
212 /**
213  * Remove all playlist items
214  * \param p_instance the instance
215  * \param p_exception an initialized exception
216  */
217 VLC_PUBLIC_API void libvlc_playlist_clear( libvlc_instance_t *, libvlc_exception_t * );
218
219 /**
220  * Add an item at the end of the playlist
221  * If you need more advanced options, \see libvlc_playlist_add_extended
222  * \param p_instance the instance
223  * \param psz_uri the URI to open, using VLC format
224  * \param psz_name a name that you might want to give or NULL
225  * \return the identifier of the new item
226  */
227 VLC_PUBLIC_API int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
228                                         libvlc_exception_t * );
229
230 /**
231  * Add an item at the end of the playlist, with additional input options
232  * \param p_instance the instance
233  * \param psz_uri the URI to open, using VLC format
234  * \param psz_name a name that you might want to give or NULL
235  * \param i_options the number of options to add
236  * \param ppsz_options strings representing the options to add
237  * \param p_exception an initialized exception
238  * \return the identifier of the new item
239  */
240 VLC_PUBLIC_API int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
241                                                  const char *, int, const char **,
242                                                  libvlc_exception_t * );
243
244 /**
245  * Delete the playlist item with the given ID.
246  * \param p_instance the instance
247  * \param i_id the id to remove
248  * \param p_exception an initialized exception
249  * \return
250  */
251 VLC_PUBLIC_API int libvlc_playlist_delete_item( libvlc_instance_t *, int,
252                                                 libvlc_exception_t * );
253
254 typedef struct libvlc_input_t libvlc_input_t;
255
256 /* Get the input that is currently being played by the playlist
257  * \param p_instance the instance to use
258  * \param p_exception an initialized excecption
259  * \return an input object
260  */
261 VLC_PUBLIC_API libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
262                                                           libvlc_exception_t * );
263
264 /** @}*/
265
266 /*****************************************************************************
267  * Input
268  *****************************************************************************/
269 /** defgroup libvlc_input Input
270  * \ingroup libvlc
271  * LibVLC Input handling
272  * @{
273  */
274
275 /** Free an input object
276  * \param p_input the input to free
277  */
278 VLC_PUBLIC_API void libvlc_input_free( libvlc_input_t * );
279
280 /// \bug This might go away ... to be replaced by a broader system
281 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_length     ( libvlc_input_t *, libvlc_exception_t *);
282 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_time       ( libvlc_input_t *, libvlc_exception_t *);
283 VLC_PUBLIC_API void        libvlc_input_set_time       ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *);
284 VLC_PUBLIC_API float       libvlc_input_get_position   ( libvlc_input_t *, libvlc_exception_t *);
285 VLC_PUBLIC_API void        libvlc_input_set_position   ( libvlc_input_t *, float, libvlc_exception_t *);
286 VLC_PUBLIC_API vlc_bool_t  libvlc_input_will_play      ( libvlc_input_t *, libvlc_exception_t *);
287 VLC_PUBLIC_API float       libvlc_input_get_rate       ( libvlc_input_t *, libvlc_exception_t *);
288 VLC_PUBLIC_API void        libvlc_input_set_rate       ( libvlc_input_t *, float, libvlc_exception_t *);
289 VLC_PUBLIC_API int         libvlc_input_get_state      ( libvlc_input_t *, libvlc_exception_t *);
290
291 /** @} */
292
293 /** defgroup libvlc_video Video
294  * \ingroup libvlc
295  * LibVLC Video handling
296  * @{
297  */
298
299 /**
300 * Downcast to this general type as placeholder for a platform specific one, such as:
301 *  Drawable on X11,
302 *  CGrafPort on MacOSX,
303 *  HWND on win32
304 */
305 typedef int libvlc_drawable_t;
306
307 /**
308 * Rectangle type for video geometry
309 */
310 typedef struct
311 {
312     int top, left;
313     int bottom, right;
314 }
315 libvlc_rectangle_t;
316
317 /**
318  * Does this input have a video output ?
319  * \param p_input the input
320  * \param p_exception an initialized exception
321  */
322 VLC_PUBLIC_API vlc_bool_t  libvlc_input_has_vout( libvlc_input_t *, libvlc_exception_t *);
323 VLC_PUBLIC_API float       libvlc_input_get_fps( libvlc_input_t *, libvlc_exception_t *);
324
325 /**
326  * Toggle fullscreen status on video output
327  * \param p_input the input
328  * \param p_exception an initialized exception
329  */
330 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
331
332 /**
333  * Enable or disable fullscreen on a video output
334  * \param p_input the input
335  * \param b_fullscreen boolean for fullscreen status
336  * \param p_exception an initialized exception
337  */
338 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
339
340 /**
341  * Get current fullscreen status
342  * \param p_input the input
343  * \param p_exception an initialized exception
344  * \return the fullscreen status (boolean)
345  */
346 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
347
348 /**
349  * Get current video height
350  * \param p_input the input
351  * \param p_exception an initialized exception
352  * \return the video height
353  */
354 VLC_PUBLIC_API int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * );
355
356 /**
357  * Get current video width
358  * \param p_input the input
359  * \param p_exception an initialized exception
360  * \return the video width
361  */
362 VLC_PUBLIC_API int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * );
363
364 /**
365  * Get current video aspect ratio
366  * \param p_input the input
367  * \param p_exception an initialized exception
368  * \return the video aspect ratio
369  */
370 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_input_t *, libvlc_exception_t * );
371
372 /**
373  * Set new video aspect ratio
374  * \param p_input the input
375  * \param psz_aspect new video aspect-ratio
376  * \param p_exception an initialized exception
377  */
378 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_input_t *, char *, libvlc_exception_t * );
379
380 /**
381  * Get current crop filter geometry
382  * \param p_input the input
383  * \param p_exception an initialized exception
384  * \return the crop filter geometry
385  */
386 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_input_t *, libvlc_exception_t * );
387
388 /**
389  * Set new crop filter geometry
390  * \param p_input the input
391  * \param psz_geometry new crop filter geometry
392  * \param p_exception an initialized exception
393  */
394 VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_input_t *, char *, libvlc_exception_t * );
395
396 /**
397  * Take a snapshot of the current video window
398  * \param p_input the input
399  * \param psz_filepath the path where to save the screenshot to
400  * \param p_exception an initialized exception
401  */
402 VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
403
404 VLC_PUBLIC_API int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *);
405
406 /**
407  * Resize the current video output window
408  * \param p_instance libvlc instance
409  * \param width new width for video output window
410  * \param height new height for video output window
411  * \param p_exception an initialized exception
412  * \return the success status (boolean)
413  */
414 VLC_PUBLIC_API void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *);
415
416 /**
417  * change the parent for the current the video output
418  * \param p_instance libvlc instance
419  * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
420  * \param p_exception an initialized exception
421  * \return the success status (boolean)
422  */
423 VLC_PUBLIC_API int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
424
425 /**
426  * Set the default video output parent
427  *  this settings will be used as default for all video outputs
428  * \param p_instance libvlc instance
429  * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
430  * \param p_exception an initialized exception
431  */
432 VLC_PUBLIC_API void libvlc_video_set_parent( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );
433
434 /**
435  * Set the default video output size
436  *  this settings will be used as default for all video outputs
437  * \param p_instance libvlc instance
438  * \param width new width for video drawable
439  * \param height new height for video drawable
440  * \param p_exception an initialized exception
441  */
442 VLC_PUBLIC_API void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc_exception_t * );
443
444 /**
445  * Set the default video output viewport for a windowless video output (MacOS X only)
446  *  this settings will be used as default for all video outputs
447  * \param p_instance libvlc instance
448  * \param view coordinates within video drawable
449  * \param clip coordinates within video drawable
450  * \param p_exception an initialized exception
451  */
452 VLC_PUBLIC_API void libvlc_video_set_viewport( libvlc_instance_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
453
454
455 /** @} */
456
457 /**
458  * defgroup libvlc_vlm VLM
459  * \ingroup libvlc
460  * LibVLC VLM handling
461  * @{
462  */
463
464 /** defgroup libvlc_audio Audio
465  * \ingroup libvlc
466  * LibVLC Audio handling
467  * @{
468  */
469
470 /**
471  * Toggle mute status
472  * \param p_instance libvlc instance
473  * \param p_exception an initialized exception
474  * \return void
475  */
476 VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_instance_t *, libvlc_exception_t * );
477
478 /**
479  * Get current mute status
480  * \param p_instance libvlc instance
481  * \param p_exception an initialized exception
482  * \return the mute status (boolean)
483  */
484 VLC_PUBLIC_API vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
485
486 /**
487  * Set mute status
488  * \param p_instance libvlc instance
489  * \param status If status is VLC_TRUE then mute, otherwise unmute
490  * \param p_exception an initialized exception
491  * \return void
492  */
493 VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_instance_t *, vlc_bool_t , libvlc_exception_t * );
494
495 /**
496  * Get current audio level
497  * \param p_instance libvlc instance
498  * \param p_exception an initialized exception
499  * \return the audio level (int)
500  */
501 VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
502
503 /**
504  * Set current audio level
505  * \param p_instance libvlc instance
506  * \param i_volume the volume (int)
507  * \param p_exception an initialized exception
508  */
509 VLC_PUBLIC_API void libvlc_audio_set_volume( libvlc_instance_t *, int, libvlc_exception_t *);
510
511 /**
512 +  * Get current audio track
513 +  * \param p_input input instance
514 +  * \param p_exception an initialized exception
515 +  * \return the audio track (int)
516 +  */
517 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_input_t *, libvlc_exception_t * );
518
519 /**
520  * Set current audio track
521  * \param p_input input instance
522  * \param i_track the track (int)
523  * \param p_exception an initialized exception
524  */
525 VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_input_t *, int, libvlc_exception_t * );
526
527 /**
528  * Get current audio channel
529  * \param p_instance input instance
530  * \param p_exception an initialized exception
531  * \return the audio channel (int)
532  */
533 VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );
534
535 /**
536  * Set current audio channel
537  * \param p_instance input instance
538  * \param i_channel the audio channel (int)
539  * \param p_exception an initialized exception
540  */
541 VLC_PUBLIC_API void libvlc_audio_set_channel( libvlc_instance_t *, int, libvlc_exception_t * );
542
543 /** @} */
544
545
546 /**
547  * Add a broadcast, with one input
548  * \param p_instance the instance
549  * \param psz_name the name of the new broadcast
550  * \param psz_input the input MRL
551  * \param psz_output the output MRL (the parameter to the "sout" variable)
552  * \param i_options number of additional options
553  * \param ppsz_options additional options
554  * \param b_enabled boolean for enabling the new broadcast
555  * \param b_loop Should this broadcast be played in loop ?
556  * \param p_exception an initialized exception
557  */
558 VLC_PUBLIC_API void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
559                                               int, char **, int, int, libvlc_exception_t * );
560
561 /**
562  * Delete a media (vod or broadcast)
563  * \param p_instance the instance
564  * \param psz_name the media to delete
565  * \param p_exception an initialized exception
566  */
567 VLC_PUBLIC_API void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
568
569 /**
570  * Enable or disable a media (vod or broadcast)
571  * \param p_instance the instance
572  * \param psz_name the media to work on
573  * \param b_enabled the new status
574  * \param p_exception an initialized exception
575  */
576 VLC_PUBLIC_API void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
577                                             libvlc_exception_t *);
578
579 /**
580  * Set the output for a media
581  * \param p_instance the instance
582  * \param psz_name the media to work on
583  * \param psz_output the output MRL (the parameter to the "sout" variable)
584  * \param p_exception an initialized exception
585  */
586 VLC_PUBLIC_API void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
587                                            libvlc_exception_t *);
588
589 /**
590  * Set a media's input MRL. This will delete all existing inputs and
591  * add the specified one.
592  * \param p_instance the instance
593  * \param psz_name the media to work on
594  * \param psz_input the input MRL
595  * \param p_exception an initialized exception
596  */
597 VLC_PUBLIC_API void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
598                                           libvlc_exception_t *);
599
600 /**
601  * Set output for a media
602  * \param p_instance the instance
603  * \param psz_name the media to work on
604  * \param b_loop the new status
605  * \param p_exception an initialized exception
606  */
607 VLC_PUBLIC_API void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int,
608                                          libvlc_exception_t *);
609
610 /**
611  * Edit the parameters of a media. This will delete all existing inputs and
612  * add the specified one.
613  * \param p_instance the instance
614  * \param psz_name the name of the new broadcast
615  * \param psz_input the input MRL
616  * \param psz_output the output MRL (the parameter to the "sout" variable)
617  * \param i_options number of additional options
618  * \param ppsz_options additional options
619  * \param b_enabled boolean for enabling the new broadcast
620  * \param b_loop Should this broadcast be played in loop ?
621  * \param p_exception an initialized exception
622  */
623 VLC_PUBLIC_API void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
624                                              int, char **, int, int, libvlc_exception_t * );
625
626 /**
627  * Plays the named broadcast.
628  * \param p_instance the instance
629  * \param psz_name the name of the broadcast
630  * \param p_exception an initialized exception
631  */
632 VLC_PUBLIC_API void libvlc_vlm_play_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
633
634 /**
635  * Stops the named broadcast.
636  * \param p_instance the instance
637  * \param psz_name the name of the broadcast
638  * \param p_exception an initialized exception
639  */ 
640 VLC_PUBLIC_API void libvlc_vlm_stop_media ( libvlc_instance_t *, char *, libvlc_exception_t * );
641
642 /**
643  * Pauses the named broadcast.
644  * \param p_instance the instance
645  * \param psz_name the name of the broadcast
646  * \param p_exception an initialized exception
647  */ 
648 VLC_PUBLIC_API void libvlc_vlm_pause_media( libvlc_instance_t *, char *, libvlc_exception_t * );
649     
650 /**
651  * Seeks in the named broadcast.
652  * \param p_instance the instance
653  * \param psz_name the name of the broadcast
654  * \param f_percentage the percentage to seek to
655  * \param p_exception an initialized exception
656  */ 
657 VLC_PUBLIC_API void libvlc_vlm_seek_media( libvlc_instance_t *, char *,
658                                            float, libvlc_exception_t * );
659    
660 /**
661  * Return information of the named broadcast.
662  * \param p_instance the instance
663  * \param psz_name the name of the broadcast
664  * \param p_exception an initialized exception
665  */ 
666 VLC_PUBLIC_API char* libvlc_vlm_show_media( libvlc_instance_t *, char *, libvlc_exception_t * );
667
668 #define LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( attr, returnType, getType, default)\
669 returnType libvlc_vlm_get_media_## attr( libvlc_instance_t *, \
670                         char *, int , libvlc_exception_t * );
671
672 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( position, float, Float, -1);
673 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( time, int, Integer, -1);
674 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( length, int, Integer, -1);
675 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( rate, int, Integer, -1);
676 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( title, int, Integer, 0);
677 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( chapter, int, Integer, 0);
678 VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( seekable, int, Bool, 0);
679
680 #undef LIBVLC_VLM_GET_MEDIA_ATTRIBUTE
681
682 /** @} */
683 /** @} */
684
685 /*****************************************************************************
686  * Message log handling
687  *****************************************************************************/
688
689 /** defgroup libvlc_log Log
690  * \ingroup libvlc
691  * LibVLC Message Logging
692  * @{
693  */
694
695 /** This structure is opaque. It represents a libvlc log instance */
696 typedef struct libvlc_log_t libvlc_log_t;
697
698 /** This structure is opaque. It represents a libvlc log iterator */
699 typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
700
701 typedef struct libvlc_log_message_t
702 {
703     unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
704     int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
705     const char *psz_type;     /* module type */
706     const char *psz_name;     /* module name */
707     const char *psz_header;   /* optional header */
708     const char *psz_message;  /* message */
709 } libvlc_log_message_t;
710
711 /**
712  * Returns the VLC messaging verbosity level
713  * \param p_instance libvlc instance
714  * \param exception an initialized exception pointer
715  */
716 VLC_PUBLIC_API unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instance,
717                                                   libvlc_exception_t *p_e );
718
719 /**
720  * Set the VLC messaging verbosity level
721  * \param p_log libvlc log instance
722  * \param exception an initialized exception pointer
723  */
724 VLC_PUBLIC_API void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level,
725                                               libvlc_exception_t *p_e );
726
727 /**
728  * Open an instance to VLC message log 
729  * \param p_instance libvlc instance
730  * \param exception an initialized exception pointer
731  */
732 VLC_PUBLIC_API libvlc_log_t *libvlc_log_open( const libvlc_instance_t *, libvlc_exception_t *);
733
734 /**
735  * Close an instance of VLC message log 
736  * \param p_log libvlc log instance
737  * \param exception an initialized exception pointer
738  */
739 VLC_PUBLIC_API void libvlc_log_close( libvlc_log_t *, libvlc_exception_t *);
740
741 /**
742  * Returns the number of messages in log
743  * \param p_log libvlc log instance
744  * \param exception an initialized exception pointer
745  */
746 VLC_PUBLIC_API unsigned libvlc_log_count( const libvlc_log_t *, libvlc_exception_t *);
747
748 /**
749  * Clear all messages in log
750  *  the log should be cleared on a regular basis to avoid clogging
751  * \param p_log libvlc log instance
752  * \param exception an initialized exception pointer
753  */
754 VLC_PUBLIC_API void libvlc_log_clear( libvlc_log_t *, libvlc_exception_t *);
755
756 /**
757  * Allocate and returns a new iterator to messages in log
758  * \param p_log libvlc log instance
759  * \param exception an initialized exception pointer
760  */
761 VLC_PUBLIC_API libvlc_log_iterator_t *libvlc_log_get_iterator( const libvlc_log_t *, libvlc_exception_t *);
762
763 /**
764  * Releases a previoulsy allocated iterator
765  * \param p_log libvlc log iterator 
766  * \param exception an initialized exception pointer
767  */
768 VLC_PUBLIC_API void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
769
770 /**
771  * Returns whether log iterator has more messages 
772  * \param p_log libvlc log iterator
773  * \param exception an initialized exception pointer
774  */
775 VLC_PUBLIC_API int libvlc_log_iterator_has_next( const libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
776
777 /**
778  * Returns next log message
779  *   the content of message must not be freed
780  * \param p_log libvlc log iterator
781  * \param exception an initialized exception pointer
782  */
783 VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterator_t *p_iter,
784                                                                struct libvlc_log_message_t *buffer,
785                                                                libvlc_exception_t *p_e );
786
787 /** @} */
788
789 # ifdef __cplusplus
790 }
791 # endif
792
793 #endif /* <vlc/libvlc.h> */