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