]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_player.h
529e0fde481572907dd445cc61f60972910dd7d6
[vlc] / include / vlc / libvlc_media_player.h
1 /*****************************************************************************
2  * libvlc_media_player.h:  libvlc_media_player external API
3  *****************************************************************************
4  * Copyright (C) 1998-2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Paul Saman <jpsaman@videolan.org>
9  *          Pierre d'Herbemont <pdherbemont@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 /**
27  * \file
28  * This file defines libvlc_media_player external API
29  */
30
31 #ifndef VLC_LIBVLC_MEDIA_PLAYER_H
32 #define VLC_LIBVLC_MEDIA_PLAYER_H 1
33
34 # ifdef __cplusplus
35 extern "C" {
36 # 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 1.2.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 1.2.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 1.2.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 1.2.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 1.2.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 1.2.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 void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
825
826 /** \defgroup libvlc_video LibVLC video controls
827  * @{
828  */
829
830 /**
831  * Toggle fullscreen status on non-embedded video outputs.
832  *
833  * @warning The same limitations applies to this function
834  * as to libvlc_set_fullscreen().
835  *
836  * \param p_mi the media player
837  */
838 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
839
840 /**
841  * Enable or disable fullscreen.
842  *
843  * @warning With most window managers, only a top-level windows can be in
844  * full-screen mode. Hence, this function will not operate properly if
845  * libvlc_media_player_set_xwindow() was used to embed the video in a
846  * non-top-level window. In that case, the embedding window must be reparented
847  * to the root window <b>before</b> fullscreen mode is enabled. You will want
848  * to reparent it back to its normal parent when disabling fullscreen.
849  *
850  * \param p_mi the media player
851  * \param b_fullscreen boolean for fullscreen status
852  */
853 LIBVLC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
854
855 /**
856  * Get current fullscreen status.
857  *
858  * \param p_mi the media player
859  * \return the fullscreen status (boolean)
860  *
861  * \libvlc_return_bool
862  */
863 LIBVLC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
864
865 /**
866  * Enable or disable key press events handling, according to the LibVLC hotkeys
867  * configuration. By default and for historical reasons, keyboard events are
868  * handled by the LibVLC video widget.
869  *
870  * \note On X11, there can be only one subscriber for key press and mouse
871  * click events per window. If your application has subscribed to those events
872  * for the X window ID of the video widget, then LibVLC will not be able to
873  * handle key presses and mouse clicks in any case.
874  *
875  * \warning This function is only implemented for X11 and Win32 at the moment.
876  *
877  * \param p_mi the media player
878  * \param on true to handle key press events, false to ignore them.
879  */
880 LIBVLC_API
881 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
882
883 /**
884  * Enable or disable mouse click events handling. By default, those events are
885  * handled. This is needed for DVD menus to work, as well as a few video
886  * filters such as "puzzle".
887  *
888  * \see libvlc_video_set_key_input().
889  *
890  * \warning This function is only implemented for X11 and Win32 at the moment.
891  *
892  * \param p_mi the media player
893  * \param on true to handle mouse click events, false to ignore them.
894  */
895 LIBVLC_API
896 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
897
898 /**
899  * Get the pixel dimensions of a video.
900  *
901  * \param p_mi media player
902  * \param num number of the video (starting from, and most commonly 0)
903  * \param px pointer to get the pixel width [OUT]
904  * \param py pointer to get the pixel height [OUT]
905  * \return 0 on success, -1 if the specified video does not exist
906  */
907 LIBVLC_API
908 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
909                            unsigned *px, unsigned *py );
910
911 /**
912  * Get current video height.
913  * \deprecated Use libvlc_video_get_size() instead.
914  *
915  * \param p_mi the media player
916  * \return the video pixel height or 0 if not applicable
917  */
918 LIBVLC_DEPRECATED
919 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
920
921 /**
922  * Get current video width.
923  * \deprecated Use libvlc_video_get_size() instead.
924  *
925  * \param p_mi the media player
926  * \return the video pixel width or 0 if not applicable
927  */
928 LIBVLC_DEPRECATED
929 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
930
931 /**
932  * Get the mouse pointer coordinates over a video.
933  * Coordinates are expressed in terms of the decoded video resolution,
934  * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
935  * you can query your windowing system directly).
936  *
937  * Either of the coordinates may be negative or larger than the corresponding
938  * dimension of the video, if the cursor is outside the rendering area.
939  *
940  * @warning The coordinates may be out-of-date if the pointer is not located
941  * on the video rendering area. LibVLC does not track the pointer if it is
942  * outside of the video widget.
943  *
944  * @note LibVLC does not support multiple pointers (it does of course support
945  * multiple input devices sharing the same pointer) at the moment.
946  *
947  * \param p_mi media player
948  * \param num number of the video (starting from, and most commonly 0)
949  * \param px pointer to get the abscissa [OUT]
950  * \param py pointer to get the ordinate [OUT]
951  * \return 0 on success, -1 if the specified video does not exist
952  */
953 LIBVLC_API
954 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
955                              int *px, int *py );
956
957 /**
958  * Get the current video scaling factor.
959  * See also libvlc_video_set_scale().
960  *
961  * \param p_mi the media player
962  * \return the currently configured zoom factor, or 0. if the video is set
963  * to fit to the output window/drawable automatically.
964  */
965 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
966
967 /**
968  * Set the video scaling factor. That is the ratio of the number of pixels on
969  * screen to the number of pixels in the original decoded video in each
970  * dimension. Zero is a special value; it will adjust the video to the output
971  * window/drawable (in windowed mode) or the entire screen.
972  *
973  * Note that not all video outputs support scaling.
974  *
975  * \param p_mi the media player
976  * \param f_factor the scaling factor, or zero
977  */
978 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
979
980 /**
981  * Get current video aspect ratio.
982  *
983  * \param p_mi the media player
984  * \return the video aspect ratio or NULL if unspecified
985  * (the result must be released with free() or libvlc_free()).
986  */
987 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
988
989 /**
990  * Set new video aspect ratio.
991  *
992  * \param p_mi the media player
993  * \param psz_aspect new video aspect-ratio or NULL to reset to default
994  * \note Invalid aspect ratios are ignored.
995  */
996 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
997
998 /**
999  * Get current video subtitle.
1000  *
1001  * \param p_mi the media player
1002  * \return the video subtitle selected, or -1 if none
1003  */
1004 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1005
1006 /**
1007  * Get the number of available video subtitles.
1008  *
1009  * \param p_mi the media player
1010  * \return the number of available video subtitles
1011  */
1012 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1013
1014 /**
1015  * Get the description of available video subtitles.
1016  *
1017  * \param p_mi the media player
1018  * \return list containing description of available video subtitles
1019  */
1020 LIBVLC_API libvlc_track_description_t *
1021         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1022
1023 /**
1024  * Set new video subtitle.
1025  *
1026  * \param p_mi the media player
1027  * \param i_spu new video subtitle to select
1028  * \return 0 on success, -1 if out of range
1029  */
1030 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, unsigned i_spu );
1031
1032 /**
1033  * Set new video subtitle file.
1034  *
1035  * \param p_mi the media player
1036  * \param psz_subtitle new video subtitle file
1037  * \return the success status (boolean)
1038  */
1039 LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
1040
1041 /**
1042  * Get the description of available titles.
1043  *
1044  * \param p_mi the media player
1045  * \return list containing description of available titles
1046  */
1047 LIBVLC_API libvlc_track_description_t *
1048         libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
1049
1050 /**
1051  * Get the description of available chapters for specific title.
1052  *
1053  * \param p_mi the media player
1054  * \param i_title selected title
1055  * \return list containing description of available chapter for title i_title
1056  */
1057 LIBVLC_API libvlc_track_description_t *
1058         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
1059
1060 /**
1061  * Get current crop filter geometry.
1062  *
1063  * \param p_mi the media player
1064  * \return the crop filter geometry or NULL if unset
1065  */
1066 LIBVLC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
1067
1068 /**
1069  * Set new crop filter geometry.
1070  *
1071  * \param p_mi the media player
1072  * \param psz_geometry new crop filter geometry (NULL to unset)
1073  */
1074 LIBVLC_API
1075 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
1076
1077 /**
1078  * Get current teletext page requested.
1079  *
1080  * \param p_mi the media player
1081  * \return the current teletext page requested.
1082  */
1083 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1084
1085 /**
1086  * Set new teletext page to retrieve.
1087  *
1088  * \param p_mi the media player
1089  * \param i_page teletex page number requested
1090  */
1091 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1092
1093 /**
1094  * Toggle teletext transparent status on video output.
1095  *
1096  * \param p_mi the media player
1097  */
1098 LIBVLC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
1099
1100 /**
1101  * Get number of available video tracks.
1102  *
1103  * \param p_mi media player
1104  * \return the number of available video tracks (int)
1105  */
1106 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1107
1108 /**
1109  * Get the description of available video tracks.
1110  *
1111  * \param p_mi media player
1112  * \return list with description of available video tracks, or NULL on error
1113  */
1114 LIBVLC_API libvlc_track_description_t *
1115         libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1116
1117 /**
1118  * Get current video track.
1119  *
1120  * \param p_mi media player
1121  * \return the video track (int) or -1 if none
1122  */
1123 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1124
1125 /**
1126  * Set video track.
1127  *
1128  * \param p_mi media player
1129  * \param i_track the track (int)
1130  * \return 0 on success, -1 if out of range
1131  */
1132 LIBVLC_API
1133 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1134
1135 /**
1136  * Take a snapshot of the current video window.
1137  *
1138  * If i_width AND i_height is 0, original size is used.
1139  * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1140  *
1141  * \param p_mi media player instance
1142  * \param num number of video output (typically 0 for the first/only one)
1143  * \param psz_filepath the path where to save the screenshot to
1144  * \param i_width the snapshot's width
1145  * \param i_height the snapshot's height
1146  * \return 0 on success, -1 if the video was not found
1147  */
1148 LIBVLC_API
1149 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1150                                 const char *psz_filepath, unsigned int i_width,
1151                                 unsigned int i_height );
1152
1153 /**
1154  * Enable or disable deinterlace filter
1155  *
1156  * \param p_mi libvlc media player
1157  * \param psz_mode type of deinterlace filter, NULL to disable
1158  */
1159 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1160                                                   const char *psz_mode );
1161
1162 /**
1163  * Get an integer marquee option value
1164  *
1165  * \param p_mi libvlc media player
1166  * \param option marq option to get \see libvlc_video_marquee_int_option_t
1167  */
1168 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1169                                                  unsigned option );
1170
1171 /**
1172  * Get a string marquee option value
1173  *
1174  * \param p_mi libvlc media player
1175  * \param option marq option to get \see libvlc_video_marquee_string_option_t
1176  */
1177 LIBVLC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1178                                                       unsigned option );
1179
1180 /**
1181  * Enable, disable or set an integer marquee option
1182  *
1183  * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1184  * or disabling (arg 0) the marq filter.
1185  *
1186  * \param p_mi libvlc media player
1187  * \param option marq option to set \see libvlc_video_marquee_int_option_t
1188  * \param i_val marq option value
1189  */
1190 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1191                                                   unsigned option, int i_val );
1192
1193 /**
1194  * Set a marquee string option
1195  *
1196  * \param p_mi libvlc media player
1197  * \param option marq option to set \see libvlc_video_marquee_string_option_t
1198  * \param psz_text marq option value
1199  */
1200 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1201                                                      unsigned option, const char *psz_text );
1202
1203 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1204 enum libvlc_video_logo_option_t {
1205     libvlc_logo_enable,
1206     libvlc_logo_file,           /**< string argument, "file,d,t;file,d,t;..." */
1207     libvlc_logo_x,
1208     libvlc_logo_y,
1209     libvlc_logo_delay,
1210     libvlc_logo_repeat,
1211     libvlc_logo_opacity,
1212     libvlc_logo_position
1213 };
1214
1215 /**
1216  * Get integer logo option.
1217  *
1218  * \param p_mi libvlc media player instance
1219  * \param option logo option to get, values of libvlc_video_logo_option_t
1220  */
1221 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1222                                               unsigned option );
1223
1224 /**
1225  * Set logo option as integer. Options that take a different type value
1226  * are ignored.
1227  * Passing libvlc_logo_enable as option value has the side effect of
1228  * starting (arg !0) or stopping (arg 0) the logo filter.
1229  *
1230  * \param p_mi libvlc media player instance
1231  * \param option logo option to set, values of libvlc_video_logo_option_t
1232  * \param value logo option value
1233  */
1234 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1235                                                unsigned option, int value );
1236
1237 /**
1238  * Set logo option as string. Options that take a different type value
1239  * are ignored.
1240  *
1241  * \param p_mi libvlc media player instance
1242  * \param option logo option to set, values of libvlc_video_logo_option_t
1243  * \param psz_value logo option value
1244  */
1245 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1246                                       unsigned option, const char *psz_value );
1247
1248
1249 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1250 enum libvlc_video_adjust_option_t {
1251     libvlc_adjust_Enable = 0,
1252     libvlc_adjust_Contrast,
1253     libvlc_adjust_Brightness,
1254     libvlc_adjust_Hue,
1255     libvlc_adjust_Saturation,
1256     libvlc_adjust_Gamma
1257 };
1258
1259 /**
1260  * Get integer adjust option.
1261  *
1262  * \param p_mi libvlc media player instance
1263  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1264  * \version LibVLC 1.1.1 and later.
1265  */
1266 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1267                                                 unsigned option );
1268
1269 /**
1270  * Set adjust option as integer. Options that take a different type value
1271  * are ignored.
1272  * Passing libvlc_adjust_enable as option value has the side effect of
1273  * starting (arg !0) or stopping (arg 0) the adjust filter.
1274  *
1275  * \param p_mi libvlc media player instance
1276  * \param option adust option to set, values of libvlc_video_adjust_option_t
1277  * \param value adjust option value
1278  * \version LibVLC 1.1.1 and later.
1279  */
1280 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1281                                                  unsigned option, int value );
1282
1283 /**
1284  * Get float adjust option.
1285  *
1286  * \param p_mi libvlc media player instance
1287  * \param option adjust option to get, values of libvlc_video_adjust_option_t
1288  * \version LibVLC 1.1.1 and later.
1289  */
1290 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1291                                                     unsigned option );
1292
1293 /**
1294  * Set adjust option as float. Options that take a different type value
1295  * are ignored.
1296  *
1297  * \param p_mi libvlc media player instance
1298  * \param option adust option to set, values of libvlc_video_adjust_option_t
1299  * \param value adjust option value
1300  * \version LibVLC 1.1.1 and later.
1301  */
1302 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1303                                                    unsigned option, float value );
1304
1305 /** @} video */
1306
1307 /** \defgroup libvlc_audio LibVLC audio controls
1308  * @{
1309  */
1310
1311 /**
1312  * Audio device types
1313  */
1314 typedef enum libvlc_audio_output_device_types_t {
1315     libvlc_AudioOutputDevice_Error  = -1,
1316     libvlc_AudioOutputDevice_Mono   =  1,
1317     libvlc_AudioOutputDevice_Stereo =  2,
1318     libvlc_AudioOutputDevice_2F2R   =  4,
1319     libvlc_AudioOutputDevice_3F2R   =  5,
1320     libvlc_AudioOutputDevice_5_1    =  6,
1321     libvlc_AudioOutputDevice_6_1    =  7,
1322     libvlc_AudioOutputDevice_7_1    =  8,
1323     libvlc_AudioOutputDevice_SPDIF  = 10
1324 } libvlc_audio_output_device_types_t;
1325
1326 /**
1327  * Audio channels
1328  */
1329 typedef enum libvlc_audio_output_channel_t {
1330     libvlc_AudioChannel_Error   = -1,
1331     libvlc_AudioChannel_Stereo  =  1,
1332     libvlc_AudioChannel_RStereo =  2,
1333     libvlc_AudioChannel_Left    =  3,
1334     libvlc_AudioChannel_Right   =  4,
1335     libvlc_AudioChannel_Dolbys  =  5
1336 } libvlc_audio_output_channel_t;
1337
1338
1339 /**
1340  * Get the list of available audio outputs
1341  *
1342  * \param p_instance libvlc instance
1343  * \return list of available audio outputs. It must be freed it with
1344 *          \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1345  *         In case of error, NULL is returned.
1346  */
1347 LIBVLC_API libvlc_audio_output_t *
1348         libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1349
1350 /**
1351  * Free the list of available audio outputs
1352  *
1353  * \param p_list list with audio outputs for release
1354  */
1355 LIBVLC_API void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1356
1357 /**
1358  * Set the audio output.
1359  * Change will be applied after stop and play.
1360  *
1361  * \param p_mi media player
1362  * \param psz_name name of audio output,
1363  *               use psz_name of \see libvlc_audio_output_t
1364  * \return 0 if function succeded, -1 on error
1365  */
1366 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1367                                             const char *psz_name );
1368
1369 /**
1370  * Get count of devices for audio output, these devices are hardware oriented
1371  * like analor or digital output of sound card
1372  *
1373  * \param p_instance libvlc instance
1374  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1375  * \return number of devices
1376  */
1377 LIBVLC_API int libvlc_audio_output_device_count( libvlc_instance_t *p_instance,
1378                                                      const char *psz_audio_output );
1379
1380 /**
1381  * Get long name of device, if not available short name given
1382  *
1383  * \param p_instance libvlc instance
1384  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1385  * \param i_device device index
1386  * \return long name of device
1387  */
1388 LIBVLC_API char * libvlc_audio_output_device_longname( libvlc_instance_t *p_instance,
1389                                                            const char *psz_audio_output,
1390                                                            int i_device );
1391
1392 /**
1393  * Get id name of device
1394  *
1395  * \param p_instance libvlc instance
1396  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1397  * \param i_device device index
1398  * \return id name of device, use for setting device, need to be free after use
1399  */
1400 LIBVLC_API char * libvlc_audio_output_device_id( libvlc_instance_t *p_instance,
1401                                                      const char *psz_audio_output,
1402                                                      int i_device );
1403
1404 /**
1405  * Set audio output device. Changes are only effective after stop and play.
1406  *
1407  * \param p_mi media player
1408  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1409  * \param psz_device_id device
1410  */
1411 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *p_mi,
1412                                                     const char *psz_audio_output,
1413                                                     const char *psz_device_id );
1414
1415 /**
1416  * Get current audio device type. Device type describes something like
1417  * character of output sound - stereo sound, 2.1, 5.1 etc
1418  *
1419  * \param p_mi media player
1420  * \return the audio devices type \see libvlc_audio_output_device_types_t
1421  */
1422 LIBVLC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1423
1424 /**
1425  * Set current audio device type.
1426  *
1427  * \param p_mi vlc instance
1428  * \param device_type the audio device type,
1429           according to \see libvlc_audio_output_device_types_t
1430  */
1431 LIBVLC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *p_mi,
1432                                                          int device_type );
1433
1434
1435 /**
1436  * Toggle mute status.
1437  *
1438  * \param p_mi media player
1439  */
1440 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1441
1442 /**
1443  * Get current mute status.
1444  *
1445  * \param p_mi media player
1446  * \return the mute status (boolean)
1447  *
1448  * \libvlc_return_bool
1449  */
1450 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1451
1452 /**
1453  * Set mute status.
1454  *
1455  * \param p_mi media player
1456  * \param status If status is true then mute, otherwise unmute
1457  */
1458 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1459
1460 /**
1461  * Get current software audio volume.
1462  *
1463  * \param p_mi media player
1464  * \return the software volume in percents
1465  * (0 = mute, 100 = nominal / 0dB)
1466  */
1467 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1468
1469 /**
1470  * Set current software audio volume.
1471  *
1472  * \param p_mi media player
1473  * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
1474  * \return 0 if the volume was set, -1 if it was out of range
1475  */
1476 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1477
1478 /**
1479  * Get number of available audio tracks.
1480  *
1481  * \param p_mi media player
1482  * \return the number of available audio tracks (int), or -1 if unavailable
1483  */
1484 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1485
1486 /**
1487  * Get the description of available audio tracks.
1488  *
1489  * \param p_mi media player
1490  * \return list with description of available audio tracks, or NULL
1491  */
1492 LIBVLC_API libvlc_track_description_t *
1493         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1494
1495 /**
1496  * Get current audio track.
1497  *
1498  * \param p_mi media player
1499  * \return the audio track (int), or -1 if none.
1500  */
1501 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1502
1503 /**
1504  * Set current audio track.
1505  *
1506  * \param p_mi media player
1507  * \param i_track the track (int)
1508  * \return 0 on success, -1 on error
1509  */
1510 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1511
1512 /**
1513  * Get current audio channel.
1514  *
1515  * \param p_mi media player
1516  * \return the audio channel \see libvlc_audio_output_channel_t
1517  */
1518 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1519
1520 /**
1521  * Set current audio channel.
1522  *
1523  * \param p_mi media player
1524  * \param channel the audio channel, \see libvlc_audio_output_channel_t
1525  * \return 0 on success, -1 on error
1526  */
1527 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1528
1529 /**
1530  * Get current audio delay.
1531  *
1532  * \param p_mi media player
1533  * \return the audio delay (microseconds)
1534  * \version LibVLC 1.1.1 or later
1535  */
1536 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1537
1538 /**
1539  * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1540  *
1541  * \param p_mi media player
1542  * \param i_delay the audio delay (microseconds)
1543  * \return 0 on success, -1 on error
1544  * \version LibVLC 1.1.1 or later
1545  */
1546 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1547
1548 /** @} audio */
1549
1550 /** @} media_player */
1551
1552 # ifdef __cplusplus
1553 }
1554 # endif
1555
1556 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */