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