]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_player.h
avcodec: don't guess size when encoding video
[vlc] / include / vlc / libvlc_media_player.h
1 /*****************************************************************************
2  * libvlc_media_player.h:  libvlc_media_player external API
3  *****************************************************************************
4  * Copyright (C) 1998-2010 VLC authors and VideoLAN
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 it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * 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 # else
37 #  include <stdbool.h>
38 # endif
39
40 /*****************************************************************************
41  * Media Player
42  *****************************************************************************/
43 /** \defgroup libvlc_media_player LibVLC media player
44  * \ingroup libvlc
45  * A LibVLC media player plays one media (usually in a custom drawable).
46  * @{
47  */
48
49 typedef struct libvlc_media_player_t libvlc_media_player_t;
50
51 /**
52  * Description for video, audio tracks and subtitles. It contains
53  * id, name (description string) and pointer to next record.
54  */
55 typedef struct libvlc_track_description_t
56 {
57     int   i_id;
58     char *psz_name;
59     struct libvlc_track_description_t *p_next;
60
61 } libvlc_track_description_t;
62
63 /**
64  * Description for audio output. It contains
65  * name, description and pointer to next record.
66  */
67 typedef struct libvlc_audio_output_t
68 {
69     char *psz_name;
70     char *psz_description;
71     struct libvlc_audio_output_t *p_next;
72
73 } libvlc_audio_output_t;
74
75 /**
76  * Description for audio output device.
77  */
78 typedef struct libvlc_audio_output_device_t
79 {
80     struct libvlc_audio_output_device_t *p_next; /**< Next entry in list */
81     char *psz_device; /**< Device identifier string */
82     char *psz_description; /**< User-friendly device description */
83     /* More fields may be added here in later versions */
84 } libvlc_audio_output_device_t;
85
86 /**
87  * Rectangle type for video geometry
88  */
89 typedef struct libvlc_rectangle_t
90 {
91     int top, left;
92     int bottom, right;
93 } libvlc_rectangle_t;
94
95 /**
96  * Marq options definition
97  */
98 typedef enum libvlc_video_marquee_option_t {
99     libvlc_marquee_Enable = 0,
100     libvlc_marquee_Text,                  /** string argument */
101     libvlc_marquee_Color,
102     libvlc_marquee_Opacity,
103     libvlc_marquee_Position,
104     libvlc_marquee_Refresh,
105     libvlc_marquee_Size,
106     libvlc_marquee_Timeout,
107     libvlc_marquee_X,
108     libvlc_marquee_Y
109 } libvlc_video_marquee_option_t;
110
111 /**
112  * Navigation mode
113  */
114 typedef enum libvlc_navigate_mode_t
115 {
116     libvlc_navigate_activate = 0,
117     libvlc_navigate_up,
118     libvlc_navigate_down,
119     libvlc_navigate_left,
120     libvlc_navigate_right
121 } libvlc_navigate_mode_t;
122
123 /**
124  * Enumeration of values used to set position (e.g. of video title).
125  */
126 typedef enum libvlc_position_t {
127     libvlc_position_disable=-1,
128     libvlc_position_center,
129     libvlc_position_left,
130     libvlc_position_right,
131     libvlc_position_top,
132     libvlc_position_top_left,
133     libvlc_position_top_right,
134     libvlc_position_bottom,
135     libvlc_position_bottom_left,
136     libvlc_position_bottom_right
137 } libvlc_position_t;
138
139 /**
140  * Opaque equalizer handle.
141  *
142  * Equalizer settings can be applied to a media player.
143  */
144 typedef struct libvlc_equalizer_t libvlc_equalizer_t;
145
146 /**
147  * Create an empty Media Player object
148  *
149  * \param p_libvlc_instance the libvlc instance in which the Media Player
150  *        should be created.
151  * \return a new media player object, or NULL on error.
152  */
153 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
154
155 /**
156  * Create a Media Player object from a Media
157  *
158  * \param p_md the media. Afterwards the p_md can be safely
159  *        destroyed.
160  * \return a new media player object, or NULL on error.
161  */
162 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
163
164 /**
165  * Release a media_player after use
166  * Decrement the reference count of a media player object. If the
167  * reference count is 0, then libvlc_media_player_release() will
168  * release the media player object. If the media player object
169  * has been released, then it should not be used again.
170  *
171  * \param p_mi the Media Player to free
172  */
173 LIBVLC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
174
175 /**
176  * Retain a reference to a media player object. Use
177  * libvlc_media_player_release() to decrement reference count.
178  *
179  * \param p_mi media player object
180  */
181 LIBVLC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
182
183 /**
184  * Set the media that will be used by the media_player. If any,
185  * previous md will be released.
186  *
187  * \param p_mi the Media Player
188  * \param p_md the Media. Afterwards the p_md can be safely
189  *        destroyed.
190  */
191 LIBVLC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
192                                                    libvlc_media_t *p_md );
193
194 /**
195  * Get the media used by the media_player.
196  *
197  * \param p_mi the Media Player
198  * \return the media associated with p_mi, or NULL if no
199  *         media is associated
200  */
201 LIBVLC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
202
203 /**
204  * Get the Event Manager from which the media player send event.
205  *
206  * \param p_mi the Media Player
207  * \return the event manager associated with p_mi
208  */
209 LIBVLC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
210
211 /**
212  * is_playing
213  *
214  * \param p_mi the Media Player
215  * \return 1 if the media player is playing, 0 otherwise
216  *
217  * \libvlc_return_bool
218  */
219 LIBVLC_API int libvlc_media_player_is_playing ( libvlc_media_player_t *p_mi );
220
221 /**
222  * Play
223  *
224  * \param p_mi the Media Player
225  * \return 0 if playback started (and was already started), or -1 on error.
226  */
227 LIBVLC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
228
229 /**
230  * Pause or resume (no effect if there is no media)
231  *
232  * \param mp the Media Player
233  * \param do_pause play/resume if zero, pause if non-zero
234  * \version LibVLC 1.1.1 or later
235  */
236 LIBVLC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
237                                                     int do_pause );
238
239 /**
240  * Toggle pause (no effect if there is no media)
241  *
242  * \param p_mi the Media Player
243  */
244 LIBVLC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
245
246 /**
247  * Stop (no effect if there is no media)
248  *
249  * \param p_mi the Media Player
250  */
251 LIBVLC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
252
253 /**
254  * Callback prototype to allocate and lock a picture buffer.
255  *
256  * Whenever a new video frame needs to be decoded, the lock callback is
257  * invoked. Depending on the video chroma, one or three pixel planes of
258  * adequate dimensions must be returned via the second parameter. Those
259  * planes must be aligned on 32-bytes boundaries.
260  *
261  * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
262  * \param planes start address of the pixel planes (LibVLC allocates the array
263  *             of void pointers, this callback must initialize the array) [OUT]
264  * \return a private pointer for the display and unlock callbacks to identify
265  *         the picture buffers
266  */
267 typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
268
269 /**
270  * Callback prototype to unlock a picture buffer.
271  *
272  * When the video frame decoding is complete, the unlock callback is invoked.
273  * This callback might not be needed at all. It is only an indication that the
274  * application can now read the pixel values if it needs to.
275  *
276  * \warning A picture buffer is unlocked after the picture is decoded,
277  * but before the picture is displayed.
278  *
279  * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
280  * \param picture private pointer returned from the @ref libvlc_video_lock_cb
281  *                callback [IN]
282  * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
283  *               callback (this parameter is only for convenience) [IN]
284  */
285 typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
286                                        void *const *planes);
287
288 /**
289  * Callback prototype to display a picture.
290  *
291  * When the video frame needs to be shown, as determined by the media playback
292  * clock, the display callback is invoked.
293  *
294  * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
295  * \param picture private pointer returned from the @ref libvlc_video_lock_cb
296  *                callback [IN]
297  */
298 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
299
300 /**
301  * Callback prototype to configure picture buffers format.
302  * This callback gets the format of the video as output by the video decoder
303  * and the chain of video filters (if any). It can opt to change any parameter
304  * as it needs. In that case, LibVLC will attempt to convert the video format
305  * (rescaling and chroma conversion) but these operations can be CPU intensive.
306  *
307  * \param opaque pointer to the private pointer passed to
308  *               libvlc_video_set_callbacks() [IN/OUT]
309  * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
310  * \param width pointer to the pixel width [IN/OUT]
311  * \param height pointer to the pixel height [IN/OUT]
312  * \param pitches table of scanline pitches in bytes for each pixel plane
313  *                (the table is allocated by LibVLC) [OUT]
314  * \param lines table of scanlines count for each plane [OUT]
315  * \return the number of picture buffers allocated, 0 indicates failure
316  *
317  * \note
318  * For each pixels plane, the scanline pitch must be bigger than or equal to
319  * the number of bytes per pixel multiplied by the pixel width.
320  * Similarly, the number of scanlines must be bigger than of equal to
321  * the pixel height.
322  * Furthermore, we recommend that pitches and lines be multiple of 32
323  * to not break assumption that might be made by various optimizations
324  * in the video decoders, video filters and/or video converters.
325  */
326 typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
327                                            unsigned *width, unsigned *height,
328                                            unsigned *pitches,
329                                            unsigned *lines);
330
331 /**
332  * Callback prototype to configure picture buffers format.
333  *
334  * \param opaque private pointer as passed to libvlc_video_set_callbacks()
335  *               (and possibly modified by @ref libvlc_video_format_cb) [IN]
336  */
337 typedef void (*libvlc_video_cleanup_cb)(void *opaque);
338
339
340 /**
341  * Set callbacks and private data to render decoded video to a custom area
342  * in memory.
343  * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
344  * to configure the decoded format.
345  *
346  * \param mp the media player
347  * \param lock callback to lock video memory (must not be NULL)
348  * \param unlock callback to unlock video memory (or NULL if not needed)
349  * \param display callback to display video (or NULL if not needed)
350  * \param opaque private pointer for the three callbacks (as first parameter)
351  * \version LibVLC 1.1.1 or later
352  */
353 LIBVLC_API
354 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
355                                  libvlc_video_lock_cb lock,
356                                  libvlc_video_unlock_cb unlock,
357                                  libvlc_video_display_cb display,
358                                  void *opaque );
359
360 /**
361  * Set decoded video chroma and dimensions.
362  * This only works in combination with libvlc_video_set_callbacks(),
363  * and is mutually exclusive with libvlc_video_set_format_callbacks().
364  *
365  * \param mp the media player
366  * \param chroma a four-characters string identifying the chroma
367  *               (e.g. "RV32" or "YUYV")
368  * \param width pixel width
369  * \param height pixel height
370  * \param pitch line pitch (in bytes)
371  * \version LibVLC 1.1.1 or later
372  * \bug All pixel planes are expected to have the same pitch.
373  * To use the YCbCr color space with chrominance subsampling,
374  * consider using libvlc_video_set_format_callbacks() instead.
375  */
376 LIBVLC_API
377 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
378                               unsigned width, unsigned height,
379                               unsigned pitch );
380
381 /**
382  * Set decoded video chroma and dimensions. This only works in combination with
383  * libvlc_video_set_callbacks().
384  *
385  * \param mp the media player
386  * \param setup callback to select the video format (cannot be NULL)
387  * \param cleanup callback to release any allocated resources (or NULL)
388  * \version LibVLC 2.0.0 or later
389  */
390 LIBVLC_API
391 void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
392                                         libvlc_video_format_cb setup,
393                                         libvlc_video_cleanup_cb cleanup );
394
395 /**
396  * Set the NSView handler where the media player should render its video output.
397  *
398  * Use the vout called "macosx".
399  *
400  * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
401  * protocol:
402  *
403  * @begincode
404  * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
405  * - (void)addVoutSubview:(NSView *)view;
406  * - (void)removeVoutSubview:(NSView *)view;
407  * \@end
408  * @endcode
409  *
410  * Or it can be an NSView object.
411  *
412  * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
413  * the following code should work:
414  * @begincode
415  * {
416  *     NSView *video = [[NSView alloc] init];
417  *     QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
418  *     libvlc_media_player_set_nsobject(mp, video);
419  *     [video release];
420  * }
421  * @endcode
422  *
423  * You can find a live example in VLCVideoView in VLCKit.framework.
424  *
425  * \param p_mi the Media Player
426  * \param drawable the drawable that is either an NSView or an object following
427  * the VLCOpenGLVideoViewEmbedding protocol.
428  */
429 LIBVLC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
430
431 /**
432  * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
433  *
434  * \param p_mi the Media Player
435  * \return the NSView handler or 0 if none where set
436  */
437 LIBVLC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
438
439 /**
440  * Set the agl handler where the media player should render its video output.
441  *
442  * \param p_mi the Media Player
443  * \param drawable the agl handler
444  */
445 LIBVLC_API void libvlc_media_player_set_agl ( libvlc_media_player_t *p_mi, uint32_t drawable );
446
447 /**
448  * Get the agl handler previously set with libvlc_media_player_set_agl().
449  *
450  * \param p_mi the Media Player
451  * \return the agl handler or 0 if none where set
452  */
453 LIBVLC_API uint32_t libvlc_media_player_get_agl ( libvlc_media_player_t *p_mi );
454
455 /**
456  * Set an X Window System drawable where the media player should render its
457  * video output. If LibVLC was built without X11 output support, then this has
458  * no effects.
459  *
460  * The specified identifier must correspond to an existing Input/Output class
461  * X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
462  * the X11 server is the same as the one the VLC instance has been configured
463  * with. This function must be called before video playback is started;
464  * otherwise it will only take effect after playback stop and restart.
465  *
466  * \param p_mi the Media Player
467  * \param drawable the ID of the X window
468  */
469 LIBVLC_API void libvlc_media_player_set_xwindow ( libvlc_media_player_t *p_mi, uint32_t drawable );
470
471 /**
472  * Get the X Window System window identifier previously set with
473  * libvlc_media_player_set_xwindow(). Note that this will return the identifier
474  * even if VLC is not currently using it (for instance if it is playing an
475  * audio-only input).
476  *
477  * \param p_mi the Media Player
478  * \return an X window ID, or 0 if none where set.
479  */
480 LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
481
482 /**
483  * Set a Win32/Win64 API window handle (HWND) where the media player should
484  * render its video output. If LibVLC was built without Win32/Win64 API output
485  * support, then this has no effects.
486  *
487  * \param p_mi the Media Player
488  * \param drawable windows handle of the drawable
489  */
490 LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
491
492 /**
493  * Get the Windows API window handle (HWND) previously set with
494  * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
495  * is not currently outputting any video to it.
496  *
497  * \param p_mi the Media Player
498  * \return a window handle or NULL if there are none.
499  */
500 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
501
502 /**
503  * Callback prototype for audio playback.
504  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
505  * \param samples pointer to the first audio sample to play back [IN]
506  * \param count number of audio samples to play back
507  * \param pts expected play time stamp (see libvlc_delay())
508  */
509 typedef void (*libvlc_audio_play_cb)(void *data, const void *samples,
510                                      unsigned count, int64_t pts);
511
512 /**
513  * Callback prototype for audio pause.
514  * \note The pause callback is never called if the audio is already paused.
515  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
516  * \param pts time stamp of the pause request (should be elapsed already)
517  */
518 typedef void (*libvlc_audio_pause_cb)(void *data, int64_t pts);
519
520 /**
521  * Callback prototype for audio resumption (i.e. restart from pause).
522  * \note The resume callback is never called if the audio is not paused.
523  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
524  * \param pts time stamp of the resumption request (should be elapsed already)
525  */
526 typedef void (*libvlc_audio_resume_cb)(void *data, int64_t pts);
527
528 /**
529  * Callback prototype for audio buffer flush
530  * (i.e. discard all pending buffers and stop playback as soon as possible).
531  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
532  */
533 typedef void (*libvlc_audio_flush_cb)(void *data, int64_t pts);
534
535 /**
536  * Callback prototype for audio buffer drain
537  * (i.e. wait for pending buffers to be played).
538  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
539  */
540 typedef void (*libvlc_audio_drain_cb)(void *data);
541
542 /**
543  * Callback prototype for audio volume change.
544  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
545  * \param volume software volume (1. = nominal, 0. = mute)
546  * \param mute muted flag
547  */
548 typedef void (*libvlc_audio_set_volume_cb)(void *data,
549                                            float volume, bool mute);
550
551 /**
552  * Set callbacks and private data for decoded audio.
553  * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
554  * to configure the decoded audio format.
555  *
556  * \param mp the media player
557  * \param play callback to play audio samples (must not be NULL)
558  * \param pause callback to pause playback (or NULL to ignore)
559  * \param resume callback to resume playback (or NULL to ignore)
560  * \param flush callback to flush audio buffers (or NULL to ignore)
561  * \param drain callback to drain audio buffers (or NULL to ignore)
562  * \param opaque private pointer for the audio callbacks (as first parameter)
563  * \version LibVLC 2.0.0 or later
564  */
565 LIBVLC_API
566 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
567                                  libvlc_audio_play_cb play,
568                                  libvlc_audio_pause_cb pause,
569                                  libvlc_audio_resume_cb resume,
570                                  libvlc_audio_flush_cb flush,
571                                  libvlc_audio_drain_cb drain,
572                                  void *opaque );
573
574 /**
575  * Set callbacks and private data for decoded audio.
576  * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
577  * to configure the decoded audio format.
578  *
579  * \param mp the media player
580  * \param set_volume callback to apply audio volume,
581  *                   or NULL to apply volume in software
582  * \version LibVLC 2.0.0 or later
583  */
584 LIBVLC_API
585 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
586                                        libvlc_audio_set_volume_cb set_volume );
587
588 /**
589  * Callback prototype to setup the audio playback.
590  * This is called when the media player needs to create a new audio output.
591  * \param opaque pointer to the data pointer passed to
592  *               libvlc_audio_set_callbacks() [IN/OUT]
593  * \param format 4 bytes sample format [IN/OUT]
594  * \param rate sample rate [IN/OUT]
595  * \param channels channels count [IN/OUT]
596  * \return 0 on success, anything else to skip audio playback
597  */
598 typedef int (*libvlc_audio_setup_cb)(void **data, char *format, unsigned *rate,
599                                      unsigned *channels);
600
601 /**
602  * Callback prototype for audio playback cleanup.
603  * This is called when the media player no longer needs an audio output.
604  * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
605  */
606 typedef void (*libvlc_audio_cleanup_cb)(void *data);
607
608 /**
609  * Set decoded audio format. This only works in combination with
610  * libvlc_audio_set_callbacks().
611  *
612  * \param mp the media player
613  * \param setup callback to select the audio format (cannot be NULL)
614  * \param cleanup callback to release any allocated resources (or NULL)
615  * \version LibVLC 2.0.0 or later
616  */
617 LIBVLC_API
618 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
619                                         libvlc_audio_setup_cb setup,
620                                         libvlc_audio_cleanup_cb cleanup );
621
622 /**
623  * Set decoded audio format.
624  * This only works in combination with libvlc_audio_set_callbacks(),
625  * and is mutually exclusive with libvlc_audio_set_format_callbacks().
626  *
627  * \param mp the media player
628  * \param format a four-characters string identifying the sample format
629  *               (e.g. "S16N" or "FL32")
630  * \param rate sample rate (expressed in Hz)
631  * \param channels channels count
632  * \version LibVLC 2.0.0 or later
633  */
634 LIBVLC_API
635 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
636                               unsigned rate, unsigned channels );
637
638 /** \bug This might go away ... to be replaced by a broader system */
639
640 /**
641  * Get the current movie length (in ms).
642  *
643  * \param p_mi the Media Player
644  * \return the movie length (in ms), or -1 if there is no media.
645  */
646 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
647
648 /**
649  * Get the current movie time (in ms).
650  *
651  * \param p_mi the Media Player
652  * \return the movie time (in ms), or -1 if there is no media.
653  */
654 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
655
656 /**
657  * Set the movie time (in ms). This has no effect if no media is being played.
658  * Not all formats and protocols support this.
659  *
660  * \param p_mi the Media Player
661  * \param i_time the movie time (in ms).
662  */
663 LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
664
665 /**
666  * Get movie position as percentage between 0.0 and 1.0.
667  *
668  * \param p_mi the Media Player
669  * \return movie position, or -1. in case of error
670  */
671 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
672
673 /**
674  * Set movie position as percentage between 0.0 and 1.0. 
675  * This has no effect if playback is not enabled.
676  * This might not work depending on the underlying input format and protocol.
677  *
678  * \param p_mi the Media Player
679  * \param f_pos the position
680  */
681 LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
682
683 /**
684  * Set movie chapter (if applicable).
685  *
686  * \param p_mi the Media Player
687  * \param i_chapter chapter number to play
688  */
689 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
690
691 /**
692  * Get movie chapter.
693  *
694  * \param p_mi the Media Player
695  * \return chapter number currently playing, or -1 if there is no media.
696  */
697 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
698
699 /**
700  * Get movie chapter count
701  *
702  * \param p_mi the Media Player
703  * \return number of chapters in movie, or -1.
704  */
705 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
706
707 /**
708  * Is the player able to play
709  *
710  * \param p_mi the Media Player
711  * \return boolean
712  *
713  * \libvlc_return_bool
714  */
715 LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
716
717 /**
718  * Get title chapter count
719  *
720  * \param p_mi the Media Player
721  * \param i_title title
722  * \return number of chapters in title, or -1
723  */
724 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
725                        libvlc_media_player_t *p_mi, int i_title );
726
727 /**
728  * Set movie title
729  *
730  * \param p_mi the Media Player
731  * \param i_title title number to play
732  */
733 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
734
735 /**
736  * Get movie title
737  *
738  * \param p_mi the Media Player
739  * \return title number currently playing, or -1
740  */
741 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
742
743 /**
744  * Get movie title count
745  *
746  * \param p_mi the Media Player
747  * \return title number count, or -1
748  */
749 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
750
751 /**
752  * Set previous chapter (if applicable)
753  *
754  * \param p_mi the Media Player
755  */
756 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
757
758 /**
759  * Set next chapter (if applicable)
760  *
761  * \param p_mi the Media Player
762  */
763 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
764
765 /**
766  * Get the requested movie play rate.
767  * @warning Depending on the underlying media, the requested rate may be
768  * different from the real playback rate.
769  *
770  * \param p_mi the Media Player
771  * \return movie play rate
772  */
773 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
774
775 /**
776  * Set movie play rate
777  *
778  * \param p_mi the Media Player
779  * \param rate movie play rate to set
780  * \return -1 if an error was detected, 0 otherwise (but even then, it might
781  * not actually work depending on the underlying media protocol)
782  */
783 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
784
785 /**
786  * Get current movie state
787  *
788  * \param p_mi the Media Player
789  * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
790  */
791 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
792
793 /**
794  * Get movie fps rate
795  *
796  * \param p_mi the Media Player
797  * \return frames per second (fps) for this playing movie, or 0 if unspecified
798  */
799 LIBVLC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
800
801 /** end bug */
802
803 /**
804  * How many video outputs does this media player have?
805  *
806  * \param p_mi the media player
807  * \return the number of video outputs
808  */
809 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
810
811 /**
812  * Is this media player seekable?
813  *
814  * \param p_mi the media player
815  * \return true if the media player can seek
816  *
817  * \libvlc_return_bool
818  */
819 LIBVLC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
820
821 /**
822  * Can this media player be paused?
823  *
824  * \param p_mi the media player
825  * \return true if the media player can pause
826  *
827  * \libvlc_return_bool
828  */
829 LIBVLC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
830
831 /**
832  * Check if the current program is scrambled
833  *
834  * \param p_mi the media player
835  * \return true if the current program is scrambled
836  *
837  * \libvlc_return_bool
838  * \version LibVLC 2.2.0 or later
839  */
840 LIBVLC_API int libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
841
842 /**
843  * Display the next frame (if supported)
844  *
845  * \param p_mi the media player
846  */
847 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
848
849 /**
850  * Navigate through DVD Menu
851  *
852  * \param p_mi the Media Player
853  * \param navigate the Navigation mode
854  * \version libVLC 2.0.0 or later
855  */
856 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
857                                               unsigned navigate );
858
859 /**
860  * Set if, and how, the video title will be shown when media is played.
861  *
862  * \param p_mi the media player
863  * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
864  * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
865  * \version libVLC 2.1.0 or later
866  */
867 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
868
869 /**
870  * Release (free) libvlc_track_description_t
871  *
872  * \param p_track_description the structure to release
873  */
874 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
875
876 /**
877  * \deprecated Use libvlc_track_description_list_release instead
878  */
879 LIBVLC_DEPRECATED LIBVLC_API
880 void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
881
882 /** \defgroup libvlc_video LibVLC video controls
883  * @{
884  */
885
886 /**
887  * Toggle fullscreen status on non-embedded video outputs.
888  *
889  * @warning The same limitations applies to this function
890  * as to libvlc_set_fullscreen().
891  *
892  * \param p_mi the media player
893  */
894 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
895
896 /**
897  * Enable or disable fullscreen.
898  *
899  * @warning With most window managers, only a top-level windows can be in
900  * full-screen mode. Hence, this function will not operate properly if
901  * libvlc_media_player_set_xwindow() was used to embed the video in a
902  * non-top-level window. In that case, the embedding window must be reparented
903  * to the root window <b>before</b> fullscreen mode is enabled. You will want
904  * to reparent it back to its normal parent when disabling fullscreen.
905  *
906  * \param p_mi the media player
907  * \param b_fullscreen boolean for fullscreen status
908  */
909 LIBVLC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
910
911 /**
912  * Get current fullscreen status.
913  *
914  * \param p_mi the media player
915  * \return the fullscreen status (boolean)
916  *
917  * \libvlc_return_bool
918  */
919 LIBVLC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
920
921 /**
922  * Enable or disable key press events handling, according to the LibVLC hotkeys
923  * configuration. By default and for historical reasons, keyboard events are
924  * handled by the LibVLC video widget.
925  *
926  * \note On X11, there can be only one subscriber for key press and mouse
927  * click events per window. If your application has subscribed to those events
928  * for the X window ID of the video widget, then LibVLC will not be able to
929  * handle key presses and mouse clicks in any case.
930  *
931  * \warning This function is only implemented for X11 and Win32 at the moment.
932  *
933  * \param p_mi the media player
934  * \param on true to handle key press events, false to ignore them.
935  */
936 LIBVLC_API
937 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
938
939 /**
940  * Enable or disable mouse click events handling. By default, those events are
941  * handled. This is needed for DVD menus to work, as well as a few video
942  * filters such as "puzzle".
943  *
944  * \see libvlc_video_set_key_input().
945  *
946  * \warning This function is only implemented for X11 and Win32 at the moment.
947  *
948  * \param p_mi the media player
949  * \param on true to handle mouse click events, false to ignore them.
950  */
951 LIBVLC_API
952 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
953
954 /**
955  * Get the pixel dimensions of a video.
956  *
957  * \param p_mi media player
958  * \param num number of the video (starting from, and most commonly 0)
959  * \param px pointer to get the pixel width [OUT]
960  * \param py pointer to get the pixel height [OUT]
961  * \return 0 on success, -1 if the specified video does not exist
962  */
963 LIBVLC_API
964 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
965                            unsigned *px, unsigned *py );
966
967 /**
968  * Get current video height.
969  * \deprecated Use libvlc_video_get_size() instead.
970  *
971  * \param p_mi the media player
972  * \return the video pixel height or 0 if not applicable
973  */
974 LIBVLC_DEPRECATED LIBVLC_API
975 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
976
977 /**
978  * Get current video width.
979  * \deprecated Use libvlc_video_get_size() instead.
980  *
981  * \param p_mi the media player
982  * \return the video pixel width or 0 if not applicable
983  */
984 LIBVLC_DEPRECATED LIBVLC_API
985 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
986
987 /**
988  * Get the mouse pointer coordinates over a video.
989  * Coordinates are expressed in terms of the decoded video resolution,
990  * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
991  * you can query your windowing system directly).
992  *
993  * Either of the coordinates may be negative or larger than the corresponding
994  * dimension of the video, if the cursor is outside the rendering area.
995  *
996  * @warning The coordinates may be out-of-date if the pointer is not located
997  * on the video rendering area. LibVLC does not track the pointer if it is
998  * outside of the video widget.
999  *
1000  * @note LibVLC does not support multiple pointers (it does of course support
1001  * multiple input devices sharing the same pointer) at the moment.
1002  *
1003  * \param p_mi media player
1004  * \param num number of the video (starting from, and most commonly 0)
1005  * \param px pointer to get the abscissa [OUT]
1006  * \param py pointer to get the ordinate [OUT]
1007  * \return 0 on success, -1 if the specified video does not exist
1008  */
1009 LIBVLC_API
1010 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1011                              int *px, int *py );
1012
1013 /**
1014  * Get the current video scaling factor.
1015  * See also libvlc_video_set_scale().
1016  *
1017  * \param p_mi the media player
1018  * \return the currently configured zoom factor, or 0. if the video is set
1019  * to fit to the output window/drawable automatically.
1020  */
1021 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1022
1023 /**
1024  * Set the video scaling factor. That is the ratio of the number of pixels on
1025  * screen to the number of pixels in the original decoded video in each
1026  * dimension. Zero is a special value; it will adjust the video to the output
1027  * window/drawable (in windowed mode) or the entire screen.
1028  *
1029  * Note that not all video outputs support scaling.
1030  *
1031  * \param p_mi the media player
1032  * \param f_factor the scaling factor, or zero
1033  */
1034 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1035
1036 /**
1037  * Get current video aspect ratio.
1038  *
1039  * \param p_mi the media player
1040  * \return the video aspect ratio or NULL if unspecified
1041  * (the result must be released with free() or libvlc_free()).
1042  */
1043 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1044
1045 /**
1046  * Set new video aspect ratio.
1047  *
1048  * \param p_mi the media player
1049  * \param psz_aspect new video aspect-ratio or NULL to reset to default
1050  * \note Invalid aspect ratios are ignored.
1051  */
1052 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1053
1054 /**
1055  * Get current video subtitle.
1056  *
1057  * \param p_mi the media player
1058  * \return the video subtitle selected, or -1 if none
1059  */
1060 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1061
1062 /**
1063  * Get the number of available video subtitles.
1064  *
1065  * \param p_mi the media player
1066  * \return the number of available video subtitles
1067  */
1068 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1069
1070 /**
1071  * Get the description of available video subtitles.
1072  *
1073  * \param p_mi the media player
1074  * \return list containing description of available video subtitles
1075  */
1076 LIBVLC_API libvlc_track_description_t *
1077         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1078
1079 /**
1080  * Set new video subtitle.
1081  *
1082  * \param p_mi the media player
1083  * \param i_spu video subtitle track to select (i_id from track description)
1084  * \return 0 on success, -1 if out of range
1085  */
1086 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1087
1088 /**
1089  * Set new video subtitle file.
1090  *
1091  * \param p_mi the media player
1092  * \param psz_subtitle new video subtitle file
1093  * \return the success status (boolean)
1094  */
1095 LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
1096
1097 /**
1098  * Get the current subtitle delay. Positive values means subtitles are being
1099  * displayed later, negative values earlier.
1100  *
1101  * \param p_mi media player
1102  * \return time (in microseconds) the display of subtitles is being delayed
1103  * \version LibVLC 2.0.0 or later
1104  */
1105 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1106
1107 /**
1108  * Set the subtitle delay. This affects the timing of when the subtitle will
1109  * be displayed. Positive values result in subtitles being displayed later,
1110  * while negative values will result in subtitles being displayed earlier.
1111  *
1112  * The subtitle delay will be reset to zero each time the media changes.
1113  *
1114  * \param p_mi media player
1115  * \param i_delay time (in microseconds) the display of subtitles should be delayed
1116  * \return 0 on success, -1 on error
1117  * \version LibVLC 2.0.0 or later
1118  */
1119 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1120
1121 /**
1122  * Get the description of available titles.
1123  *
1124  * \param p_mi the media player
1125  * \return list containing description of available titles
1126  */
1127 LIBVLC_API libvlc_track_description_t *
1128         libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
1129
1130 /**
1131  * Get the description of available chapters for specific title.
1132  *
1133  * \param p_mi the media player
1134  * \param i_title selected title
1135  * \return list containing description of available chapter for title i_title
1136  */
1137 LIBVLC_API libvlc_track_description_t *
1138         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
1139
1140 /**
1141  * Get current crop filter geometry.
1142  *
1143  * \param p_mi the media player
1144  * \return the crop filter geometry or NULL if unset
1145  */
1146 LIBVLC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
1147
1148 /**
1149  * Set new crop filter geometry.
1150  *
1151  * \param p_mi the media player
1152  * \param psz_geometry new crop filter geometry (NULL to unset)
1153  */
1154 LIBVLC_API
1155 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
1156
1157 /**
1158  * Get current teletext page requested.
1159  *
1160  * \param p_mi the media player
1161  * \return the current teletext page requested.
1162  */
1163 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1164
1165 /**
1166  * Set new teletext page to retrieve.
1167  *
1168  * \param p_mi the media player
1169  * \param i_page teletex page number requested
1170  */
1171 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1172
1173 /**
1174  * Toggle teletext transparent status on video output.
1175  *
1176  * \param p_mi the media player
1177  */
1178 LIBVLC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
1179
1180 /**
1181  * Get number of available video tracks.
1182  *
1183  * \param p_mi media player
1184  * \return the number of available video tracks (int)
1185  */
1186 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1187
1188 /**
1189  * Get the description of available video tracks.
1190  *
1191  * \param p_mi media player
1192  * \return list with description of available video tracks, or NULL on error
1193  */
1194 LIBVLC_API libvlc_track_description_t *
1195         libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1196
1197 /**
1198  * Get current video track.
1199  *
1200  * \param p_mi media player
1201  * \return the video track ID (int) or -1 if no active input
1202  */
1203 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1204
1205 /**
1206  * Set video track.
1207  *
1208  * \param p_mi media player
1209  * \param i_track the track ID (i_id field from track description)
1210  * \return 0 on success, -1 if out of range
1211  */
1212 LIBVLC_API
1213 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1214
1215 /**
1216  * Take a snapshot of the current video window.
1217  *
1218  * If i_width AND i_height is 0, original size is used.
1219  * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1220  *
1221  * \param p_mi media player instance
1222  * \param num number of video output (typically 0 for the first/only one)
1223  * \param psz_filepath the path where to save the screenshot to
1224  * \param i_width the snapshot's width
1225  * \param i_height the snapshot's height
1226  * \return 0 on success, -1 if the video was not found
1227  */
1228 LIBVLC_API
1229 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1230                                 const char *psz_filepath, unsigned int i_width,
1231                                 unsigned int i_height );
1232
1233 /**
1234  * Enable or disable deinterlace filter
1235  *
1236  * \param p_mi libvlc media player
1237  * \param psz_mode type of deinterlace filter, NULL to disable
1238  */
1239 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1240                                                   const char *psz_mode );
1241
1242 /**
1243  * Get an integer marquee option value
1244  *
1245  * \param p_mi libvlc media player
1246  * \param option marq option to get \see libvlc_video_marquee_int_option_t
1247  */
1248 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1249                                                  unsigned option );
1250
1251 /**
1252  * Get a string marquee option value
1253  *
1254  * \param p_mi libvlc media player
1255  * \param option marq option to get \see libvlc_video_marquee_string_option_t
1256  */
1257 LIBVLC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1258                                                       unsigned option );
1259
1260 /**
1261  * Enable, disable or set an integer marquee option
1262  *
1263  * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1264  * or disabling (arg 0) the marq filter.
1265  *
1266  * \param p_mi libvlc media player
1267  * \param option marq option to set \see libvlc_video_marquee_int_option_t
1268  * \param i_val marq option value
1269  */
1270 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1271                                                   unsigned option, int i_val );
1272
1273 /**
1274  * Set a marquee string option
1275  *
1276  * \param p_mi libvlc media player
1277  * \param option marq option to set \see libvlc_video_marquee_string_option_t
1278  * \param psz_text marq option value
1279  */
1280 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1281                                                      unsigned option, const char *psz_text );
1282
1283 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1284 enum libvlc_video_logo_option_t {
1285     libvlc_logo_enable,
1286     libvlc_logo_file,           /**< string argument, "file,d,t;file,d,t;..." */
1287     libvlc_logo_x,
1288     libvlc_logo_y,
1289     libvlc_logo_delay,
1290     libvlc_logo_repeat,
1291     libvlc_logo_opacity,
1292     libvlc_logo_position
1293 };
1294
1295 /**
1296  * Get integer logo option.
1297  *
1298  * \param p_mi libvlc media player instance
1299  * \param option logo option to get, values of libvlc_video_logo_option_t
1300  */
1301 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1302                                               unsigned option );
1303
1304 /**
1305  * Set logo option as integer. Options that take a different type value
1306  * are ignored.
1307  * Passing libvlc_logo_enable as option value has the side effect of
1308  * starting (arg !0) or stopping (arg 0) the logo filter.
1309  *
1310  * \param p_mi libvlc media player instance
1311  * \param option logo option to set, values of libvlc_video_logo_option_t
1312  * \param value logo option value
1313  */
1314 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1315                                                unsigned option, int value );
1316
1317 /**
1318  * Set logo option as string. Options that take a different type value
1319  * are ignored.
1320  *
1321  * \param p_mi libvlc media player instance
1322  * \param option logo option to set, values of libvlc_video_logo_option_t
1323  * \param psz_value logo option value
1324  */
1325 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1326                                       unsigned option, const char *psz_value );
1327
1328
1329 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1330 enum libvlc_video_adjust_option_t {
1331     libvlc_adjust_Enable = 0,
1332     libvlc_adjust_Contrast,
1333     libvlc_adjust_Brightness,
1334     libvlc_adjust_Hue,
1335     libvlc_adjust_Saturation,
1336     libvlc_adjust_Gamma
1337 };
1338
1339 /**
1340  * Get integer adjust option.
1341  *
1342  * \param p_mi libvlc media player instance
1343  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1344  * \version LibVLC 1.1.1 and later.
1345  */
1346 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1347                                                 unsigned option );
1348
1349 /**
1350  * Set adjust option as integer. Options that take a different type value
1351  * are ignored.
1352  * Passing libvlc_adjust_enable as option value has the side effect of
1353  * starting (arg !0) or stopping (arg 0) the adjust filter.
1354  *
1355  * \param p_mi libvlc media player instance
1356  * \param option adust option to set, values of libvlc_video_adjust_option_t
1357  * \param value adjust option value
1358  * \version LibVLC 1.1.1 and later.
1359  */
1360 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1361                                                  unsigned option, int value );
1362
1363 /**
1364  * Get float adjust option.
1365  *
1366  * \param p_mi libvlc media player instance
1367  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1368  * \version LibVLC 1.1.1 and later.
1369  */
1370 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1371                                                     unsigned option );
1372
1373 /**
1374  * Set adjust option as float. Options that take a different type value
1375  * are ignored.
1376  *
1377  * \param p_mi libvlc media player instance
1378  * \param option adust option to set, values of libvlc_video_adjust_option_t
1379  * \param value adjust option value
1380  * \version LibVLC 1.1.1 and later.
1381  */
1382 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1383                                                    unsigned option, float value );
1384
1385 /** @} video */
1386
1387 /** \defgroup libvlc_audio LibVLC audio controls
1388  * @{
1389  */
1390
1391 /**
1392  * Audio device types
1393  */
1394 typedef enum libvlc_audio_output_device_types_t {
1395     libvlc_AudioOutputDevice_Error  = -1,
1396     libvlc_AudioOutputDevice_Mono   =  1,
1397     libvlc_AudioOutputDevice_Stereo =  2,
1398     libvlc_AudioOutputDevice_2F2R   =  4,
1399     libvlc_AudioOutputDevice_3F2R   =  5,
1400     libvlc_AudioOutputDevice_5_1    =  6,
1401     libvlc_AudioOutputDevice_6_1    =  7,
1402     libvlc_AudioOutputDevice_7_1    =  8,
1403     libvlc_AudioOutputDevice_SPDIF  = 10
1404 } libvlc_audio_output_device_types_t;
1405
1406 /**
1407  * Audio channels
1408  */
1409 typedef enum libvlc_audio_output_channel_t {
1410     libvlc_AudioChannel_Error   = -1,
1411     libvlc_AudioChannel_Stereo  =  1,
1412     libvlc_AudioChannel_RStereo =  2,
1413     libvlc_AudioChannel_Left    =  3,
1414     libvlc_AudioChannel_Right   =  4,
1415     libvlc_AudioChannel_Dolbys  =  5
1416 } libvlc_audio_output_channel_t;
1417
1418
1419 /**
1420  * Gets the list of available audio output modules.
1421  *
1422  * \param p_instance libvlc instance
1423  * \return list of available audio outputs. It must be freed it with
1424 *          \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1425  *         In case of error, NULL is returned.
1426  */
1427 LIBVLC_API libvlc_audio_output_t *
1428 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1429
1430 /**
1431  * Frees the list of available audio output modules.
1432  *
1433  * \param p_list list with audio outputs for release
1434  */
1435 LIBVLC_API
1436 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1437
1438 /**
1439  * Selects an audio output module.
1440  * \note Any change will take be effect only after playback is stopped and
1441  * restarted. Audio output cannot be changed while playing.
1442  *
1443  * \param p_mi media player
1444  * \param psz_name name of audio output,
1445  *               use psz_name of \see libvlc_audio_output_t
1446  * \return 0 if function succeded, -1 on error
1447  */
1448 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1449                                         const char *psz_name );
1450
1451 /**
1452  * Backward compatibility stub. Do not use in new code.
1453  * Use libvlc_audio_output_device_list_get() instead.
1454  * \return always 0.
1455  */
1456 LIBVLC_DEPRECATED LIBVLC_API
1457 int libvlc_audio_output_device_count( libvlc_instance_t *, const char * );
1458
1459 /**
1460  * Backward compatibility stub. Do not use in new code.
1461  * Use libvlc_audio_output_device_list_get() instead.
1462  * \return always NULL.
1463  */
1464 LIBVLC_DEPRECATED LIBVLC_API
1465 char *libvlc_audio_output_device_longname( libvlc_instance_t *, const char *,
1466                                            int );
1467
1468 /**
1469  * Backward compatibility stub. Do not use in new code.
1470  * Use libvlc_audio_output_device_list_get() instead.
1471  * \return always NULL.
1472  */
1473 LIBVLC_DEPRECATED LIBVLC_API
1474 char *libvlc_audio_output_device_id( libvlc_instance_t *, const char *, int );
1475
1476 /**
1477  * Gets a list of potential audio output devices,
1478  * \see libvlc_audio_output_device_set().
1479  *
1480  * \note Not all audio outputs support enumerating devices.
1481  * The audio output may be functional even if the list is empty (NULL).
1482  *
1483  * \note The list may not be exhaustive.
1484  *
1485  * \warning Some audio output devices in the list might not actually work in
1486  * some circumstances. By default, it is recommended to not specify any
1487  * explicit audio device.
1488  *
1489  * \param mp media player
1490  * \return A NULL-terminated linked list of potential audio output devices.
1491  * It must be freed it with libvlc_audio_output_device_list_release()
1492  * \version LibVLC 2.2.0 or later.
1493  */
1494 LIBVLC_API libvlc_audio_output_device_t *
1495 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
1496
1497 /**
1498  * Gets a list of audio output devices for a given audio output module,
1499  * \see libvlc_audio_output_device_set().
1500  *
1501  * \note Not all audio outputs support this. In particular, an empty (NULL)
1502  * list of devices does <b>not</b> imply that the specified audio output does
1503  * not work.
1504  *
1505  * \note The list might not be exhaustive.
1506  *
1507  * \warning Some audio output devices in the list might not actually work in
1508  * some circumstances. By default, it is recommended to not specify any
1509  * explicit audio device.
1510  *
1511  * \param p_instance libvlc instance
1512  * \param psz_aout audio output name
1513  *                 (as returned by libvlc_audio_output_list_get())
1514  * \return A NULL-terminated linked list of potential audio output devices.
1515  * It must be freed it with libvlc_audio_output_device_list_release()
1516  * \version LibVLC 2.1.0 or later.
1517  */
1518 LIBVLC_API libvlc_audio_output_device_t *
1519 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
1520                                      const char *aout );
1521
1522 /**
1523  * Frees a list of available audio output devices.
1524  *
1525  * \param p_list list with audio outputs for release
1526  * \version LibVLC 2.1.0 or later.
1527  */
1528 LIBVLC_API void libvlc_audio_output_device_list_release(
1529                                         libvlc_audio_output_device_t *p_list );
1530
1531 /**
1532  * Configures an explicit audio output device.
1533  *
1534  * If the module paramater is NULL, audio output will be moved to the device
1535  * specified by the device identifier string immediately. This is the
1536  * recommended usage.
1537  *
1538  * A list of adequate potential device strings can be obtained with
1539  * libvlc_audio_output_device_enum().
1540  *
1541  * However passing NULL is supported in LibVLC version 2.2.0 and later only;
1542  * in earlier versions, this function would have no effects when the module
1543  * parameter was NULL.
1544  *
1545  * If the module parameter is not NULL, the device parameter of the
1546  * corresponding audio output, if it exists, will be set to the specified
1547  * string. Note that some audio output modules do not have such a parameter
1548  * (notably MMDevice and PulseAudio).
1549  *
1550  * A list of adequate potential device strings can be obtained with
1551  * libvlc_audio_output_device_list_get().
1552  *
1553  * \note This function does not select the specified audio output plugin.
1554  * libvlc_audio_output_set() is used for that purpose.
1555  *
1556  * \warning The syntax for the device parameter depends on the audio output.
1557  *
1558  * Some audio output modules require further parameters (e.g. a channels map
1559  * in the case of ALSA).
1560  *
1561  * \param mp media player
1562  * \param module If NULL, current audio output module.
1563  *               if non-NULL, name of audio output module
1564                  (\see libvlc_audio_output_t)
1565  * \param device_id device identifier string
1566  * \return Nothing. Errors are ignored (this is a design bug).
1567  */
1568 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
1569                                                 const char *module,
1570                                                 const char *device_id );
1571
1572 /**
1573  * Stub for backward compatibility.
1574  * \return always -1.
1575  */
1576 LIBVLC_DEPRECATED
1577 LIBVLC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1578
1579 /**
1580  * Stub for backward compatibility.
1581  */
1582 LIBVLC_DEPRECATED
1583 LIBVLC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *,
1584                                                      int );
1585
1586
1587 /**
1588  * Toggle mute status.
1589  *
1590  * \param p_mi media player
1591  * \warning Toggling mute atomically is not always possible: On some platforms,
1592  * other processes can mute the VLC audio playback stream asynchronously. Thus,
1593  * there is a small race condition where toggling will not work.
1594  * See also the limitations of libvlc_audio_set_mute().
1595  */
1596 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1597
1598 /**
1599  * Get current mute status.
1600  *
1601  * \param p_mi media player
1602  * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
1603  */
1604 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1605
1606 /**
1607  * Set mute status.
1608  *
1609  * \param p_mi media player
1610  * \param status If status is true then mute, otherwise unmute
1611  * \warning This function does not always work. If there are no active audio
1612  * playback stream, the mute status might not be available. If digital
1613  * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
1614  * some audio output plugins do not support muting at all.
1615  * \note To force silent playback, disable all audio tracks. This is more
1616  * efficient and reliable than mute.
1617  */
1618 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1619
1620 /**
1621  * Get current software audio volume.
1622  *
1623  * \param p_mi media player
1624  * \return the software volume in percents
1625  * (0 = mute, 100 = nominal / 0dB)
1626  */
1627 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1628
1629 /**
1630  * Set current software audio volume.
1631  *
1632  * \param p_mi media player
1633  * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
1634  * \return 0 if the volume was set, -1 if it was out of range
1635  */
1636 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1637
1638 /**
1639  * Get number of available audio tracks.
1640  *
1641  * \param p_mi media player
1642  * \return the number of available audio tracks (int), or -1 if unavailable
1643  */
1644 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1645
1646 /**
1647  * Get the description of available audio tracks.
1648  *
1649  * \param p_mi media player
1650  * \return list with description of available audio tracks, or NULL
1651  */
1652 LIBVLC_API libvlc_track_description_t *
1653         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1654
1655 /**
1656  * Get current audio track.
1657  *
1658  * \param p_mi media player
1659  * \return the audio track ID or -1 if no active input.
1660  */
1661 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1662
1663 /**
1664  * Set current audio track.
1665  *
1666  * \param p_mi media player
1667  * \param i_track the track ID (i_id field from track description)
1668  * \return 0 on success, -1 on error
1669  */
1670 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1671
1672 /**
1673  * Get current audio channel.
1674  *
1675  * \param p_mi media player
1676  * \return the audio channel \see libvlc_audio_output_channel_t
1677  */
1678 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1679
1680 /**
1681  * Set current audio channel.
1682  *
1683  * \param p_mi media player
1684  * \param channel the audio channel, \see libvlc_audio_output_channel_t
1685  * \return 0 on success, -1 on error
1686  */
1687 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1688
1689 /**
1690  * Get current audio delay.
1691  *
1692  * \param p_mi media player
1693  * \return the audio delay (microseconds)
1694  * \version LibVLC 1.1.1 or later
1695  */
1696 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1697
1698 /**
1699  * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1700  *
1701  * \param p_mi media player
1702  * \param i_delay the audio delay (microseconds)
1703  * \return 0 on success, -1 on error
1704  * \version LibVLC 1.1.1 or later
1705  */
1706 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1707
1708 /**
1709  * Get the number of equalizer presets.
1710  *
1711  * \return number of presets
1712  * \version LibVLC 2.2.0 or later
1713  */
1714 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
1715
1716 /**
1717  * Get the name of a particular equalizer preset.
1718  *
1719  * This name can be used, for example, to prepare a preset label or menu in a user
1720  * interface.
1721  *
1722  * \param u_index index of the preset, counting from zero
1723  * \return preset name, or NULL if there is no such preset
1724  * \version LibVLC 2.2.0 or later
1725  */
1726 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
1727
1728 /**
1729  * Get the number of distinct frequency bands for an equalizer.
1730  *
1731  * \return number of frequency bands
1732  * \version LibVLC 2.2.0 or later
1733  */
1734 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
1735
1736 /**
1737  * Get a particular equalizer band frequency.
1738  *
1739  * This value can be used, for example, to create a label for an equalizer band control
1740  * in a user interface.
1741  *
1742  * \param u_index index of the band, counting from zero
1743  * \return equalizer band frequency (Hz), or -1 if there is no such band
1744  * \version LibVLC 2.2.0 or later
1745  */
1746 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
1747
1748 /**
1749  * Create a new default equalizer, with all frequency values zeroed.
1750  *
1751  * The new equalizer can subsequently be applied to a media player by invoking
1752  * libvlc_media_player_set_equalizer().
1753  *
1754  * The returned handle should be freed via libvlc_audio_equalizer_release() when
1755  * it is no longer needed.
1756  *
1757  * \return opaque equalizer handle, or NULL on error
1758  * \version LibVLC 2.2.0 or later
1759  */
1760 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
1761
1762 /**
1763  * Create a new equalizer, with initial frequency values copied from an existing
1764  * preset.
1765  *
1766  * The new equalizer can subsequently be applied to a media player by invoking
1767  * libvlc_media_player_set_equalizer().
1768  *
1769  * The returned handle should be freed via libvlc_audio_equalizer_release() when
1770  * it is no longer needed.
1771  *
1772  * \param u_index index of the preset, counting from zero
1773  * \return opaque equalizer handle, or NULL on error
1774  * \version LibVLC 2.2.0 or later
1775  */
1776 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
1777
1778 /**
1779  * Release a previously created equalizer instance.
1780  *
1781  * The equalizer was previously created by using libvlc_audio_equalizer_new() or
1782  * libvlc_audio_equalizer_new_from_preset().
1783  *
1784  * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
1785  *
1786  * \param p_equalizer opaque equalizer handle, or NULL
1787  * \version LibVLC 2.2.0 or later
1788  */
1789 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
1790
1791 /**
1792  * Set a new pre-amplification value for an equalizer.
1793  *
1794  * The new equalizer settings are subsequently applied to a media player by invoking
1795  * libvlc_media_player_set_equalizer().
1796  *
1797  * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1798  *
1799  * \param p_equalizer valid equalizer handle, must not be NULL
1800  * \param f_preamp preamp value (-20.0 to 20.0 Hz)
1801  * \return zero on success, -1 on error
1802  * \version LibVLC 2.2.0 or later
1803  */
1804 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
1805
1806 /**
1807  * Get the current pre-amplification value from an equalizer.
1808  *
1809  * \param p_equalizer valid equalizer handle, must not be NULL
1810  * \return preamp value (Hz)
1811  * \version LibVLC 2.2.0 or later
1812  */
1813 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
1814
1815 /**
1816  * Set a new amplification value for a particular equalizer frequency band.
1817  *
1818  * The new equalizer settings are subsequently applied to a media player by invoking
1819  * libvlc_media_player_set_equalizer().
1820  *
1821  * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1822  *
1823  * \param p_equalizer valid equalizer handle, must not be NULL
1824  * \param f_amp amplification value (-20.0 to 20.0 Hz)
1825  * \param u_band index, counting from zero, of the frequency band to set
1826  * \return zero on success, -1 on error
1827  * \version LibVLC 2.2.0 or later
1828  */
1829 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
1830
1831 /**
1832  * Get the amplification value for a particular equalizer frequency band.
1833  *
1834  * \param p_equalizer valid equalizer handle, must not be NULL
1835  * \param u_band index, counting from zero, of the frequency band to get
1836  * \return amplification value (Hz); NaN if there is no such frequency band
1837  * \version LibVLC 2.2.0 or later
1838  */
1839 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
1840
1841 /**
1842  * Apply new equalizer settings to a media player.
1843  *
1844  * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
1845  * libvlc_audio_equalizer_new_from_preset().
1846  *
1847  * It is possible to apply new equalizer settings to a media player whether the media
1848  * player is currently playing media or not.
1849  *
1850  * Invoking this method will immediately apply the new equalizer settings to the audio
1851  * output of the currently playing media if there is any.
1852  *
1853  * If there is no currently playing media, the new equalizer settings will be applied
1854  * later if and when new media is played.
1855  *
1856  * Equalizer settings will automatically be applied to subsequently played media.
1857  *
1858  * To disable the equalizer for a media player invoke this method passing NULL for the
1859  * p_equalizer parameter.
1860  *
1861  * The media player does not keep a reference to the supplied equalizer so it is safe
1862  * for an application to release the equalizer reference any time after this method
1863  * returns.
1864  *
1865  * \param p_mi opaque media player handle
1866  * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
1867  * \return zero on success, -1 on error
1868  * \version LibVLC 2.2.0 or later
1869  */
1870 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
1871
1872 /** @} audio */
1873
1874 /** @} media_player */
1875
1876 # ifdef __cplusplus
1877 }
1878 # endif
1879
1880 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */