]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_player.h
upnp: change item b_net and i_type
[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 assumptions that might be held by optimized code
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. This only works in
576  * combination with libvlc_audio_set_callbacks().
577  * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
578  * to configure the decoded audio format.
579  *
580  * \param mp the media player
581  * \param set_volume callback to apply audio volume,
582  *                   or NULL to apply volume in software
583  * \version LibVLC 2.0.0 or later
584  */
585 LIBVLC_API
586 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
587                                        libvlc_audio_set_volume_cb set_volume );
588
589 /**
590  * Callback prototype to setup the audio playback.
591  * This is called when the media player needs to create a new audio output.
592  * \param opaque pointer to the data pointer passed to
593  *               libvlc_audio_set_callbacks() [IN/OUT]
594  * \param format 4 bytes sample format [IN/OUT]
595  * \param rate sample rate [IN/OUT]
596  * \param channels channels count [IN/OUT]
597  * \return 0 on success, anything else to skip audio playback
598  */
599 typedef int (*libvlc_audio_setup_cb)(void **data, char *format, unsigned *rate,
600                                      unsigned *channels);
601
602 /**
603  * Callback prototype for audio playback cleanup.
604  * This is called when the media player no longer needs an audio output.
605  * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
606  */
607 typedef void (*libvlc_audio_cleanup_cb)(void *data);
608
609 /**
610  * Set decoded audio format. This only works in combination with
611  * libvlc_audio_set_callbacks().
612  *
613  * \param mp the media player
614  * \param setup callback to select the audio format (cannot be NULL)
615  * \param cleanup callback to release any allocated resources (or NULL)
616  * \version LibVLC 2.0.0 or later
617  */
618 LIBVLC_API
619 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
620                                         libvlc_audio_setup_cb setup,
621                                         libvlc_audio_cleanup_cb cleanup );
622
623 /**
624  * Set decoded audio format.
625  * This only works in combination with libvlc_audio_set_callbacks(),
626  * and is mutually exclusive with libvlc_audio_set_format_callbacks().
627  *
628  * \param mp the media player
629  * \param format a four-characters string identifying the sample format
630  *               (e.g. "S16N" or "FL32")
631  * \param rate sample rate (expressed in Hz)
632  * \param channels channels count
633  * \version LibVLC 2.0.0 or later
634  */
635 LIBVLC_API
636 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
637                               unsigned rate, unsigned channels );
638
639 /** \bug This might go away ... to be replaced by a broader system */
640
641 /**
642  * Get the current movie length (in ms).
643  *
644  * \param p_mi the Media Player
645  * \return the movie length (in ms), or -1 if there is no media.
646  */
647 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
648
649 /**
650  * Get the current movie time (in ms).
651  *
652  * \param p_mi the Media Player
653  * \return the movie time (in ms), or -1 if there is no media.
654  */
655 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
656
657 /**
658  * Set the movie time (in ms). This has no effect if no media is being played.
659  * Not all formats and protocols support this.
660  *
661  * \param p_mi the Media Player
662  * \param i_time the movie time (in ms).
663  */
664 LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
665
666 /**
667  * Get movie position as percentage between 0.0 and 1.0.
668  *
669  * \param p_mi the Media Player
670  * \return movie position, or -1. in case of error
671  */
672 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
673
674 /**
675  * Set movie position as percentage between 0.0 and 1.0. 
676  * This has no effect if playback is not enabled.
677  * This might not work depending on the underlying input format and protocol.
678  *
679  * \param p_mi the Media Player
680  * \param f_pos the position
681  */
682 LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
683
684 /**
685  * Set movie chapter (if applicable).
686  *
687  * \param p_mi the Media Player
688  * \param i_chapter chapter number to play
689  */
690 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
691
692 /**
693  * Get movie chapter.
694  *
695  * \param p_mi the Media Player
696  * \return chapter number currently playing, or -1 if there is no media.
697  */
698 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
699
700 /**
701  * Get movie chapter count
702  *
703  * \param p_mi the Media Player
704  * \return number of chapters in movie, or -1.
705  */
706 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
707
708 /**
709  * Is the player able to play
710  *
711  * \param p_mi the Media Player
712  * \return boolean
713  *
714  * \libvlc_return_bool
715  */
716 LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
717
718 /**
719  * Get title chapter count
720  *
721  * \param p_mi the Media Player
722  * \param i_title title
723  * \return number of chapters in title, or -1
724  */
725 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
726                        libvlc_media_player_t *p_mi, int i_title );
727
728 /**
729  * Set movie title
730  *
731  * \param p_mi the Media Player
732  * \param i_title title number to play
733  */
734 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
735
736 /**
737  * Get movie title
738  *
739  * \param p_mi the Media Player
740  * \return title number currently playing, or -1
741  */
742 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
743
744 /**
745  * Get movie title count
746  *
747  * \param p_mi the Media Player
748  * \return title number count, or -1
749  */
750 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
751
752 /**
753  * Set previous chapter (if applicable)
754  *
755  * \param p_mi the Media Player
756  */
757 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
758
759 /**
760  * Set next chapter (if applicable)
761  *
762  * \param p_mi the Media Player
763  */
764 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
765
766 /**
767  * Get the requested movie play rate.
768  * @warning Depending on the underlying media, the requested rate may be
769  * different from the real playback rate.
770  *
771  * \param p_mi the Media Player
772  * \return movie play rate
773  */
774 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
775
776 /**
777  * Set movie play rate
778  *
779  * \param p_mi the Media Player
780  * \param rate movie play rate to set
781  * \return -1 if an error was detected, 0 otherwise (but even then, it might
782  * not actually work depending on the underlying media protocol)
783  */
784 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
785
786 /**
787  * Get current movie state
788  *
789  * \param p_mi the Media Player
790  * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
791  */
792 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
793
794 /**
795  * Get movie fps rate
796  *
797  * \param p_mi the Media Player
798  * \return frames per second (fps) for this playing movie, or 0 if unspecified
799  */
800 LIBVLC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
801
802 /** end bug */
803
804 /**
805  * How many video outputs does this media player have?
806  *
807  * \param p_mi the media player
808  * \return the number of video outputs
809  */
810 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
811
812 /**
813  * Is this media player seekable?
814  *
815  * \param p_mi the media player
816  * \return true if the media player can seek
817  *
818  * \libvlc_return_bool
819  */
820 LIBVLC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
821
822 /**
823  * Can this media player be paused?
824  *
825  * \param p_mi the media player
826  * \return true if the media player can pause
827  *
828  * \libvlc_return_bool
829  */
830 LIBVLC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
831
832 /**
833  * Check if the current program is scrambled
834  *
835  * \param p_mi the media player
836  * \return true if the current program is scrambled
837  *
838  * \libvlc_return_bool
839  * \version LibVLC 2.2.0 or later
840  */
841 LIBVLC_API int libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
842
843 /**
844  * Display the next frame (if supported)
845  *
846  * \param p_mi the media player
847  */
848 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
849
850 /**
851  * Navigate through DVD Menu
852  *
853  * \param p_mi the Media Player
854  * \param navigate the Navigation mode
855  * \version libVLC 2.0.0 or later
856  */
857 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
858                                               unsigned navigate );
859
860 /**
861  * Set if, and how, the video title will be shown when media is played.
862  *
863  * \param p_mi the media player
864  * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
865  * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
866  * \version libVLC 2.1.0 or later
867  */
868 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
869
870 /**
871  * Release (free) libvlc_track_description_t
872  *
873  * \param p_track_description the structure to release
874  */
875 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
876
877 /**
878  * \deprecated Use libvlc_track_description_list_release instead
879  */
880 LIBVLC_DEPRECATED LIBVLC_API
881 void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
882
883 /** \defgroup libvlc_video LibVLC video controls
884  * @{
885  */
886
887 /**
888  * Toggle fullscreen status on non-embedded video outputs.
889  *
890  * @warning The same limitations applies to this function
891  * as to libvlc_set_fullscreen().
892  *
893  * \param p_mi the media player
894  */
895 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
896
897 /**
898  * Enable or disable fullscreen.
899  *
900  * @warning With most window managers, only a top-level windows can be in
901  * full-screen mode. Hence, this function will not operate properly if
902  * libvlc_media_player_set_xwindow() was used to embed the video in a
903  * non-top-level window. In that case, the embedding window must be reparented
904  * to the root window <b>before</b> fullscreen mode is enabled. You will want
905  * to reparent it back to its normal parent when disabling fullscreen.
906  *
907  * \param p_mi the media player
908  * \param b_fullscreen boolean for fullscreen status
909  */
910 LIBVLC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
911
912 /**
913  * Get current fullscreen status.
914  *
915  * \param p_mi the media player
916  * \return the fullscreen status (boolean)
917  *
918  * \libvlc_return_bool
919  */
920 LIBVLC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
921
922 /**
923  * Enable or disable key press events handling, according to the LibVLC hotkeys
924  * configuration. By default and for historical reasons, keyboard events are
925  * handled by the LibVLC video widget.
926  *
927  * \note On X11, there can be only one subscriber for key press and mouse
928  * click events per window. If your application has subscribed to those events
929  * for the X window ID of the video widget, then LibVLC will not be able to
930  * handle key presses and mouse clicks in any case.
931  *
932  * \warning This function is only implemented for X11 and Win32 at the moment.
933  *
934  * \param p_mi the media player
935  * \param on true to handle key press events, false to ignore them.
936  */
937 LIBVLC_API
938 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
939
940 /**
941  * Enable or disable mouse click events handling. By default, those events are
942  * handled. This is needed for DVD menus to work, as well as a few video
943  * filters such as "puzzle".
944  *
945  * \see libvlc_video_set_key_input().
946  *
947  * \warning This function is only implemented for X11 and Win32 at the moment.
948  *
949  * \param p_mi the media player
950  * \param on true to handle mouse click events, false to ignore them.
951  */
952 LIBVLC_API
953 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
954
955 /**
956  * Get the pixel dimensions of a video.
957  *
958  * \param p_mi media player
959  * \param num number of the video (starting from, and most commonly 0)
960  * \param px pointer to get the pixel width [OUT]
961  * \param py pointer to get the pixel height [OUT]
962  * \return 0 on success, -1 if the specified video does not exist
963  */
964 LIBVLC_API
965 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
966                            unsigned *px, unsigned *py );
967
968 /**
969  * Get current video height.
970  * \deprecated Use libvlc_video_get_size() instead.
971  *
972  * \param p_mi the media player
973  * \return the video pixel height or 0 if not applicable
974  */
975 LIBVLC_DEPRECATED LIBVLC_API
976 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
977
978 /**
979  * Get current video width.
980  * \deprecated Use libvlc_video_get_size() instead.
981  *
982  * \param p_mi the media player
983  * \return the video pixel width or 0 if not applicable
984  */
985 LIBVLC_DEPRECATED LIBVLC_API
986 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
987
988 /**
989  * Get the mouse pointer coordinates over a video.
990  * Coordinates are expressed in terms of the decoded video resolution,
991  * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
992  * you can query your windowing system directly).
993  *
994  * Either of the coordinates may be negative or larger than the corresponding
995  * dimension of the video, if the cursor is outside the rendering area.
996  *
997  * @warning The coordinates may be out-of-date if the pointer is not located
998  * on the video rendering area. LibVLC does not track the pointer if it is
999  * outside of the video widget.
1000  *
1001  * @note LibVLC does not support multiple pointers (it does of course support
1002  * multiple input devices sharing the same pointer) at the moment.
1003  *
1004  * \param p_mi media player
1005  * \param num number of the video (starting from, and most commonly 0)
1006  * \param px pointer to get the abscissa [OUT]
1007  * \param py pointer to get the ordinate [OUT]
1008  * \return 0 on success, -1 if the specified video does not exist
1009  */
1010 LIBVLC_API
1011 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1012                              int *px, int *py );
1013
1014 /**
1015  * Get the current video scaling factor.
1016  * See also libvlc_video_set_scale().
1017  *
1018  * \param p_mi the media player
1019  * \return the currently configured zoom factor, or 0. if the video is set
1020  * to fit to the output window/drawable automatically.
1021  */
1022 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1023
1024 /**
1025  * Set the video scaling factor. That is the ratio of the number of pixels on
1026  * screen to the number of pixels in the original decoded video in each
1027  * dimension. Zero is a special value; it will adjust the video to the output
1028  * window/drawable (in windowed mode) or the entire screen.
1029  *
1030  * Note that not all video outputs support scaling.
1031  *
1032  * \param p_mi the media player
1033  * \param f_factor the scaling factor, or zero
1034  */
1035 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1036
1037 /**
1038  * Get current video aspect ratio.
1039  *
1040  * \param p_mi the media player
1041  * \return the video aspect ratio or NULL if unspecified
1042  * (the result must be released with free() or libvlc_free()).
1043  */
1044 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1045
1046 /**
1047  * Set new video aspect ratio.
1048  *
1049  * \param p_mi the media player
1050  * \param psz_aspect new video aspect-ratio or NULL to reset to default
1051  * \note Invalid aspect ratios are ignored.
1052  */
1053 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1054
1055 /**
1056  * Get current video subtitle.
1057  *
1058  * \param p_mi the media player
1059  * \return the video subtitle selected, or -1 if none
1060  */
1061 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1062
1063 /**
1064  * Get the number of available video subtitles.
1065  *
1066  * \param p_mi the media player
1067  * \return the number of available video subtitles
1068  */
1069 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1070
1071 /**
1072  * Get the description of available video subtitles.
1073  *
1074  * \param p_mi the media player
1075  * \return list containing description of available video subtitles
1076  */
1077 LIBVLC_API libvlc_track_description_t *
1078         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1079
1080 /**
1081  * Set new video subtitle.
1082  *
1083  * \param p_mi the media player
1084  * \param i_spu video subtitle track to select (i_id from track description)
1085  * \return 0 on success, -1 if out of range
1086  */
1087 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1088
1089 /**
1090  * Set new video subtitle file.
1091  *
1092  * \param p_mi the media player
1093  * \param psz_subtitle new video subtitle file
1094  * \return the success status (boolean)
1095  */
1096 LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
1097
1098 /**
1099  * Get the current subtitle delay. Positive values means subtitles are being
1100  * displayed later, negative values earlier.
1101  *
1102  * \param p_mi media player
1103  * \return time (in microseconds) the display of subtitles is being delayed
1104  * \version LibVLC 2.0.0 or later
1105  */
1106 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1107
1108 /**
1109  * Set the subtitle delay. This affects the timing of when the subtitle will
1110  * be displayed. Positive values result in subtitles being displayed later,
1111  * while negative values will result in subtitles being displayed earlier.
1112  *
1113  * The subtitle delay will be reset to zero each time the media changes.
1114  *
1115  * \param p_mi media player
1116  * \param i_delay time (in microseconds) the display of subtitles should be delayed
1117  * \return 0 on success, -1 on error
1118  * \version LibVLC 2.0.0 or later
1119  */
1120 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1121
1122 /**
1123  * Get the description of available titles.
1124  *
1125  * \param p_mi the media player
1126  * \return list containing description of available titles
1127  */
1128 LIBVLC_API libvlc_track_description_t *
1129         libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
1130
1131 /**
1132  * Get the description of available chapters for specific title.
1133  *
1134  * \param p_mi the media player
1135  * \param i_title selected title
1136  * \return list containing description of available chapter for title i_title
1137  */
1138 LIBVLC_API libvlc_track_description_t *
1139         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
1140
1141 /**
1142  * Get current crop filter geometry.
1143  *
1144  * \param p_mi the media player
1145  * \return the crop filter geometry or NULL if unset
1146  */
1147 LIBVLC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
1148
1149 /**
1150  * Set new crop filter geometry.
1151  *
1152  * \param p_mi the media player
1153  * \param psz_geometry new crop filter geometry (NULL to unset)
1154  */
1155 LIBVLC_API
1156 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
1157
1158 /**
1159  * Get current teletext page requested.
1160  *
1161  * \param p_mi the media player
1162  * \return the current teletext page requested.
1163  */
1164 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1165
1166 /**
1167  * Set new teletext page to retrieve.
1168  *
1169  * \param p_mi the media player
1170  * \param i_page teletex page number requested
1171  */
1172 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1173
1174 /**
1175  * Toggle teletext transparent status on video output.
1176  *
1177  * \param p_mi the media player
1178  */
1179 LIBVLC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
1180
1181 /**
1182  * Get number of available video tracks.
1183  *
1184  * \param p_mi media player
1185  * \return the number of available video tracks (int)
1186  */
1187 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1188
1189 /**
1190  * Get the description of available video tracks.
1191  *
1192  * \param p_mi media player
1193  * \return list with description of available video tracks, or NULL on error
1194  */
1195 LIBVLC_API libvlc_track_description_t *
1196         libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1197
1198 /**
1199  * Get current video track.
1200  *
1201  * \param p_mi media player
1202  * \return the video track ID (int) or -1 if no active input
1203  */
1204 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1205
1206 /**
1207  * Set video track.
1208  *
1209  * \param p_mi media player
1210  * \param i_track the track ID (i_id field from track description)
1211  * \return 0 on success, -1 if out of range
1212  */
1213 LIBVLC_API
1214 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1215
1216 /**
1217  * Take a snapshot of the current video window.
1218  *
1219  * If i_width AND i_height is 0, original size is used.
1220  * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1221  *
1222  * \param p_mi media player instance
1223  * \param num number of video output (typically 0 for the first/only one)
1224  * \param psz_filepath the path where to save the screenshot to
1225  * \param i_width the snapshot's width
1226  * \param i_height the snapshot's height
1227  * \return 0 on success, -1 if the video was not found
1228  */
1229 LIBVLC_API
1230 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1231                                 const char *psz_filepath, unsigned int i_width,
1232                                 unsigned int i_height );
1233
1234 /**
1235  * Enable or disable deinterlace filter
1236  *
1237  * \param p_mi libvlc media player
1238  * \param psz_mode type of deinterlace filter, NULL to disable
1239  */
1240 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1241                                                   const char *psz_mode );
1242
1243 /**
1244  * Get an integer marquee option value
1245  *
1246  * \param p_mi libvlc media player
1247  * \param option marq option to get \see libvlc_video_marquee_int_option_t
1248  */
1249 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1250                                                  unsigned option );
1251
1252 /**
1253  * Get a string marquee option value
1254  *
1255  * \param p_mi libvlc media player
1256  * \param option marq option to get \see libvlc_video_marquee_string_option_t
1257  */
1258 LIBVLC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1259                                                       unsigned option );
1260
1261 /**
1262  * Enable, disable or set an integer marquee option
1263  *
1264  * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1265  * or disabling (arg 0) the marq filter.
1266  *
1267  * \param p_mi libvlc media player
1268  * \param option marq option to set \see libvlc_video_marquee_int_option_t
1269  * \param i_val marq option value
1270  */
1271 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1272                                                   unsigned option, int i_val );
1273
1274 /**
1275  * Set a marquee string option
1276  *
1277  * \param p_mi libvlc media player
1278  * \param option marq option to set \see libvlc_video_marquee_string_option_t
1279  * \param psz_text marq option value
1280  */
1281 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1282                                                      unsigned option, const char *psz_text );
1283
1284 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1285 enum libvlc_video_logo_option_t {
1286     libvlc_logo_enable,
1287     libvlc_logo_file,           /**< string argument, "file,d,t;file,d,t;..." */
1288     libvlc_logo_x,
1289     libvlc_logo_y,
1290     libvlc_logo_delay,
1291     libvlc_logo_repeat,
1292     libvlc_logo_opacity,
1293     libvlc_logo_position
1294 };
1295
1296 /**
1297  * Get integer logo option.
1298  *
1299  * \param p_mi libvlc media player instance
1300  * \param option logo option to get, values of libvlc_video_logo_option_t
1301  */
1302 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1303                                               unsigned option );
1304
1305 /**
1306  * Set logo option as integer. Options that take a different type value
1307  * are ignored.
1308  * Passing libvlc_logo_enable as option value has the side effect of
1309  * starting (arg !0) or stopping (arg 0) the logo filter.
1310  *
1311  * \param p_mi libvlc media player instance
1312  * \param option logo option to set, values of libvlc_video_logo_option_t
1313  * \param value logo option value
1314  */
1315 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1316                                                unsigned option, int value );
1317
1318 /**
1319  * Set logo option as string. Options that take a different type value
1320  * are ignored.
1321  *
1322  * \param p_mi libvlc media player instance
1323  * \param option logo option to set, values of libvlc_video_logo_option_t
1324  * \param psz_value logo option value
1325  */
1326 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1327                                       unsigned option, const char *psz_value );
1328
1329
1330 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1331 enum libvlc_video_adjust_option_t {
1332     libvlc_adjust_Enable = 0,
1333     libvlc_adjust_Contrast,
1334     libvlc_adjust_Brightness,
1335     libvlc_adjust_Hue,
1336     libvlc_adjust_Saturation,
1337     libvlc_adjust_Gamma
1338 };
1339
1340 /**
1341  * Get integer adjust option.
1342  *
1343  * \param p_mi libvlc media player instance
1344  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1345  * \version LibVLC 1.1.1 and later.
1346  */
1347 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1348                                                 unsigned option );
1349
1350 /**
1351  * Set adjust option as integer. Options that take a different type value
1352  * are ignored.
1353  * Passing libvlc_adjust_enable as option value has the side effect of
1354  * starting (arg !0) or stopping (arg 0) the adjust filter.
1355  *
1356  * \param p_mi libvlc media player instance
1357  * \param option adust option to set, values of libvlc_video_adjust_option_t
1358  * \param value adjust option value
1359  * \version LibVLC 1.1.1 and later.
1360  */
1361 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1362                                                  unsigned option, int value );
1363
1364 /**
1365  * Get float adjust option.
1366  *
1367  * \param p_mi libvlc media player instance
1368  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1369  * \version LibVLC 1.1.1 and later.
1370  */
1371 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1372                                                     unsigned option );
1373
1374 /**
1375  * Set adjust option as float. Options that take a different type value
1376  * are ignored.
1377  *
1378  * \param p_mi libvlc media player instance
1379  * \param option adust option to set, values of libvlc_video_adjust_option_t
1380  * \param value adjust option value
1381  * \version LibVLC 1.1.1 and later.
1382  */
1383 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1384                                                    unsigned option, float value );
1385
1386 /** @} video */
1387
1388 /** \defgroup libvlc_audio LibVLC audio controls
1389  * @{
1390  */
1391
1392 /**
1393  * Audio device types
1394  */
1395 typedef enum libvlc_audio_output_device_types_t {
1396     libvlc_AudioOutputDevice_Error  = -1,
1397     libvlc_AudioOutputDevice_Mono   =  1,
1398     libvlc_AudioOutputDevice_Stereo =  2,
1399     libvlc_AudioOutputDevice_2F2R   =  4,
1400     libvlc_AudioOutputDevice_3F2R   =  5,
1401     libvlc_AudioOutputDevice_5_1    =  6,
1402     libvlc_AudioOutputDevice_6_1    =  7,
1403     libvlc_AudioOutputDevice_7_1    =  8,
1404     libvlc_AudioOutputDevice_SPDIF  = 10
1405 } libvlc_audio_output_device_types_t;
1406
1407 /**
1408  * Audio channels
1409  */
1410 typedef enum libvlc_audio_output_channel_t {
1411     libvlc_AudioChannel_Error   = -1,
1412     libvlc_AudioChannel_Stereo  =  1,
1413     libvlc_AudioChannel_RStereo =  2,
1414     libvlc_AudioChannel_Left    =  3,
1415     libvlc_AudioChannel_Right   =  4,
1416     libvlc_AudioChannel_Dolbys  =  5
1417 } libvlc_audio_output_channel_t;
1418
1419
1420 /**
1421  * Gets the list of available audio output modules.
1422  *
1423  * \param p_instance libvlc instance
1424  * \return list of available audio outputs. It must be freed it with
1425 *          \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1426  *         In case of error, NULL is returned.
1427  */
1428 LIBVLC_API libvlc_audio_output_t *
1429 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1430
1431 /**
1432  * Frees the list of available audio output modules.
1433  *
1434  * \param p_list list with audio outputs for release
1435  */
1436 LIBVLC_API
1437 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1438
1439 /**
1440  * Selects an audio output module.
1441  * \note Any change will take be effect only after playback is stopped and
1442  * restarted. Audio output cannot be changed while playing.
1443  *
1444  * \param p_mi media player
1445  * \param psz_name name of audio output,
1446  *               use psz_name of \see libvlc_audio_output_t
1447  * \return 0 if function succeded, -1 on error
1448  */
1449 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1450                                         const char *psz_name );
1451
1452 /**
1453  * Backward compatibility stub. Do not use in new code.
1454  * Use libvlc_audio_output_device_list_get() instead.
1455  * \return always 0.
1456  */
1457 LIBVLC_DEPRECATED LIBVLC_API
1458 int libvlc_audio_output_device_count( libvlc_instance_t *, const char * );
1459
1460 /**
1461  * Backward compatibility stub. Do not use in new code.
1462  * Use libvlc_audio_output_device_list_get() instead.
1463  * \return always NULL.
1464  */
1465 LIBVLC_DEPRECATED LIBVLC_API
1466 char *libvlc_audio_output_device_longname( libvlc_instance_t *, const char *,
1467                                            int );
1468
1469 /**
1470  * Backward compatibility stub. Do not use in new code.
1471  * Use libvlc_audio_output_device_list_get() instead.
1472  * \return always NULL.
1473  */
1474 LIBVLC_DEPRECATED LIBVLC_API
1475 char *libvlc_audio_output_device_id( libvlc_instance_t *, const char *, int );
1476
1477 /**
1478  * Gets a list of potential audio output devices,
1479  * \see libvlc_audio_output_device_set().
1480  *
1481  * \note Not all audio outputs support enumerating devices.
1482  * The audio output may be functional even if the list is empty (NULL).
1483  *
1484  * \note The list may not be exhaustive.
1485  *
1486  * \warning Some audio output devices in the list might not actually work in
1487  * some circumstances. By default, it is recommended to not specify any
1488  * explicit audio device.
1489  *
1490  * \param mp media player
1491  * \return A NULL-terminated linked list of potential audio output devices.
1492  * It must be freed it with libvlc_audio_output_device_list_release()
1493  * \version LibVLC 2.2.0 or later.
1494  */
1495 LIBVLC_API libvlc_audio_output_device_t *
1496 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
1497
1498 /**
1499  * Gets a list of audio output devices for a given audio output module,
1500  * \see libvlc_audio_output_device_set().
1501  *
1502  * \note Not all audio outputs support this. In particular, an empty (NULL)
1503  * list of devices does <b>not</b> imply that the specified audio output does
1504  * not work.
1505  *
1506  * \note The list might not be exhaustive.
1507  *
1508  * \warning Some audio output devices in the list might not actually work in
1509  * some circumstances. By default, it is recommended to not specify any
1510  * explicit audio device.
1511  *
1512  * \param p_instance libvlc instance
1513  * \param psz_aout audio output name
1514  *                 (as returned by libvlc_audio_output_list_get())
1515  * \return A NULL-terminated linked list of potential audio output devices.
1516  * It must be freed it with libvlc_audio_output_device_list_release()
1517  * \version LibVLC 2.1.0 or later.
1518  */
1519 LIBVLC_API libvlc_audio_output_device_t *
1520 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
1521                                      const char *aout );
1522
1523 /**
1524  * Frees a list of available audio output devices.
1525  *
1526  * \param p_list list with audio outputs for release
1527  * \version LibVLC 2.1.0 or later.
1528  */
1529 LIBVLC_API void libvlc_audio_output_device_list_release(
1530                                         libvlc_audio_output_device_t *p_list );
1531
1532 /**
1533  * Configures an explicit audio output device.
1534  *
1535  * If the module paramater is NULL, audio output will be moved to the device
1536  * specified by the device identifier string immediately. This is the
1537  * recommended usage.
1538  *
1539  * A list of adequate potential device strings can be obtained with
1540  * libvlc_audio_output_device_enum().
1541  *
1542  * However passing NULL is supported in LibVLC version 2.2.0 and later only;
1543  * in earlier versions, this function would have no effects when the module
1544  * parameter was NULL.
1545  *
1546  * If the module parameter is not NULL, the device parameter of the
1547  * corresponding audio output, if it exists, will be set to the specified
1548  * string. Note that some audio output modules do not have such a parameter
1549  * (notably MMDevice and PulseAudio).
1550  *
1551  * A list of adequate potential device strings can be obtained with
1552  * libvlc_audio_output_device_list_get().
1553  *
1554  * \note This function does not select the specified audio output plugin.
1555  * libvlc_audio_output_set() is used for that purpose.
1556  *
1557  * \warning The syntax for the device parameter depends on the audio output.
1558  *
1559  * Some audio output modules require further parameters (e.g. a channels map
1560  * in the case of ALSA).
1561  *
1562  * \param mp media player
1563  * \param module If NULL, current audio output module.
1564  *               if non-NULL, name of audio output module
1565                  (\see libvlc_audio_output_t)
1566  * \param device_id device identifier string
1567  * \return Nothing. Errors are ignored (this is a design bug).
1568  */
1569 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
1570                                                 const char *module,
1571                                                 const char *device_id );
1572
1573 /**
1574  * Get the current audio output device identifier.
1575  *
1576  * This complements libvlc_audio_output_device_set().
1577  *
1578  * \warning The initial value for the current audio output device identifier
1579  * may not be set or may be some unknown value. A LibVLC application should
1580  * compare this value against the known device identifiers (e.g. those that
1581  * were previously retrieved by a call to libvlc_audio_output_device_enum or
1582  * libvlc_audio_output_device_list_get) to find the current audio output device.
1583  *
1584  * It is possible that the selected audio output device changes (an external
1585  * change) without a call to libvlc_audio_output_device_set. That may make this
1586  * method unsuitable to use if a LibVLC application is attempting to track
1587  * dynamic audio device changes as they happen.
1588  *
1589  * \param mp media player
1590  * \return the current audio output device identifier
1591  *         NULL if no device is selected or in case of error
1592  *         (the result must be released with free() or libvlc_free()).
1593  * \version LibVLC 3.0.0 or later.
1594  */
1595 LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
1596
1597 /**
1598  * Stub for backward compatibility.
1599  * \return always -1.
1600  */
1601 LIBVLC_DEPRECATED
1602 LIBVLC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1603
1604 /**
1605  * Stub for backward compatibility.
1606  */
1607 LIBVLC_DEPRECATED
1608 LIBVLC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *,
1609                                                      int );
1610
1611
1612 /**
1613  * Toggle mute status.
1614  *
1615  * \param p_mi media player
1616  * \warning Toggling mute atomically is not always possible: On some platforms,
1617  * other processes can mute the VLC audio playback stream asynchronously. Thus,
1618  * there is a small race condition where toggling will not work.
1619  * See also the limitations of libvlc_audio_set_mute().
1620  */
1621 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1622
1623 /**
1624  * Get current mute status.
1625  *
1626  * \param p_mi media player
1627  * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
1628  */
1629 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1630
1631 /**
1632  * Set mute status.
1633  *
1634  * \param p_mi media player
1635  * \param status If status is true then mute, otherwise unmute
1636  * \warning This function does not always work. If there are no active audio
1637  * playback stream, the mute status might not be available. If digital
1638  * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
1639  * some audio output plugins do not support muting at all.
1640  * \note To force silent playback, disable all audio tracks. This is more
1641  * efficient and reliable than mute.
1642  */
1643 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1644
1645 /**
1646  * Get current software audio volume.
1647  *
1648  * \param p_mi media player
1649  * \return the software volume in percents
1650  * (0 = mute, 100 = nominal / 0dB)
1651  */
1652 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1653
1654 /**
1655  * Set current software audio volume.
1656  *
1657  * \param p_mi media player
1658  * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
1659  * \return 0 if the volume was set, -1 if it was out of range
1660  */
1661 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1662
1663 /**
1664  * Get number of available audio tracks.
1665  *
1666  * \param p_mi media player
1667  * \return the number of available audio tracks (int), or -1 if unavailable
1668  */
1669 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1670
1671 /**
1672  * Get the description of available audio tracks.
1673  *
1674  * \param p_mi media player
1675  * \return list with description of available audio tracks, or NULL
1676  */
1677 LIBVLC_API libvlc_track_description_t *
1678         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1679
1680 /**
1681  * Get current audio track.
1682  *
1683  * \param p_mi media player
1684  * \return the audio track ID or -1 if no active input.
1685  */
1686 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1687
1688 /**
1689  * Set current audio track.
1690  *
1691  * \param p_mi media player
1692  * \param i_track the track ID (i_id field from track description)
1693  * \return 0 on success, -1 on error
1694  */
1695 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1696
1697 /**
1698  * Get current audio channel.
1699  *
1700  * \param p_mi media player
1701  * \return the audio channel \see libvlc_audio_output_channel_t
1702  */
1703 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1704
1705 /**
1706  * Set current audio channel.
1707  *
1708  * \param p_mi media player
1709  * \param channel the audio channel, \see libvlc_audio_output_channel_t
1710  * \return 0 on success, -1 on error
1711  */
1712 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1713
1714 /**
1715  * Get current audio delay.
1716  *
1717  * \param p_mi media player
1718  * \return the audio delay (microseconds)
1719  * \version LibVLC 1.1.1 or later
1720  */
1721 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1722
1723 /**
1724  * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1725  *
1726  * \param p_mi media player
1727  * \param i_delay the audio delay (microseconds)
1728  * \return 0 on success, -1 on error
1729  * \version LibVLC 1.1.1 or later
1730  */
1731 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1732
1733 /**
1734  * Get the number of equalizer presets.
1735  *
1736  * \return number of presets
1737  * \version LibVLC 2.2.0 or later
1738  */
1739 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
1740
1741 /**
1742  * Get the name of a particular equalizer preset.
1743  *
1744  * This name can be used, for example, to prepare a preset label or menu in a user
1745  * interface.
1746  *
1747  * \param u_index index of the preset, counting from zero
1748  * \return preset name, or NULL if there is no such preset
1749  * \version LibVLC 2.2.0 or later
1750  */
1751 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
1752
1753 /**
1754  * Get the number of distinct frequency bands for an equalizer.
1755  *
1756  * \return number of frequency bands
1757  * \version LibVLC 2.2.0 or later
1758  */
1759 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
1760
1761 /**
1762  * Get a particular equalizer band frequency.
1763  *
1764  * This value can be used, for example, to create a label for an equalizer band control
1765  * in a user interface.
1766  *
1767  * \param u_index index of the band, counting from zero
1768  * \return equalizer band frequency (Hz), or -1 if there is no such band
1769  * \version LibVLC 2.2.0 or later
1770  */
1771 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
1772
1773 /**
1774  * Create a new default equalizer, with all frequency values zeroed.
1775  *
1776  * The new equalizer can subsequently be applied to a media player by invoking
1777  * libvlc_media_player_set_equalizer().
1778  *
1779  * The returned handle should be freed via libvlc_audio_equalizer_release() when
1780  * it is no longer needed.
1781  *
1782  * \return opaque equalizer handle, or NULL on error
1783  * \version LibVLC 2.2.0 or later
1784  */
1785 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
1786
1787 /**
1788  * Create a new equalizer, with initial frequency values copied from an existing
1789  * preset.
1790  *
1791  * The new equalizer can subsequently be applied to a media player by invoking
1792  * libvlc_media_player_set_equalizer().
1793  *
1794  * The returned handle should be freed via libvlc_audio_equalizer_release() when
1795  * it is no longer needed.
1796  *
1797  * \param u_index index of the preset, counting from zero
1798  * \return opaque equalizer handle, or NULL on error
1799  * \version LibVLC 2.2.0 or later
1800  */
1801 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
1802
1803 /**
1804  * Release a previously created equalizer instance.
1805  *
1806  * The equalizer was previously created by using libvlc_audio_equalizer_new() or
1807  * libvlc_audio_equalizer_new_from_preset().
1808  *
1809  * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
1810  *
1811  * \param p_equalizer opaque equalizer handle, or NULL
1812  * \version LibVLC 2.2.0 or later
1813  */
1814 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
1815
1816 /**
1817  * Set a new pre-amplification value for an equalizer.
1818  *
1819  * The new equalizer settings are subsequently applied to a media player by invoking
1820  * libvlc_media_player_set_equalizer().
1821  *
1822  * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1823  *
1824  * \param p_equalizer valid equalizer handle, must not be NULL
1825  * \param f_preamp preamp value (-20.0 to 20.0 Hz)
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_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
1830
1831 /**
1832  * Get the current pre-amplification value from an equalizer.
1833  *
1834  * \param p_equalizer valid equalizer handle, must not be NULL
1835  * \return preamp value (Hz)
1836  * \version LibVLC 2.2.0 or later
1837  */
1838 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
1839
1840 /**
1841  * Set a new amplification value for a particular equalizer frequency band.
1842  *
1843  * The new equalizer settings are subsequently applied to a media player by invoking
1844  * libvlc_media_player_set_equalizer().
1845  *
1846  * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1847  *
1848  * \param p_equalizer valid equalizer handle, must not be NULL
1849  * \param f_amp amplification value (-20.0 to 20.0 Hz)
1850  * \param u_band index, counting from zero, of the frequency band to set
1851  * \return zero on success, -1 on error
1852  * \version LibVLC 2.2.0 or later
1853  */
1854 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
1855
1856 /**
1857  * Get the amplification value for a particular equalizer frequency band.
1858  *
1859  * \param p_equalizer valid equalizer handle, must not be NULL
1860  * \param u_band index, counting from zero, of the frequency band to get
1861  * \return amplification value (Hz); NaN if there is no such frequency band
1862  * \version LibVLC 2.2.0 or later
1863  */
1864 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
1865
1866 /**
1867  * Apply new equalizer settings to a media player.
1868  *
1869  * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
1870  * libvlc_audio_equalizer_new_from_preset().
1871  *
1872  * It is possible to apply new equalizer settings to a media player whether the media
1873  * player is currently playing media or not.
1874  *
1875  * Invoking this method will immediately apply the new equalizer settings to the audio
1876  * output of the currently playing media if there is any.
1877  *
1878  * If there is no currently playing media, the new equalizer settings will be applied
1879  * later if and when new media is played.
1880  *
1881  * Equalizer settings will automatically be applied to subsequently played media.
1882  *
1883  * To disable the equalizer for a media player invoke this method passing NULL for the
1884  * p_equalizer parameter.
1885  *
1886  * The media player does not keep a reference to the supplied equalizer so it is safe
1887  * for an application to release the equalizer reference any time after this method
1888  * returns.
1889  *
1890  * \param p_mi opaque media player handle
1891  * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
1892  * \return zero on success, -1 on error
1893  * \version LibVLC 2.2.0 or later
1894  */
1895 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
1896
1897 /** @} audio */
1898
1899 /** @} media_player */
1900
1901 # ifdef __cplusplus
1902 }
1903 # endif
1904
1905 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */