]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_player.h
libvlc: Attempt to fix set_nsobject() with QMacCocoaViewContainer and improve documen...
[vlc] / include / vlc / libvlc_media_player.h
1 /*****************************************************************************
2  * libvlc_media_player.h:  libvlc_media_player external API
3  *****************************************************************************
4  * Copyright (C) 1998-2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Paul Saman <jpsaman@videolan.org>
9  *          Pierre d'Herbemont <pdherbemont@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 /**
27  * \file
28  * This file defines libvlc_media_player external API
29  */
30
31 #ifndef VLC_LIBVLC_MEDIA_PLAYER_H
32 #define VLC_LIBVLC_MEDIA_PLAYER_H 1
33
34 # ifdef __cplusplus
35 extern "C" {
36 # endif
37
38 /*****************************************************************************
39  * Media Player
40  *****************************************************************************/
41 /** \defgroup libvlc_media_player LibVLC media player
42  * \ingroup libvlc
43  * A LibVLC media player plays one media (usually in a custom drawable).
44  * @{
45  */
46
47 typedef struct libvlc_media_player_t libvlc_media_player_t;
48
49 /**
50  * Description for video, audio tracks and subtitles. It contains
51  * id, name (description string) and pointer to next record.
52  */
53 typedef struct libvlc_track_description_t
54 {
55     int   i_id;
56     char *psz_name;
57     struct libvlc_track_description_t *p_next;
58
59 } libvlc_track_description_t;
60
61 /**
62  * Description for audio output. It contains
63  * name, description and pointer to next record.
64  */
65 typedef struct libvlc_audio_output_t
66 {
67     char *psz_name;
68     char *psz_description;
69     struct libvlc_audio_output_t *p_next;
70
71 } libvlc_audio_output_t;
72
73 /**
74  * Rectangle type for video geometry
75  */
76 typedef struct libvlc_rectangle_t
77 {
78     int top, left;
79     int bottom, right;
80 } libvlc_rectangle_t;
81
82 /**
83  * Marq options definition
84  */
85 typedef enum libvlc_video_marquee_option_t {
86     libvlc_marquee_Enable = 0,
87     libvlc_marquee_Text,                /** string argument */
88     libvlc_marquee_Color,
89     libvlc_marquee_Opacity,
90     libvlc_marquee_Position,
91     libvlc_marquee_Refresh,
92     libvlc_marquee_Size,
93     libvlc_marquee_Timeout,
94     libvlc_marquee_X,
95     libvlc_marquee_Y
96 } libvlc_video_marquee_option_t;
97
98 /**
99  * Create an empty Media Player object
100  *
101  * \param p_libvlc_instance the libvlc instance in which the Media Player
102  *        should be created.
103  * \return a new media player object, or NULL on error.
104  */
105 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
106
107 /**
108  * Create a Media Player object from a Media
109  *
110  * \param p_md the media. Afterwards the p_md can be safely
111  *        destroyed.
112  * \return a new media player object, or NULL on error.
113  */
114 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
115
116 /**
117  * Release a media_player after use
118  * Decrement the reference count of a media player object. If the
119  * reference count is 0, then libvlc_media_player_release() will
120  * release the media player object. If the media player object
121  * has been released, then it should not be used again.
122  *
123  * \param p_mi the Media Player to free
124  */
125 VLC_PUBLIC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
126
127 /**
128  * Retain a reference to a media player object. Use
129  * libvlc_media_player_release() to decrement reference count.
130  *
131  * \param p_mi media player object
132  */
133 VLC_PUBLIC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
134
135 /**
136  * Set the media that will be used by the media_player. If any,
137  * previous md will be released.
138  *
139  * \param p_mi the Media Player
140  * \param p_md the Media. Afterwards the p_md can be safely
141  *        destroyed.
142  */
143 VLC_PUBLIC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
144                                                    libvlc_media_t *p_md );
145
146 /**
147  * Get the media used by the media_player.
148  *
149  * \param p_mi the Media Player
150  * \return the media associated with p_mi, or NULL if no
151  *         media is associated
152  */
153 VLC_PUBLIC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
154
155 /**
156  * Get the Event Manager from which the media player send event.
157  *
158  * \param p_mi the Media Player
159  * \return the event manager associated with p_mi
160  */
161 VLC_PUBLIC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
162
163 /**
164  * is_playing
165  *
166  * \param p_mi the Media Player
167  * \return 1 if the media player is playing, 0 otherwise
168  */
169 VLC_PUBLIC_API int libvlc_media_player_is_playing ( libvlc_media_player_t *p_mi );
170
171 /**
172  * Play
173  *
174  * \param p_mi the Media Player
175  * \return 0 if playback started (and was already started), or -1 on error.
176  */
177 VLC_PUBLIC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
178
179 /**
180  * Toggle pause (no effect if there is no media)
181  *
182  * \param p_mi the Media Player
183  */
184 VLC_PUBLIC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
185
186 /**
187  * Stop (no effect if there is no media)
188  *
189  * \param p_mi the Media Player
190  */
191 VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
192
193 /**
194  * Set the NSView handler where the media player should render its video output.
195  *
196  * Use the vout called "macosx".
197  *
198  * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
199  * protocol:
200  *
201  * @begincode
202  * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
203  * - (void)addVoutSubview:(NSView *)view;
204  * - (void)removeVoutSubview:(NSView *)view;
205  * \@end
206  * @endcode
207  *
208  * Or it can be an NSView object.
209  *
210  * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
211  * the following code should work:
212  * @begincode
213  * {
214  *     NSView *video = [[NSView alloc] init];
215  *     QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
216  *     libvlc_media_player_set_nsobject(mp, video);
217  *     [video release];
218  * }
219  * @endcode
220  *
221  * You can find a live example in VLCVideoView in VLCKit.framework.
222  *
223  * \param p_mi the Media Player
224  * \param drawable the drawable that is either an NSView or an object following
225  * the VLCOpenGLVideoViewEmbedding protocol.
226  */
227 VLC_PUBLIC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
228
229 /**
230  * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
231  *
232  * \param p_mi the Media Player
233  * \return the NSView handler or 0 if none where set
234  */
235 VLC_PUBLIC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
236
237 /**
238  * Set the agl handler where the media player should render its video output.
239  *
240  * \param p_mi the Media Player
241  * \param drawable the agl handler
242  */
243 VLC_PUBLIC_API void libvlc_media_player_set_agl ( libvlc_media_player_t *p_mi, uint32_t drawable );
244
245 /**
246  * Get the agl handler previously set with libvlc_media_player_set_agl().
247  *
248  * \param p_mi the Media Player
249  * \return the agl handler or 0 if none where set
250  */
251 VLC_PUBLIC_API uint32_t libvlc_media_player_get_agl ( libvlc_media_player_t *p_mi );
252
253 /**
254  * Set an X Window System drawable where the media player should render its
255  * video output. If LibVLC was built without X11 output support, then this has
256  * no effects.
257  *
258  * The specified identifier must correspond to an existing Input/Output class
259  * X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
260  * the X11 server is the same as the one the VLC instance has been configured
261  * with.
262  * If XVideo is <b>not</b> used, it is assumed that the drawable has the
263  * following properties in common with the default X11 screen: depth, scan line
264  * pad, black pixel. This is a bug.
265  *
266  * \param p_mi the Media Player
267  * \param drawable the ID of the X window
268  */
269 VLC_PUBLIC_API void libvlc_media_player_set_xwindow ( libvlc_media_player_t *p_mi, uint32_t drawable );
270
271 /**
272  * Get the X Window System window identifier previously set with
273  * libvlc_media_player_set_xwindow(). Note that this will return the identifier
274  * even if VLC is not currently using it (for instance if it is playing an
275  * audio-only input).
276  *
277  * \param p_mi the Media Player
278  * \return an X window ID, or 0 if none where set.
279  */
280 VLC_PUBLIC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
281
282 /**
283  * Set a Win32/Win64 API window handle (HWND) where the media player should
284  * render its video output. If LibVLC was built without Win32/Win64 API output
285  * support, then this has no effects.
286  *
287  * \param p_mi the Media Player
288  * \param drawable windows handle of the drawable
289  */
290 VLC_PUBLIC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
291
292 /**
293  * Get the Windows API window handle (HWND) previously set with
294  * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
295  * is not currently outputting any video to it.
296  *
297  * \param p_mi the Media Player
298  * \return a window handle or NULL if there are none.
299  */
300 VLC_PUBLIC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
301
302
303
304 /** \bug This might go away ... to be replaced by a broader system */
305
306 /**
307  * Get the current movie length (in ms).
308  *
309  * \param p_mi the Media Player
310  * \return the movie length (in ms), or -1 if there is no media.
311  */
312 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
313
314 /**
315  * Get the current movie time (in ms).
316  *
317  * \param p_mi the Media Player
318  * \return the movie time (in ms), or -1 if there is no media.
319  */
320 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
321
322 /**
323  * Set the movie time (in ms). This has no effect if no media is being played.
324  * Not all formats and protocols support this.
325  *
326  * \param p_mi the Media Player
327  * \param i_time the movie time (in ms).
328  */
329 VLC_PUBLIC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
330
331 /**
332  * Get movie position.
333  *
334  * \param p_mi the Media Player
335  * \return movie position, or -1. in case of error
336  */
337 VLC_PUBLIC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
338
339 /**
340  * Set movie position. This has no effect if playback is not enabled.
341  * This might not work depending on the underlying input format and protocol.
342  *
343  * \param p_mi the Media Player
344  * \param f_pos the position
345  */
346 VLC_PUBLIC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
347
348 /**
349  * Set movie chapter (if applicable).
350  *
351  * \param p_mi the Media Player
352  * \param i_chapter chapter number to play
353  */
354 VLC_PUBLIC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
355
356 /**
357  * Get movie chapter.
358  *
359  * \param p_mi the Media Player
360  * \return chapter number currently playing, or -1 if there is no media.
361  */
362 VLC_PUBLIC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
363
364 /**
365  * Get movie chapter count
366  *
367  * \param p_mi the Media Player
368  * \return number of chapters in movie, or -1.
369  */
370 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
371
372 /**
373  * Is the player able to play
374  *
375  * \param p_mi the Media Player
376  * \return boolean
377  */
378 VLC_PUBLIC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
379
380 /**
381  * Get title chapter count
382  *
383  * \param p_mi the Media Player
384  * \param i_title title
385  * \return number of chapters in title, or -1
386  */
387 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count_for_title(
388                        libvlc_media_player_t *p_mi, int i_title );
389
390 /**
391  * Set movie title
392  *
393  * \param p_mi the Media Player
394  * \param i_title title number to play
395  */
396 VLC_PUBLIC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
397
398 /**
399  * Get movie title
400  *
401  * \param p_mi the Media Player
402  * \return title number currently playing, or -1
403  */
404 VLC_PUBLIC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
405
406 /**
407  * Get movie title count
408  *
409  * \param p_mi the Media Player
410  * \return title number count, or -1
411  */
412 VLC_PUBLIC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
413
414 /**
415  * Set previous chapter (if applicable)
416  *
417  * \param p_mi the Media Player
418  */
419 VLC_PUBLIC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
420
421 /**
422  * Set next chapter (if applicable)
423  *
424  * \param p_mi the Media Player
425  */
426 VLC_PUBLIC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
427
428 /**
429  * Get the requested movie play rate.
430  * @warning Depending on the underlying media, the requested rate may be
431  * different from the real playback rate.
432  *
433  * \param p_mi the Media Player
434  * \return movie play rate
435  */
436 VLC_PUBLIC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
437
438 /**
439  * Set movie play rate
440  *
441  * \param p_mi the Media Player
442  * \param rate movie play rate to set
443  * \return -1 if an error was detected, 0 otherwise (but even then, it might
444  * not actually work depending on the underlying media protocol)
445  */
446 VLC_PUBLIC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
447
448 /**
449  * Get current movie state
450  *
451  * \param p_mi the Media Player
452  * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
453  */
454 VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
455
456 /**
457  * Get movie fps rate
458  *
459  * \param p_mi the Media Player
460  * \return frames per second (fps) for this playing movie, or 0 if unspecified
461  */
462 VLC_PUBLIC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
463
464 /** end bug */
465
466 /**
467  * How many video outputs does this media player have?
468  *
469  * \param p_mi the media player
470  * \return the number of video outputs
471  */
472 VLC_PUBLIC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
473
474 /**
475  * Is this media player seekable?
476  *
477  * \param p_mi the media player
478  * \return true if the media player can seek
479  */
480 VLC_PUBLIC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
481
482 /**
483  * Can this media player be paused?
484  *
485  * \param p_mi the media player
486  * \return true if the media player can pause
487  */
488 VLC_PUBLIC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
489
490
491 /**
492  * Display the next frame (if supported)
493  *
494  * \param p_mi the media player
495  */
496 VLC_PUBLIC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
497
498
499
500 /**
501  * Release (free) libvlc_track_description_t
502  *
503  * \param p_track_description the structure to release
504  */
505 VLC_PUBLIC_API void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
506
507 /** \defgroup libvlc_video LibVLC video controls
508  * @{
509  */
510
511 /**
512  * Toggle fullscreen status on non-embedded video outputs.
513  *
514  * @warning The same limitations applies to this function
515  * as to libvlc_set_fullscreen().
516  *
517  * \param p_mi the media player
518  */
519 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
520
521 /**
522  * Enable or disable fullscreen.
523  *
524  * @warning With most window managers, only a top-level windows can be in
525  * full-screen mode. Hence, this function will not operate properly if
526  * libvlc_media_player_set_xid() was used to embed the video in a non-top-level
527  * window. In that case, the embedding window must be reparented to the root
528  * window <b>before</b> fullscreen mode is enabled. You will want to reparent
529  * it back to its normal parent when disabling fullscreen.
530  *
531  * \param p_mi the media player
532  * \param b_fullscreen boolean for fullscreen status
533  */
534 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
535
536 /**
537  * Get current fullscreen status.
538  *
539  * \param p_mi the media player
540  * \return the fullscreen status (boolean)
541  */
542 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
543
544 /**
545  * Enable or disable key press events handling, according to the LibVLC hotkeys
546  * configuration. By default and for historical reasons, keyboard events are
547  * handled by the LibVLC video widget.
548  *
549  * \note On X11, there can be only one subscriber for key press and mouse
550  * click events per window. If your application has subscribed to those events
551  * for the X window ID of the video widget, then LibVLC will not be able to
552  * handle key presses and mouse clicks in any case.
553  *
554  * \warning This function is only implemented for X11 at the moment.
555  *
556  * \param p_mi the media player
557  * \param on true to handle key press events, false to ignore them.
558  */
559 VLC_PUBLIC_API
560 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
561
562 /**
563  * Enable or disable mouse click events handling. By default, those events are
564  * handled. This is needed for DVD menus to work, as well as a few video
565  * filters such as "puzzle".
566  *
567  * \note See also libvlc_video_set_key_input().
568  *
569  * \warning This function is only implemented for X11 at the moment.
570  *
571  * \param p_mi the media player
572  * \param on true to handle mouse click events, false to ignore them.
573  */
574 VLC_PUBLIC_API
575 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
576
577 /**
578  * Get the pixel dimensions of a video.
579  *
580  * \param p_mi media player
581  * \param num number of the video (starting from, and most commonly 0)
582  * \param px pointer to get the pixel width [OUT]
583  * \param py pointer to get the pixel height [OUT]
584  * \return 0 on success, -1 if the specified video does not exist
585  */
586 VLC_PUBLIC_API
587 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
588                            unsigned *px, unsigned *py );
589
590 /**
591  * Get current video height.
592  * You should use libvlc_video_get_size() instead.
593  *
594  * \param p_mi the media player
595  * \return the video pixel height or 0 if not applicable
596  */
597 VLC_DEPRECATED_API
598 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
599
600 /**
601  * Get current video width.
602  * You should use libvlc_video_get_size() instead.
603  *
604  * \param p_mi the media player
605  * \return the video pixel width or 0 if not applicable
606  */
607 VLC_DEPRECATED_API
608 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
609
610 /**
611  * Get the mouse pointer coordinates over a video.
612  * Coordinates are expressed in terms of the decoded video resolution,
613  * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
614  * you can query your windowing system directly).
615  *
616  * Either of the coordinates may be negative or larger than the corresponding
617  * dimension of the video, if the cursor is outside the rendering area.
618  *
619  * @warning The coordinates may be out-of-date if the pointer is not located
620  * on the video rendering area. LibVLC does not track the pointer if it is
621  * outside of the video widget.
622  *
623  * @note LibVLC does not support multiple pointers (it does of course support
624  * multiple input devices sharing the same pointer) at the moment.
625  *
626  * \param p_mi media player
627  * \param num number of the video (starting from, and most commonly 0)
628  * \param px pointer to get the abscissa [OUT]
629  * \param py pointer to get the ordinate [OUT]
630  * \return 0 on success, -1 if the specified video does not exist
631  */
632 VLC_PUBLIC_API
633 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
634                              int *px, int *py );
635
636 /**
637  * Get the current video scaling factor.
638  * See also libvlc_video_set_scale().
639  *
640  * \param p_mi the media player
641  * \return the currently configured zoom factor, or 0. if the video is set
642  * to fit to the output window/drawable automatically.
643  */
644 VLC_PUBLIC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
645
646 /**
647  * Set the video scaling factor. That is the ratio of the number of pixels on
648  * screen to the number of pixels in the original decoded video in each
649  * dimension. Zero is a special value; it will adjust the video to the output
650  * window/drawable (in windowed mode) or the entire screen.
651  *
652  * Note that not all video outputs support scaling.
653  *
654  * \param p_mi the media player
655  * \param f_factor the scaling factor, or zero
656  */
657 VLC_PUBLIC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
658
659 /**
660  * Get current video aspect ratio.
661  *
662  * \param p_mi the media player
663  * \return the video aspect ratio or NULL if unspecified
664  * (the result must be released with free()).
665  */
666 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
667
668 /**
669  * Set new video aspect ratio.
670  *
671  * \param p_mi the media player
672  * \param psz_aspect new video aspect-ratio or NULL to reset to default
673  * \note Invalid aspect ratios are ignored.
674  */
675 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
676
677 /**
678  * Get current video subtitle.
679  *
680  * \param p_mi the media player
681  * \return the video subtitle selected, or -1 if none
682  */
683 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
684
685 /**
686  * Get the number of available video subtitles.
687  *
688  * \param p_mi the media player
689  * \return the number of available video subtitles
690  */
691 VLC_PUBLIC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
692
693 /**
694  * Get the description of available video subtitles.
695  *
696  * \param p_mi the media player
697  * \return list containing description of available video subtitles
698  */
699 VLC_PUBLIC_API libvlc_track_description_t *
700         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
701
702 /**
703  * Set new video subtitle.
704  *
705  * \param p_mi the media player
706  * \param i_spu new video subtitle to select
707  * \return 0 on success, -1 if out of range
708  */
709 VLC_PUBLIC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, unsigned i_spu );
710
711 /**
712  * Set new video subtitle file.
713  *
714  * \param p_mi the media player
715  * \param psz_subtitle new video subtitle file
716  * \return the success status (boolean)
717  */
718 VLC_PUBLIC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
719
720 /**
721  * Get the description of available titles.
722  *
723  * \param p_mi the media player
724  * \return list containing description of available titles
725  */
726 VLC_PUBLIC_API libvlc_track_description_t *
727         libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
728
729 /**
730  * Get the description of available chapters for specific title.
731  *
732  * \param p_mi the media player
733  * \param i_title selected title
734  * \return list containing description of available chapter for title i_title
735  */
736 VLC_PUBLIC_API libvlc_track_description_t *
737         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
738
739 /**
740  * Get current crop filter geometry.
741  *
742  * \param p_mi the media player
743  * \return the crop filter geometry or NULL if unset
744  */
745 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
746
747 /**
748  * Set new crop filter geometry.
749  *
750  * \param p_mi the media player
751  * \param psz_geometry new crop filter geometry (NULL to unset)
752  */
753 VLC_PUBLIC_API
754 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
755
756 /**
757  * Get current teletext page requested.
758  *
759  * \param p_mi the media player
760  * \return the current teletext page requested.
761  */
762 VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
763
764 /**
765  * Set new teletext page to retrieve.
766  *
767  * \param p_mi the media player
768  * \param i_page teletex page number requested
769  */
770 VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
771
772 /**
773  * Toggle teletext transparent status on video output.
774  *
775  * \param p_mi the media player
776  */
777 VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
778
779 /**
780  * Get number of available video tracks.
781  *
782  * \param p_mi media player
783  * \return the number of available video tracks (int)
784  */
785 VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
786
787 /**
788  * Get the description of available video tracks.
789  *
790  * \param p_mi media player
791  * \return list with description of available video tracks, or NULL on error
792  */
793 VLC_PUBLIC_API libvlc_track_description_t *
794         libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
795
796 /**
797  * Get current video track.
798  *
799  * \param p_mi media player
800  * \return the video track (int) or -1 if none
801  */
802 VLC_PUBLIC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
803
804 /**
805  * Set video track.
806  *
807  * \param p_mi media player
808  * \param i_track the track (int)
809  * \return 0 on success, -1 if out of range
810  */
811 VLC_PUBLIC_API
812 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
813
814 /**
815  * Take a snapshot of the current video window.
816  *
817  * If i_width AND i_height is 0, original size is used.
818  * If i_width XOR i_height is 0, original aspect-ratio is preserved.
819  *
820  * \param p_mi media player instance
821  * \param num number of video output (typically 0 for the first/only one)
822  * \param psz_filepath the path where to save the screenshot to
823  * \param i_width the snapshot's width
824  * \param i_height the snapshot's height
825  * \return 0 on success, -1 if the video was not found
826  */
827 VLC_PUBLIC_API
828 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
829                                 const char *psz_filepath, unsigned int i_width,
830                                 unsigned int i_height );
831
832 /**
833  * Enable or disable deinterlace filter
834  *
835  * \param p_mi libvlc media player
836  * \param psz_mode type of deinterlace filter, NULL to disable
837  */
838 VLC_PUBLIC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
839                                                   const char *psz_mode );
840
841 /**
842  * Get an integer marquee option value
843  *
844  * \param p_mi libvlc media player
845  * \param option marq option to get \see libvlc_video_marquee_int_option_t
846  */
847 VLC_PUBLIC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
848                                                  unsigned option );
849
850 /**
851  * Get a string marquee option value
852  *
853  * \param p_mi libvlc media player
854  * \param option marq option to get \see libvlc_video_marquee_string_option_t
855  */
856 VLC_PUBLIC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
857                                                       unsigned option );
858
859 /**
860  * Enable, disable or set an integer marquee option
861  *
862  * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
863  * or disabling (arg 0) the marq filter.
864  *
865  * \param p_mi libvlc media player
866  * \param option marq option to set \see libvlc_video_marquee_int_option_t
867  * \param i_val marq option value
868  */
869 VLC_PUBLIC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
870                                                   unsigned option, int i_val );
871
872 /**
873  * Set a marquee string option
874  *
875  * \param p_mi libvlc media player
876  * \param option marq option to set \see libvlc_video_marquee_string_option_t
877  * \param psz_text marq option value
878  */
879 VLC_PUBLIC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
880                                                      unsigned option, const char *psz_text );
881
882 /** option values for libvlc_video_{get,set}_logo_{int,string} */
883 enum libvlc_video_logo_option_t {
884     libvlc_logo_enable,
885     libvlc_logo_file,           /**< string argument, "file,d,t;file,d,t;..." */
886     libvlc_logo_x,
887     libvlc_logo_y,
888     libvlc_logo_delay,
889     libvlc_logo_repeat,
890     libvlc_logo_opacity,
891     libvlc_logo_position,
892 };
893
894 /**
895  * Get integer logo option.
896  *
897  * \param p_mi libvlc media player instance
898  * \param option logo option to get, values of libvlc_video_logo_option_t
899  */
900 VLC_PUBLIC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
901                                               unsigned option );
902
903 /**
904  * Set logo option as integer. Options that take a different type value
905  * are ignored.
906  * Passing libvlc_logo_enable as option value has the side effect of
907  * starting (arg !0) or stopping (arg 0) the logo filter.
908  *
909  * \param p_mi libvlc media player instance
910  * \param option logo option to set, values of libvlc_video_logo_option_t
911  * \param value logo option value
912  */
913 VLC_PUBLIC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
914                                                unsigned option, int value );
915
916 /**
917  * Set logo option as string. Options that take a different type value
918  * are ignored.
919  *
920  * \param p_mi libvlc media player instance
921  * \param option logo option to set, values of libvlc_video_logo_option_t
922  * \param psz_value logo option value
923  */
924 VLC_PUBLIC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
925                                       unsigned option, const char *psz_value );
926
927
928 /** @} video */
929
930 /** \defgroup libvlc_audio LibVLC audio controls
931  * @{
932  */
933
934 /**
935  * Audio device types
936  */
937 typedef enum libvlc_audio_output_device_types_t {
938     libvlc_AudioOutputDevice_Error  = -1,
939     libvlc_AudioOutputDevice_Mono   =  1,
940     libvlc_AudioOutputDevice_Stereo =  2,
941     libvlc_AudioOutputDevice_2F2R   =  4,
942     libvlc_AudioOutputDevice_3F2R   =  5,
943     libvlc_AudioOutputDevice_5_1    =  6,
944     libvlc_AudioOutputDevice_6_1    =  7,
945     libvlc_AudioOutputDevice_7_1    =  8,
946     libvlc_AudioOutputDevice_SPDIF  = 10
947 } libvlc_audio_output_device_types_t;
948
949 /**
950  * Audio channels
951  */
952 typedef enum libvlc_audio_output_channel_t {
953     libvlc_AudioChannel_Error   = -1,
954     libvlc_AudioChannel_Stereo  =  1,
955     libvlc_AudioChannel_RStereo =  2,
956     libvlc_AudioChannel_Left    =  3,
957     libvlc_AudioChannel_Right   =  4,
958     libvlc_AudioChannel_Dolbys  =  5
959 } libvlc_audio_output_channel_t;
960
961
962 /**
963  * Get the list of available audio outputs
964  *
965  * \param p_instance libvlc instance
966  * \return list of available audio outputs. It must be freed it with
967 *          \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
968  *         In case of error, NULL is returned.
969  */
970 VLC_PUBLIC_API libvlc_audio_output_t *
971         libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
972
973 /**
974  * Free the list of available audio outputs
975  *
976  * \param p_list list with audio outputs for release
977  */
978 VLC_PUBLIC_API void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
979
980 /**
981  * Set the audio output.
982  * Change will be applied after stop and play.
983  *
984  * \param p_mi media player
985  * \param psz_name name of audio output,
986  *               use psz_name of \see libvlc_audio_output_t
987  * \return true if function succeded
988  */
989 VLC_PUBLIC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
990                                             const char *psz_name );
991
992 /**
993  * Get count of devices for audio output, these devices are hardware oriented
994  * like analor or digital output of sound card
995  *
996  * \param p_instance libvlc instance
997  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
998  * \return number of devices
999  */
1000 VLC_PUBLIC_API int libvlc_audio_output_device_count( libvlc_instance_t *p_instance,
1001                                                      const char *psz_audio_output );
1002
1003 /**
1004  * Get long name of device, if not available short name given
1005  *
1006  * \param p_instance libvlc instance
1007  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1008  * \param i_device device index
1009  * \return long name of device
1010  */
1011 VLC_PUBLIC_API char * libvlc_audio_output_device_longname( libvlc_instance_t *p_instance,
1012                                                            const char *psz_audio_output,
1013                                                            int i_device );
1014
1015 /**
1016  * Get id name of device
1017  *
1018  * \param p_instance libvlc instance
1019  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1020  * \param i_device device index
1021  * \return id name of device, use for setting device, need to be free after use
1022  */
1023 VLC_PUBLIC_API char * libvlc_audio_output_device_id( libvlc_instance_t *p_instance,
1024                                                      const char *psz_audio_output,
1025                                                      int i_device );
1026
1027 /**
1028  * Set audio output device. Changes are only effective after stop and play.
1029  *
1030  * \param p_mi media player
1031  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1032  * \param psz_device_id device
1033  */
1034 VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_media_player_t *p_mi,
1035                                                     const char *psz_audio_output,
1036                                                     const char *psz_device_id );
1037
1038 /**
1039  * Get current audio device type. Device type describes something like
1040  * character of output sound - stereo sound, 2.1, 5.1 etc
1041  *
1042  * \param p_mi media player
1043  * \return the audio devices type \see libvlc_audio_output_device_types_t
1044  */
1045 VLC_PUBLIC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1046
1047 /**
1048  * Set current audio device type.
1049  *
1050  * \param p_mi vlc instance
1051  * \param device_type the audio device type,
1052           according to \see libvlc_audio_output_device_types_t
1053  */
1054 VLC_PUBLIC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *p_mi,
1055                                                          int device_type );
1056
1057
1058 /**
1059  * Toggle mute status.
1060  *
1061  * \param p_mi media player
1062  */
1063 VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1064
1065 /**
1066  * Get current mute status.
1067  *
1068  * \param p_mi media player
1069  * \return the mute status (boolean)
1070  */
1071 VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1072
1073 /**
1074  * Set mute status.
1075  *
1076  * \param p_mi media player
1077  * \param status If status is true then mute, otherwise unmute
1078  */
1079 VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1080
1081 /**
1082  * Get current audio level.
1083  *
1084  * \param p_mi media player
1085  * \return the audio level (int)
1086  */
1087 VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1088
1089 /**
1090  * Set current audio level.
1091  *
1092  * \param p_mi media player
1093  * \param i_volume the volume (int)
1094  * \return 0 if the volume was set, -1 if it was out of range
1095  */
1096 VLC_PUBLIC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1097
1098 /**
1099  * Get number of available audio tracks.
1100  *
1101  * \param p_mi media player
1102  * \return the number of available audio tracks (int), or -1 if unavailable
1103  */
1104 VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1105
1106 /**
1107  * Get the description of available audio tracks.
1108  *
1109  * \param p_mi media player
1110  * \return list with description of available audio tracks, or NULL
1111  */
1112 VLC_PUBLIC_API libvlc_track_description_t *
1113         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1114
1115 /**
1116  * Get current audio track.
1117  *
1118  * \param p_mi media player
1119  * \return the audio track (int), or -1 if none.
1120  */
1121 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1122
1123 /**
1124  * Set current audio track.
1125  *
1126  * \param p_mi media player
1127  * \param i_track the track (int)
1128  * \return 0 on success, -1 on error
1129  */
1130 VLC_PUBLIC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1131
1132 /**
1133  * Get current audio channel.
1134  *
1135  * \param p_mi media player
1136  * \return the audio channel \see libvlc_audio_output_channel_t
1137  */
1138 VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1139
1140 /**
1141  * Set current audio channel.
1142  *
1143  * \param p_mi media player
1144  * \param channel the audio channel, \see libvlc_audio_output_channel_t
1145  * \return 0 on success, -1 on error
1146  */
1147 VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1148
1149 /** @} audio */
1150
1151 /** @} media_player */
1152
1153 # ifdef __cplusplus
1154 }
1155 # endif
1156
1157 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */