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