lib: player: stop_async: return a status
[vlc.git] / include / vlc / libvlc_media_player.h
blob7c72c9774b22eac9b5b8f7fdea67b65803626515
1 /*****************************************************************************
2 * libvlc_media_player.h: libvlc_media_player external API
3 *****************************************************************************
4 * Copyright (C) 1998-2015 VLC authors and VideoLAN
6 * Authors: Clément Stenac <zorglub@videolan.org>
7 * Jean-Paul Saman <jpsaman@videolan.org>
8 * Pierre d'Herbemont <pdherbemont@videolan.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef VLC_LIBVLC_MEDIA_PLAYER_H
26 #define VLC_LIBVLC_MEDIA_PLAYER_H 1
28 # ifdef __cplusplus
29 extern "C" {
30 # else
31 # include <stdbool.h>
32 # endif
34 /** \defgroup libvlc_media_player LibVLC media player
35 * \ingroup libvlc
36 * A LibVLC media player plays one media (usually in a custom drawable).
37 * @{
38 * \file
39 * LibVLC simple media player external API
42 typedef struct libvlc_media_player_t libvlc_media_player_t;
44 /**
45 * Description for video, audio tracks and subtitles. It contains
46 * id, name (description string) and pointer to next record.
48 typedef struct libvlc_track_description_t
50 int i_id;
51 char *psz_name;
52 struct libvlc_track_description_t *p_next;
54 } libvlc_track_description_t;
56 /**
57 * Description for titles
59 enum
61 libvlc_title_menu = 0x01,
62 libvlc_title_interactive = 0x02
65 typedef struct libvlc_title_description_t
67 int64_t i_duration; /**< duration in milliseconds */
68 char *psz_name; /**< title name */
69 unsigned i_flags; /**< info if item was recognized as a menu, interactive or plain content by the demuxer */
70 } libvlc_title_description_t;
72 /**
73 * Description for chapters
75 typedef struct libvlc_chapter_description_t
77 int64_t i_time_offset; /**< time-offset of the chapter in milliseconds */
78 int64_t i_duration; /**< duration of the chapter in milliseconds */
79 char *psz_name; /**< chapter name */
80 } libvlc_chapter_description_t;
82 /**
83 * Description for audio output. It contains
84 * name, description and pointer to next record.
86 typedef struct libvlc_audio_output_t
88 char *psz_name;
89 char *psz_description;
90 struct libvlc_audio_output_t *p_next;
92 } libvlc_audio_output_t;
94 /**
95 * Description for audio output device.
97 typedef struct libvlc_audio_output_device_t
99 struct libvlc_audio_output_device_t *p_next; /**< Next entry in list */
100 char *psz_device; /**< Device identifier string */
101 char *psz_description; /**< User-friendly device description */
102 /* More fields may be added here in later versions */
103 } libvlc_audio_output_device_t;
106 * Marq options definition
108 typedef enum libvlc_video_marquee_option_t {
109 libvlc_marquee_Enable = 0,
110 libvlc_marquee_Text, /** string argument */
111 libvlc_marquee_Color,
112 libvlc_marquee_Opacity,
113 libvlc_marquee_Position,
114 libvlc_marquee_Refresh,
115 libvlc_marquee_Size,
116 libvlc_marquee_Timeout,
117 libvlc_marquee_X,
118 libvlc_marquee_Y
119 } libvlc_video_marquee_option_t;
122 * Navigation mode
124 typedef enum libvlc_navigate_mode_t
126 libvlc_navigate_activate = 0,
127 libvlc_navigate_up,
128 libvlc_navigate_down,
129 libvlc_navigate_left,
130 libvlc_navigate_right,
131 libvlc_navigate_popup
132 } libvlc_navigate_mode_t;
135 * Enumeration of values used to set position (e.g. of video title).
137 typedef enum libvlc_position_t {
138 libvlc_position_disable=-1,
139 libvlc_position_center,
140 libvlc_position_left,
141 libvlc_position_right,
142 libvlc_position_top,
143 libvlc_position_top_left,
144 libvlc_position_top_right,
145 libvlc_position_bottom,
146 libvlc_position_bottom_left,
147 libvlc_position_bottom_right
148 } libvlc_position_t;
151 * Enumeration of teletext keys than can be passed via
152 * libvlc_video_set_teletext()
154 typedef enum libvlc_teletext_key_t {
155 libvlc_teletext_key_red = 'r' << 16,
156 libvlc_teletext_key_green = 'g' << 16,
157 libvlc_teletext_key_yellow = 'y' << 16,
158 libvlc_teletext_key_blue = 'b' << 16,
159 libvlc_teletext_key_index = 'i' << 16,
160 } libvlc_teletext_key_t;
163 * Opaque equalizer handle.
165 * Equalizer settings can be applied to a media player.
167 typedef struct libvlc_equalizer_t libvlc_equalizer_t;
170 * Create an empty Media Player object
172 * \param p_libvlc_instance the libvlc instance in which the Media Player
173 * should be created.
174 * \return a new media player object, or NULL on error.
175 * It must be released by libvlc_media_player_release().
177 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
180 * Create a Media Player object from a Media
182 * \param p_md the media. Afterwards the p_md can be safely
183 * destroyed.
184 * \return a new media player object, or NULL on error.
185 * It must be released by libvlc_media_player_release().
187 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
190 * Release a media_player after use
191 * Decrement the reference count of a media player object. If the
192 * reference count is 0, then libvlc_media_player_release() will
193 * release the media player object. If the media player object
194 * has been released, then it should not be used again.
196 * \param p_mi the Media Player to free
198 LIBVLC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
201 * Retain a reference to a media player object. Use
202 * libvlc_media_player_release() to decrement reference count.
204 * \param p_mi media player object
206 LIBVLC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
209 * Set the media that will be used by the media_player. If any,
210 * previous md will be released.
212 * \param p_mi the Media Player
213 * \param p_md the Media. Afterwards the p_md can be safely
214 * destroyed.
216 LIBVLC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
217 libvlc_media_t *p_md );
220 * Get the media used by the media_player.
222 * \param p_mi the Media Player
223 * \return the media associated with p_mi, or NULL if no
224 * media is associated
226 LIBVLC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
229 * Get the Event Manager from which the media player send event.
231 * \param p_mi the Media Player
232 * \return the event manager associated with p_mi
234 LIBVLC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
237 * is_playing
239 * \param p_mi the Media Player
240 * \retval true media player is playing
241 * \retval false media player is not playing
243 LIBVLC_API bool libvlc_media_player_is_playing(libvlc_media_player_t *p_mi);
246 * Play
248 * \param p_mi the Media Player
249 * \return 0 if playback started (and was already started), or -1 on error.
251 LIBVLC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
254 * Pause or resume (no effect if there is no media)
256 * \param mp the Media Player
257 * \param do_pause play/resume if zero, pause if non-zero
258 * \version LibVLC 1.1.1 or later
260 LIBVLC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
261 int do_pause );
264 * Toggle pause (no effect if there is no media)
266 * \param p_mi the Media Player
268 LIBVLC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
271 * Stop asynchronously
273 * \note This function is asynchronous. In case of success, the user should
274 * wait for the libvlc_MediaPlayerStopped event to know when the stop is
275 * finished.
277 * \param p_mi the Media Player
278 * \return 0 if the player is being stopped, -1 otherwise (no-op)
279 * \version LibVLC 4.0.0 or later
281 LIBVLC_API int libvlc_media_player_stop_async ( libvlc_media_player_t *p_mi );
284 * Set a renderer to the media player
286 * \note must be called before the first call of libvlc_media_player_play() to
287 * take effect.
289 * \see libvlc_renderer_discoverer_new
291 * \param p_mi the Media Player
292 * \param p_item an item discovered by libvlc_renderer_discoverer_start()
293 * \return 0 on success, -1 on error.
294 * \version LibVLC 3.0.0 or later
296 LIBVLC_API int libvlc_media_player_set_renderer( libvlc_media_player_t *p_mi,
297 libvlc_renderer_item_t *p_item );
300 * Enumeration of the Video color primaries.
302 typedef enum libvlc_video_color_primaries_t {
303 libvlc_video_primaries_BT601_525 = 1,
304 libvlc_video_primaries_BT601_625 = 2,
305 libvlc_video_primaries_BT709 = 3,
306 libvlc_video_primaries_BT2020 = 4,
307 libvlc_video_primaries_DCI_P3 = 5,
308 libvlc_video_primaries_BT470_M = 6,
309 } libvlc_video_color_primaries_t;
312 * Enumeration of the Video color spaces.
314 typedef enum libvlc_video_color_space_t {
315 libvlc_video_colorspace_BT601 = 1,
316 libvlc_video_colorspace_BT709 = 2,
317 libvlc_video_colorspace_BT2020 = 3,
318 } libvlc_video_color_space_t;
321 * Enumeration of the Video transfer functions.
323 typedef enum libvlc_video_transfer_func_t {
324 libvlc_video_transfer_func_LINEAR = 1,
325 libvlc_video_transfer_func_SRGB = 2,
326 libvlc_video_transfer_func_BT470_BG = 3,
327 libvlc_video_transfer_func_BT470_M = 4,
328 libvlc_video_transfer_func_BT709 = 5,
329 libvlc_video_transfer_func_PQ = 6,
330 libvlc_video_transfer_func_SMPTE_240 = 7,
331 libvlc_video_transfer_func_HLG = 8,
332 } libvlc_video_transfer_func_t;
336 * Callback prototype to allocate and lock a picture buffer.
338 * Whenever a new video frame needs to be decoded, the lock callback is
339 * invoked. Depending on the video chroma, one or three pixel planes of
340 * adequate dimensions must be returned via the second parameter. Those
341 * planes must be aligned on 32-bytes boundaries.
343 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
344 * \param planes start address of the pixel planes (LibVLC allocates the array
345 * of void pointers, this callback must initialize the array) [OUT]
346 * \return a private pointer for the display and unlock callbacks to identify
347 * the picture buffers
349 typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
352 * Callback prototype to unlock a picture buffer.
354 * When the video frame decoding is complete, the unlock callback is invoked.
355 * This callback might not be needed at all. It is only an indication that the
356 * application can now read the pixel values if it needs to.
358 * \note A picture buffer is unlocked after the picture is decoded,
359 * but before the picture is displayed.
361 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
362 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
363 * callback [IN]
364 * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
365 * callback (this parameter is only for convenience) [IN]
367 typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
368 void *const *planes);
371 * Callback prototype to display a picture.
373 * When the video frame needs to be shown, as determined by the media playback
374 * clock, the display callback is invoked.
376 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
377 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
378 * callback [IN]
380 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
383 * Callback prototype to configure picture buffers format.
384 * This callback gets the format of the video as output by the video decoder
385 * and the chain of video filters (if any). It can opt to change any parameter
386 * as it needs. In that case, LibVLC will attempt to convert the video format
387 * (rescaling and chroma conversion) but these operations can be CPU intensive.
389 * \param opaque pointer to the private pointer passed to
390 * libvlc_video_set_callbacks() [IN/OUT]
391 * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
392 * \param width pointer to the buffer width in pixels[IN/OUT]
393 * \param height pointer to the buffer height in pixels[IN/OUT]
394 * \param pitches table of scanline pitches in bytes for each pixel plane
395 * (the table is allocated by LibVLC) [OUT]
396 * \param lines table of scanlines count for each plane [OUT]
397 * \return the number of picture buffers allocated, 0 indicates failure
399 * \version LibVLC 4.0.0 and later.
400 * \param (width+1) - pointer to display width in pixels[IN]
401 * \param (height+1) - pointer to display height in pixels[IN]
403 * \note
404 * For each pixels plane, the scanline pitch must be bigger than or equal to
405 * the number of bytes per pixel multiplied by the pixel width.
406 * Similarly, the number of scanlines must be bigger than of equal to
407 * the pixel height.
408 * Furthermore, we recommend that pitches and lines be multiple of 32
409 * to not break assumptions that might be held by optimized code
410 * in the video decoders, video filters and/or video converters.
412 typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
413 unsigned *width, unsigned *height,
414 unsigned *pitches,
415 unsigned *lines);
418 * Callback prototype to configure picture buffers format.
420 * \param opaque private pointer as passed to libvlc_video_set_callbacks()
421 * (and possibly modified by @ref libvlc_video_format_cb) [IN]
423 typedef void (*libvlc_video_cleanup_cb)(void *opaque);
427 * Set callbacks and private data to render decoded video to a custom area
428 * in memory.
429 * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
430 * to configure the decoded format.
432 * \warning Rendering video into custom memory buffers is considerably less
433 * efficient than rendering in a custom window as normal.
435 * For optimal perfomances, VLC media player renders into a custom window, and
436 * does not use this function and associated callbacks. It is <b>highly
437 * recommended</b> that other LibVLC-based application do likewise.
438 * To embed video in a window, use libvlc_media_player_set_xid() or equivalent
439 * depending on the operating system.
441 * If window embedding does not fit the application use case, then a custom
442 * LibVLC video output display plugin is required to maintain optimal video
443 * rendering performances.
445 * The following limitations affect performance:
446 * - Hardware video decoding acceleration will either be disabled completely,
447 * or require (relatively slow) copy from video/DSP memory to main memory.
448 * - Sub-pictures (subtitles, on-screen display, etc.) must be blent into the
449 * main picture by the CPU instead of the GPU.
450 * - Depending on the video format, pixel format conversion, picture scaling,
451 * cropping and/or picture re-orientation, must be performed by the CPU
452 * instead of the GPU.
453 * - Memory copying is required between LibVLC reference picture buffers and
454 * application buffers (between lock and unlock callbacks).
456 * \param mp the media player
457 * \param lock callback to lock video memory (must not be NULL)
458 * \param unlock callback to unlock video memory (or NULL if not needed)
459 * \param display callback to display video (or NULL if not needed)
460 * \param opaque private pointer for the three callbacks (as first parameter)
461 * \version LibVLC 1.1.1 or later
463 LIBVLC_API
464 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
465 libvlc_video_lock_cb lock,
466 libvlc_video_unlock_cb unlock,
467 libvlc_video_display_cb display,
468 void *opaque );
471 * Set decoded video chroma and dimensions.
472 * This only works in combination with libvlc_video_set_callbacks(),
473 * and is mutually exclusive with libvlc_video_set_format_callbacks().
475 * \param mp the media player
476 * \param chroma a four-characters string identifying the chroma
477 * (e.g. "RV32" or "YUYV")
478 * \param width pixel width
479 * \param height pixel height
480 * \param pitch line pitch (in bytes)
481 * \version LibVLC 1.1.1 or later
482 * \bug All pixel planes are expected to have the same pitch.
483 * To use the YCbCr color space with chrominance subsampling,
484 * consider using libvlc_video_set_format_callbacks() instead.
486 LIBVLC_API
487 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
488 unsigned width, unsigned height,
489 unsigned pitch );
492 * Set decoded video chroma and dimensions. This only works in combination with
493 * libvlc_video_set_callbacks().
495 * \param mp the media player
496 * \param setup callback to select the video format (cannot be NULL)
497 * \param cleanup callback to release any allocated resources (or NULL)
498 * \version LibVLC 2.0.0 or later
500 LIBVLC_API
501 void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
502 libvlc_video_format_cb setup,
503 libvlc_video_cleanup_cb cleanup );
507 * Callback prototype called to initialize user data.
509 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
510 * \return true on success
511 * \version LibVLC 4.0.0 or later
513 typedef bool (*libvlc_video_setup_cb)(void* opaque);
517 * Callback prototype called to release user data
519 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
520 * \version LibVLC 4.0.0 or later
522 typedef void (*libvlc_video_cleanup_cb)(void* opaque);
525 * Callback prototype called on video size changes
527 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
528 * \param width video width in pixel [IN]
529 * \param height video height in pixel [IN]
530 * \version LibVLC 4.0.0 or later
532 typedef void (*libvlc_video_update_output_cb)(void* opaque, unsigned width, unsigned height);
536 * Callback prototype called after performing drawing calls.
538 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
539 * \version LibVLC 4.0.0 or later
541 typedef void (*libvlc_video_swap_cb)(void* opaque);
544 * Callback prototype to set up the OpenGL context for rendering
546 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
547 * \param enter true to set the context as current, false to unset it [IN]
548 * \return true on success
549 * \version LibVLC 4.0.0 or later
551 typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter);
554 * Callback prototype to load opengl functions
556 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
557 * \param fct_name name of the opengl function to load
558 * \return a pointer to the named OpenGL function the NULL otherwise
559 * \version LibVLC 4.0.0 or later
561 typedef void* (*libvlc_video_getProcAddress_cb)(void* opaque, const char* fct_name);
564 * Enumeration of the Video engine to be used on output.
565 * can be passed to @a libvlc_video_set_output_callbacks
567 typedef enum libvlc_video_engine_t {
568 libvlc_video_engine_opengl,
569 libvlc_video_engine_gles2,
570 } libvlc_video_engine_t;
573 * Set callbacks and data to render decoded video to a custom texture
575 * \warning VLC will perform video rendering in its own thread and at its own rate,
576 * You need to provide your own synchronisation mechanism.
578 * OpenGL context need to be created before playing a media.
580 * \param mp the media player
581 * \param engine the GPU engine to use
582 * \param setup_cb callback called to initialize user data
583 * \param cleanup_cb callback called to clean up user data
584 * \param update_output_cb callback called to get the size of the video
585 * \param swap_cb callback called after rendering a video frame (cannot be NULL)
586 * \param makeCurrent_cb callback called to enter/leave the opengl context (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
587 * \param getProcAddress_cb opengl function loading callback (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
588 * \param opaque private pointer passed to callbacks
590 * \retval true engine selected and callbacks set
591 * \retval false engine type unknown, callbacks not set
592 * \version LibVLC 4.0.0 or later
594 LIBVLC_API
595 bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
596 libvlc_video_engine_t engine,
597 libvlc_video_setup_cb setup_cb,
598 libvlc_video_cleanup_cb cleanup_cb,
599 libvlc_video_update_output_cb update_output_cb,
600 libvlc_video_swap_cb swap_cb,
601 libvlc_video_makeCurrent_cb makeCurrent_cb,
602 libvlc_video_getProcAddress_cb getProcAddress_cb,
603 void* opaque );
607 * Enumeration of the Video engine to be used on output.
608 * can be passed to @a libvlc_video_direct3d_set_callbacks
610 typedef enum libvlc_video_direct3d_engine_t {
611 /** Direct3D11 rendering engine */
612 libvlc_video_direct3d_engine_d3d11,
613 /** Direct3D9 rendering engine */
614 libvlc_video_direct3d_engine_d3d9,
615 } libvlc_video_direct3d_engine_t;
617 typedef struct
619 bool hardware_decoding; /** set if D3D11_CREATE_DEVICE_VIDEO_SUPPORT is needed for D3D11 */
620 } libvlc_video_direct3d_device_cfg_t;
622 typedef struct
624 void *device_context; /** ID3D11DeviceContext* for D3D11, IDirect3D9 * for D3D9 */
625 int adapter; /** Adapter to use with the IDirect3D9 for D3D9 */
626 } libvlc_video_direct3d_device_setup_t;
628 /** Setup the rendering environment.
630 * \param opaque private pointer passed to the @a libvlc_video_direct3d_set_callbacks()
631 * on input. The callback can change this value on output to be
632 * passed to all the other callbacks set on @a libvlc_video_direct3d_set_callbacks(). [IN/OUT]
633 * \param cfg requested configuration of the video device [IN]
634 * \param out libvlc_video_direct3d_device_setup_t* to fill [OUT]
635 * \return true on success
636 * \version LibVLC 4.0.0 or later
638 * For \ref libvlc_video_direct3d_engine_d3d9 the output must be a IDirect3D9*.
639 * A reference to this object is held until the \ref LIBVLC_VIDEO_DEVICE_CLEANUP is called.
640 * the device must be created with D3DPRESENT_PARAMETERS.hDeviceWindow set to 0.
642 * For \ref libvlc_video_direct3d_engine_d3d11 the output must be a ID3D11DeviceContext*.
643 * A reference to this object is held until the \ref LIBVLC_VIDEO_DEVICE_CLEANUP is called.
644 * The ID3D11Device used to create ID3D11DeviceContext must have multithreading enabled.
646 typedef bool( *libvlc_video_direct3d_device_setup_cb )( void **opaque,
647 const libvlc_video_direct3d_device_cfg_t *cfg,
648 libvlc_video_direct3d_device_setup_t *out );
650 /** Cleanup the rendering environment initialized during \ref libvlc_video_direct3d_device_setup_cb.
652 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
653 * \version LibVLC 4.0.0 or later
655 typedef void( *libvlc_video_direct3d_device_cleanup_cb )( void *opaque );
657 /** Set the callback to call when the host app resizes the rendering area.
659 * This allows text rendering and aspect ratio to be handled properly when the host
660 * rendering size changes.
662 * It may be called before the \ref libvlc_video_direct3d_device_setup_cb callback.
664 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
665 * \param report_size_change callback which must be called when the host size changes. [IN]
666 * The callback is valid until another call to \ref libvlc_video_direct3d_set_resize_cb
667 * is done. This may be called from any thread.
668 * \param report_opaque private pointer to pass to the \ref report_size_change callback. [IN]
670 typedef void( *libvlc_video_direct3d_set_resize_cb )( void *opaque,
671 void (*report_size_change)(void *report_opaque, unsigned width, unsigned height),
672 void *report_opaque );
674 typedef struct
676 unsigned width; /** rendering video width in pixel */
677 unsigned height; /** rendering video height in pixel */
678 unsigned bitdepth; /** rendering video bit depth in bits per channel */
679 bool full_range; /** video is full range or studio/limited range */
680 libvlc_video_color_space_t colorspace; /** video color space */
681 libvlc_video_color_primaries_t primaries; /** video color primaries */
682 libvlc_video_transfer_func_t transfer; /** video transfer function */
683 void *device; /** device used for rendering, IDirect3DDevice9* for D3D9 */
684 } libvlc_video_direct3d_cfg_t;
686 typedef struct
688 int surface_format; /** the rendering DXGI_FORMAT for \ref libvlc_video_direct3d_engine_d3d11,
689 D3DFORMAT for \ref libvlc_video_direct3d_engine_d3d9 */
690 bool full_range; /** video is full range or studio/limited range */
691 libvlc_video_color_space_t colorspace; /** video color space */
692 libvlc_video_color_primaries_t primaries; /** video color primaries */
693 libvlc_video_transfer_func_t transfer; /** video transfer function */
694 } libvlc_video_output_cfg_t;
696 /** Update the rendering output setup.
698 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
699 * \param cfg configuration of the video that will be rendered [IN]
700 * \param output configuration describing with how the rendering is setup [OUT]
701 * \version LibVLC 4.0.0 or later
703 * \note the configuration device for Direct3D9 is the IDirect3DDevice9 that VLC
704 * uses to render. The host must set a Render target and call Present()
705 * when it needs the drawing from VLC to be done. This object is not valid
706 * anymore after Cleanup is called.
708 * Tone mapping, range and color conversion will be done depending on the values
709 * set in the output structure.
711 typedef bool( *libvlc_video_direct3d_update_output_cb )( void *opaque,
712 const libvlc_video_direct3d_cfg_t *cfg,
713 libvlc_video_output_cfg_t *output );
715 typedef struct
717 /* similar to SMPTE ST 2086 mastering display color volume */
718 uint16_t RedPrimary[2];
719 uint16_t GreenPrimary[2];
720 uint16_t BluePrimary[2];
721 uint16_t WhitePoint[2];
722 unsigned int MaxMasteringLuminance;
723 unsigned int MinMasteringLuminance;
724 uint16_t MaxContentLightLevel;
725 uint16_t MaxFrameAverageLightLevel;
726 } libvlc_video_direct3d_hdr10_metadata_t;
728 /** Tell the host the rendering is about to start/has finished.
730 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
731 * \param enter true if the rendering is about to start, false if it's finished
732 * \param hdr10 libvlc_video_direct3d_hdr10_metadata_t* or NULL [IN]
733 * \return true on success
734 * \version LibVLC 4.0.0 or later
736 * On Direct3D11 the following may change on the provided ID3D11DeviceContext*
737 * between \ref enter being true and \ref enter being false:
738 * - IASetPrimitiveTopology()
739 * - IASetInputLayout()
740 * - IASetVertexBuffers()
741 * - IASetIndexBuffer()
742 * - VSSetConstantBuffers()
743 * - VSSetShader()
744 * - PSSetSamplers()
745 * - PSSetConstantBuffers()
746 * - PSSetShaderResources()
747 * - PSSetShader()
748 * - RSSetViewports()
749 * - DrawIndexed()
751 typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *hdr10 );
753 /** Tell the host the rendering for the given plane is about to start
755 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
756 * \param plane number of the rendering plane to select
757 * \return true on success
758 * \version LibVLC 4.0.0 or later
760 * \note This is only used with \ref libvlc_video_direct3d_engine_d3d11.
762 * The host should call OMSetRenderTargets for Direct3D11. If this callback is
763 * not used (set to NULL in @a libvlc_video_direct3d_set_callbacks()) OMSetRenderTargets
764 * has to be set during the @a libvlc_video_direct3d_start_end_rendering_cb()
765 * entering call.
767 * The number of planes depend on the DXGI_FORMAT returned during the
768 * \ref LIBVLC_VIDEO_UPDATE_OUTPUT call. It's usually one plane except for
769 * semi-planar formats like DXGI_FORMAT_NV12 or DXGI_FORMAT_P010.
771 typedef bool( *libvlc_video_direct3d_select_plane_cb )( void *opaque, size_t plane );
774 * Set callbacks and data to render decoded video to a custom Direct3D output
776 * \warning VLC will perform video rendering in its own thread and at its own rate,
777 * You need to provide your own synchronisation mechanism.
779 * \param mp the media player
780 * \param engine the GPU engine to use
781 * \param setup_cb callback to setup and return the device to use (cannot be NULL)
782 * \param cleanup_cb callback to cleanup the device given by the \ref setup_cb callback
783 * \param resize_cb callback to set the resize callback
784 * \param update_output_cb callback to notify of the source format and get the
785 * rendering format used by the host (cannot be NULL)
786 * \param swap_cb callback to tell the host it should display the rendered picture (cannot be NULL)
787 * \param makeCurrent_cb callback to tell the host the rendering is starting/ended (cannot be NULL)
788 * \param select_plane_cb callback to select different D3D11 rendering targets
789 * \param opaque private pointer passed to the \ref cleanup_cb callback
791 * \retval true Direct3D selected and callbacks set
792 * \retval false Direct3D version, callbacks not set
793 * \version LibVLC 4.0.0 or later
795 LIBVLC_API
796 bool libvlc_video_direct3d_set_callbacks( libvlc_media_player_t *mp,
797 libvlc_video_direct3d_engine_t engine,
798 libvlc_video_direct3d_device_setup_cb setup_cb,
799 libvlc_video_direct3d_device_cleanup_cb cleanup_cb,
800 libvlc_video_direct3d_set_resize_cb resize_cb,
801 libvlc_video_direct3d_update_output_cb update_output_cb,
802 libvlc_video_swap_cb swap_cb,
803 libvlc_video_direct3d_start_end_rendering_cb makeCurrent_cb,
804 libvlc_video_direct3d_select_plane_cb select_plane_cb,
805 void* opaque );
808 * Set the NSView handler where the media player should render its video output.
810 * Use the vout called "macosx".
812 * The drawable is an NSObject that follow the VLCVideoViewEmbedding
813 * protocol:
815 * @code{.m}
816 * @protocol VLCVideoViewEmbedding <NSObject>
817 * - (void)addVoutSubview:(NSView *)view;
818 * - (void)removeVoutSubview:(NSView *)view;
819 * @end
820 * @endcode
822 * Or it can be an NSView object.
824 * If you want to use it along with Qt see the QMacCocoaViewContainer. Then
825 * the following code should work:
826 * @code{.mm}
828 * NSView *video = [[NSView alloc] init];
829 * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
830 * libvlc_media_player_set_nsobject(mp, video);
831 * [video release];
833 * @endcode
835 * You can find a live example in VLCVideoView in VLCKit.framework.
837 * \param p_mi the Media Player
838 * \param drawable the drawable that is either an NSView or an object following
839 * the VLCVideoViewEmbedding protocol.
841 LIBVLC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
844 * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
846 * \param p_mi the Media Player
847 * \return the NSView handler or 0 if none where set
849 LIBVLC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
852 * Set an X Window System drawable where the media player should render its
853 * video output. The call takes effect when the playback starts. If it is
854 * already started, it might need to be stopped before changes apply.
855 * If LibVLC was built without X11 output support, then this function has no
856 * effects.
858 * By default, LibVLC will capture input events on the video rendering area.
859 * Use libvlc_video_set_mouse_input() and libvlc_video_set_key_input() to
860 * disable that and deliver events to the parent window / to the application
861 * instead. By design, the X11 protocol delivers input events to only one
862 * recipient.
864 * \warning
865 * The application must call the XInitThreads() function from Xlib before
866 * libvlc_new(), and before any call to XOpenDisplay() directly or via any
867 * other library. Failure to call XInitThreads() will seriously impede LibVLC
868 * performance. Calling XOpenDisplay() before XInitThreads() will eventually
869 * crash the process. That is a limitation of Xlib.
871 * \param p_mi media player
872 * \param drawable X11 window ID
874 * \note
875 * The specified identifier must correspond to an existing Input/Output class
876 * X11 window. Pixmaps are <b>not</b> currently supported. The default X11
877 * server is assumed, i.e. that specified in the DISPLAY environment variable.
879 * \warning
880 * LibVLC can deal with invalid X11 handle errors, however some display drivers
881 * (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle
882 * must remain valid until playback is stopped, otherwise the process may
883 * abort or crash.
885 * \bug
886 * No more than one window handle per media player instance can be specified.
887 * If the media has multiple simultaneously active video tracks, extra tracks
888 * will be rendered into external windows beyond the control of the
889 * application.
891 LIBVLC_API void libvlc_media_player_set_xwindow(libvlc_media_player_t *p_mi,
892 uint32_t drawable);
895 * Get the X Window System window identifier previously set with
896 * libvlc_media_player_set_xwindow(). Note that this will return the identifier
897 * even if VLC is not currently using it (for instance if it is playing an
898 * audio-only input).
900 * \param p_mi the Media Player
901 * \return an X window ID, or 0 if none where set.
903 LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
906 * Set a Win32/Win64 API window handle (HWND) where the media player should
907 * render its video output. If LibVLC was built without Win32/Win64 API output
908 * support, then this has no effects.
910 * \param p_mi the Media Player
911 * \param drawable windows handle of the drawable
913 LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
916 * Get the Windows API window handle (HWND) previously set with
917 * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
918 * is not currently outputting any video to it.
920 * \param p_mi the Media Player
921 * \return a window handle or NULL if there are none.
923 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
926 * Set the android context.
928 * \version LibVLC 3.0.0 and later.
930 * \param p_mi the media player
931 * \param p_awindow_handler org.videolan.libvlc.AWindow jobject owned by the
932 * org.videolan.libvlc.MediaPlayer class from the libvlc-android project.
934 LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
935 void *p_awindow_handler );
938 * Callback prototype for audio playback.
940 * The LibVLC media player decodes and post-processes the audio signal
941 * asynchronously (in an internal thread). Whenever audio samples are ready
942 * to be queued to the output, this callback is invoked.
944 * The number of samples provided per invocation may depend on the file format,
945 * the audio coding algorithm, the decoder plug-in, the post-processing
946 * filters and timing. Application must not assume a certain number of samples.
948 * The exact format of audio samples is determined by libvlc_audio_set_format()
949 * or libvlc_audio_set_format_callbacks() as is the channels layout.
951 * Note that the number of samples is per channel. For instance, if the audio
952 * track sampling rate is 48000 Hz, then 1200 samples represent 25 milliseconds
953 * of audio signal - regardless of the number of audio channels.
955 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
956 * \param samples pointer to a table of audio samples to play back [IN]
957 * \param count number of audio samples to play back
958 * \param pts expected play time stamp (see libvlc_delay())
960 typedef void (*libvlc_audio_play_cb)(void *data, const void *samples,
961 unsigned count, int64_t pts);
964 * Callback prototype for audio pause.
966 * LibVLC invokes this callback to pause audio playback.
968 * \note The pause callback is never called if the audio is already paused.
969 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
970 * \param pts time stamp of the pause request (should be elapsed already)
972 typedef void (*libvlc_audio_pause_cb)(void *data, int64_t pts);
975 * Callback prototype for audio resumption.
977 * LibVLC invokes this callback to resume audio playback after it was
978 * previously paused.
980 * \note The resume callback is never called if the audio is not paused.
981 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
982 * \param pts time stamp of the resumption request (should be elapsed already)
984 typedef void (*libvlc_audio_resume_cb)(void *data, int64_t pts);
987 * Callback prototype for audio buffer flush.
989 * LibVLC invokes this callback if it needs to discard all pending buffers and
990 * stop playback as soon as possible. This typically occurs when the media is
991 * stopped.
993 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
995 typedef void (*libvlc_audio_flush_cb)(void *data, int64_t pts);
998 * Callback prototype for audio buffer drain.
1000 * LibVLC may invoke this callback when the decoded audio track is ending.
1001 * There will be no further decoded samples for the track, but playback should
1002 * nevertheless continue until all already pending buffers are rendered.
1004 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
1006 typedef void (*libvlc_audio_drain_cb)(void *data);
1009 * Callback prototype for audio volume change.
1010 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
1011 * \param volume software volume (1. = nominal, 0. = mute)
1012 * \param mute muted flag
1014 typedef void (*libvlc_audio_set_volume_cb)(void *data,
1015 float volume, bool mute);
1018 * Sets callbacks and private data for decoded audio.
1020 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
1021 * to configure the decoded audio format.
1023 * \note The audio callbacks override any other audio output mechanism.
1024 * If the callbacks are set, LibVLC will <b>not</b> output audio in any way.
1026 * \param mp the media player
1027 * \param play callback to play audio samples (must not be NULL)
1028 * \param pause callback to pause playback (or NULL to ignore)
1029 * \param resume callback to resume playback (or NULL to ignore)
1030 * \param flush callback to flush audio buffers (or NULL to ignore)
1031 * \param drain callback to drain audio buffers (or NULL to ignore)
1032 * \param opaque private pointer for the audio callbacks (as first parameter)
1033 * \version LibVLC 2.0.0 or later
1035 LIBVLC_API
1036 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
1037 libvlc_audio_play_cb play,
1038 libvlc_audio_pause_cb pause,
1039 libvlc_audio_resume_cb resume,
1040 libvlc_audio_flush_cb flush,
1041 libvlc_audio_drain_cb drain,
1042 void *opaque );
1045 * Set callbacks and private data for decoded audio. This only works in
1046 * combination with libvlc_audio_set_callbacks().
1047 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
1048 * to configure the decoded audio format.
1050 * \param mp the media player
1051 * \param set_volume callback to apply audio volume,
1052 * or NULL to apply volume in software
1053 * \version LibVLC 2.0.0 or later
1055 LIBVLC_API
1056 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
1057 libvlc_audio_set_volume_cb set_volume );
1060 * Callback prototype to setup the audio playback.
1062 * This is called when the media player needs to create a new audio output.
1063 * \param opaque pointer to the data pointer passed to
1064 * libvlc_audio_set_callbacks() [IN/OUT]
1065 * \param format 4 bytes sample format [IN/OUT]
1066 * \param rate sample rate [IN/OUT]
1067 * \param channels channels count [IN/OUT]
1068 * \return 0 on success, anything else to skip audio playback
1070 typedef int (*libvlc_audio_setup_cb)(void **opaque, char *format, unsigned *rate,
1071 unsigned *channels);
1074 * Callback prototype for audio playback cleanup.
1076 * This is called when the media player no longer needs an audio output.
1077 * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
1079 typedef void (*libvlc_audio_cleanup_cb)(void *data);
1082 * Sets decoded audio format via callbacks.
1084 * This only works in combination with libvlc_audio_set_callbacks().
1086 * \param mp the media player
1087 * \param setup callback to select the audio format (cannot be NULL)
1088 * \param cleanup callback to release any allocated resources (or NULL)
1089 * \version LibVLC 2.0.0 or later
1091 LIBVLC_API
1092 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
1093 libvlc_audio_setup_cb setup,
1094 libvlc_audio_cleanup_cb cleanup );
1097 * Sets a fixed decoded audio format.
1099 * This only works in combination with libvlc_audio_set_callbacks(),
1100 * and is mutually exclusive with libvlc_audio_set_format_callbacks().
1102 * \param mp the media player
1103 * \param format a four-characters string identifying the sample format
1104 * (e.g. "S16N" or "f32l")
1105 * \param rate sample rate (expressed in Hz)
1106 * \param channels channels count
1107 * \version LibVLC 2.0.0 or later
1109 LIBVLC_API
1110 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
1111 unsigned rate, unsigned channels );
1113 /** \bug This might go away ... to be replaced by a broader system */
1116 * Get the current movie length (in ms).
1118 * \param p_mi the Media Player
1119 * \return the movie length (in ms), or -1 if there is no media.
1121 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
1124 * Get the current movie time (in ms).
1126 * \param p_mi the Media Player
1127 * \return the movie time (in ms), or -1 if there is no media.
1129 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
1132 * Set the movie time (in ms). This has no effect if no media is being played.
1133 * Not all formats and protocols support this.
1135 * \param p_mi the Media Player
1136 * \param b_fast prefer fast seeking or precise seeking
1137 * \param i_time the movie time (in ms).
1138 * \return 0 on success, -1 on error
1140 LIBVLC_API int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
1141 libvlc_time_t i_time, bool b_fast );
1144 * Get movie position as percentage between 0.0 and 1.0.
1146 * \param p_mi the Media Player
1147 * \return movie position, or -1. in case of error
1149 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
1152 * Set movie position as percentage between 0.0 and 1.0.
1153 * This has no effect if playback is not enabled.
1154 * This might not work depending on the underlying input format and protocol.
1156 * \param p_mi the Media Player
1157 * \param b_fast prefer fast seeking or precise seeking
1158 * \param f_pos the position
1159 * \return 0 on success, -1 on error
1161 LIBVLC_API int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
1162 float f_pos, bool b_fast );
1165 * Set movie chapter (if applicable).
1167 * \param p_mi the Media Player
1168 * \param i_chapter chapter number to play
1170 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
1173 * Get movie chapter.
1175 * \param p_mi the Media Player
1176 * \return chapter number currently playing, or -1 if there is no media.
1178 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
1181 * Get movie chapter count
1183 * \param p_mi the Media Player
1184 * \return number of chapters in movie, or -1.
1186 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
1189 * Get title chapter count
1191 * \param p_mi the Media Player
1192 * \param i_title title
1193 * \return number of chapters in title, or -1
1195 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
1196 libvlc_media_player_t *p_mi, int i_title );
1199 * Set movie title
1201 * \param p_mi the Media Player
1202 * \param i_title title number to play
1204 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
1207 * Get movie title
1209 * \param p_mi the Media Player
1210 * \return title number currently playing, or -1
1212 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
1215 * Get movie title count
1217 * \param p_mi the Media Player
1218 * \return title number count, or -1
1220 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
1223 * Set previous chapter (if applicable)
1225 * \param p_mi the Media Player
1227 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
1230 * Set next chapter (if applicable)
1232 * \param p_mi the Media Player
1234 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
1237 * Get the requested movie play rate.
1238 * @warning Depending on the underlying media, the requested rate may be
1239 * different from the real playback rate.
1241 * \param p_mi the Media Player
1242 * \return movie play rate
1244 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
1247 * Set movie play rate
1249 * \param p_mi the Media Player
1250 * \param rate movie play rate to set
1251 * \return -1 if an error was detected, 0 otherwise (but even then, it might
1252 * not actually work depending on the underlying media protocol)
1254 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
1257 * Get current movie state
1259 * \param p_mi the Media Player
1260 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
1262 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
1265 * How many video outputs does this media player have?
1267 * \param p_mi the media player
1268 * \return the number of video outputs
1270 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
1273 * Is this media player seekable?
1275 * \param p_mi the media player
1276 * \retval true media player can seek
1277 * \retval false media player cannot seek
1279 LIBVLC_API bool libvlc_media_player_is_seekable(libvlc_media_player_t *p_mi);
1282 * Can this media player be paused?
1284 * \param p_mi the media player
1285 * \retval true media player can be paused
1286 * \retval false media player cannot be paused
1288 LIBVLC_API bool libvlc_media_player_can_pause(libvlc_media_player_t *p_mi);
1291 * Check if the current program is scrambled
1293 * \param p_mi the media player
1294 * \retval true current program is scrambled
1295 * \retval false current program is not scrambled
1297 * \version LibVLC 2.2.0 or later
1299 LIBVLC_API bool libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
1302 * Display the next frame (if supported)
1304 * \param p_mi the media player
1306 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
1309 * Navigate through DVD Menu
1311 * \param p_mi the Media Player
1312 * \param navigate the Navigation mode
1313 * \version libVLC 2.0.0 or later
1315 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
1316 unsigned navigate );
1319 * Set if, and how, the video title will be shown when media is played.
1321 * \param p_mi the media player
1322 * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
1323 * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
1324 * \version libVLC 2.1.0 or later
1326 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
1329 * Add a slave to the current media player.
1331 * \note If the player is playing, the slave will be added directly. This call
1332 * will also update the slave list of the attached libvlc_media_t.
1334 * \version LibVLC 3.0.0 and later.
1336 * \see libvlc_media_slaves_add
1338 * \param p_mi the media player
1339 * \param i_type subtitle or audio
1340 * \param psz_uri Uri of the slave (should contain a valid scheme).
1341 * \param b_select True if this slave should be selected when it's loaded
1343 * \return 0 on success, -1 on error.
1345 LIBVLC_API
1346 int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
1347 libvlc_media_slave_type_t i_type,
1348 const char *psz_uri, bool b_select );
1351 * Release (free) libvlc_track_description_t
1353 * \param p_track_description the structure to release
1355 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
1357 /** \defgroup libvlc_video LibVLC video controls
1358 * @{
1362 * Toggle fullscreen status on non-embedded video outputs.
1364 * @warning The same limitations applies to this function
1365 * as to libvlc_set_fullscreen().
1367 * \param p_mi the media player
1369 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
1372 * Enable or disable fullscreen.
1374 * @warning With most window managers, only a top-level windows can be in
1375 * full-screen mode. Hence, this function will not operate properly if
1376 * libvlc_media_player_set_xwindow() was used to embed the video in a
1377 * non-top-level window. In that case, the embedding window must be reparented
1378 * to the root window <b>before</b> fullscreen mode is enabled. You will want
1379 * to reparent it back to its normal parent when disabling fullscreen.
1381 * \note This setting applies to any and all current or future active video
1382 * tracks and windows for the given media player. The choice of fullscreen
1383 * output for each window is left to the operating system.
1385 * \param p_mi the media player
1386 * \param b_fullscreen boolean for fullscreen status
1388 LIBVLC_API void libvlc_set_fullscreen(libvlc_media_player_t *p_mi, bool b_fullscreen);
1391 * Get current fullscreen status.
1393 * \param p_mi the media player
1394 * \return the fullscreen status (boolean)
1396 * \retval false media player is windowed
1397 * \retval true media player is in fullscreen mode
1399 LIBVLC_API bool libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
1402 * Enable or disable key press events handling, according to the LibVLC hotkeys
1403 * configuration. By default and for historical reasons, keyboard events are
1404 * handled by the LibVLC video widget.
1406 * \note On X11, there can be only one subscriber for key press and mouse
1407 * click events per window. If your application has subscribed to those events
1408 * for the X window ID of the video widget, then LibVLC will not be able to
1409 * handle key presses and mouse clicks in any case.
1411 * \warning This function is only implemented for X11 and Win32 at the moment.
1413 * \param p_mi the media player
1414 * \param on true to handle key press events, false to ignore them.
1416 LIBVLC_API
1417 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
1420 * Enable or disable mouse click events handling. By default, those events are
1421 * handled. This is needed for DVD menus to work, as well as a few video
1422 * filters such as "puzzle".
1424 * \see libvlc_video_set_key_input().
1426 * \warning This function is only implemented for X11 and Win32 at the moment.
1428 * \param p_mi the media player
1429 * \param on true to handle mouse click events, false to ignore them.
1431 LIBVLC_API
1432 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
1435 * Get the pixel dimensions of a video.
1437 * \param p_mi media player
1438 * \param num number of the video (starting from, and most commonly 0)
1439 * \param px pointer to get the pixel width [OUT]
1440 * \param py pointer to get the pixel height [OUT]
1441 * \return 0 on success, -1 if the specified video does not exist
1443 LIBVLC_API
1444 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
1445 unsigned *px, unsigned *py );
1448 * Get the mouse pointer coordinates over a video.
1449 * Coordinates are expressed in terms of the decoded video resolution,
1450 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
1451 * you can query your windowing system directly).
1453 * Either of the coordinates may be negative or larger than the corresponding
1454 * dimension of the video, if the cursor is outside the rendering area.
1456 * @warning The coordinates may be out-of-date if the pointer is not located
1457 * on the video rendering area. LibVLC does not track the pointer if it is
1458 * outside of the video widget.
1460 * @note LibVLC does not support multiple pointers (it does of course support
1461 * multiple input devices sharing the same pointer) at the moment.
1463 * \param p_mi media player
1464 * \param num number of the video (starting from, and most commonly 0)
1465 * \param px pointer to get the abscissa [OUT]
1466 * \param py pointer to get the ordinate [OUT]
1467 * \return 0 on success, -1 if the specified video does not exist
1469 LIBVLC_API
1470 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1471 int *px, int *py );
1474 * Get the current video scaling factor.
1475 * See also libvlc_video_set_scale().
1477 * \param p_mi the media player
1478 * \return the currently configured zoom factor, or 0. if the video is set
1479 * to fit to the output window/drawable automatically.
1481 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1484 * Set the video scaling factor. That is the ratio of the number of pixels on
1485 * screen to the number of pixels in the original decoded video in each
1486 * dimension. Zero is a special value; it will adjust the video to the output
1487 * window/drawable (in windowed mode) or the entire screen.
1489 * Note that not all video outputs support scaling.
1491 * \param p_mi the media player
1492 * \param f_factor the scaling factor, or zero
1494 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1497 * Get current video aspect ratio.
1499 * \param p_mi the media player
1500 * \return the video aspect ratio or NULL if unspecified
1501 * (the result must be released with free() or libvlc_free()).
1503 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1506 * Set new video aspect ratio.
1508 * \param p_mi the media player
1509 * \param psz_aspect new video aspect-ratio or NULL to reset to default
1510 * \note Invalid aspect ratios are ignored.
1512 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1515 * Create a video viewpoint structure.
1517 * \version LibVLC 3.0.0 and later
1519 * \return video viewpoint or NULL
1520 * (the result must be released with free()).
1522 LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
1525 * Update the video viewpoint information.
1527 * \note It is safe to call this function before the media player is started.
1529 * \version LibVLC 3.0.0 and later
1531 * \param p_mi the media player
1532 * \param p_viewpoint video viewpoint allocated via libvlc_video_new_viewpoint()
1533 * \param b_absolute if true replace the old viewpoint with the new one. If
1534 * false, increase/decrease it.
1535 * \return -1 in case of error, 0 otherwise
1537 * \note the values are set asynchronously, it will be used by the next frame displayed.
1539 LIBVLC_API int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
1540 const libvlc_video_viewpoint_t *p_viewpoint,
1541 bool b_absolute);
1544 * Get current video subtitle.
1546 * \param p_mi the media player
1547 * \return the video subtitle selected, or -1 if none
1549 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1552 * Get the number of available video subtitles.
1554 * \param p_mi the media player
1555 * \return the number of available video subtitles
1557 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1560 * Get the description of available video subtitles.
1562 * \param p_mi the media player
1563 * \return list containing description of available video subtitles.
1564 * It must be freed with libvlc_track_description_list_release()
1566 LIBVLC_API libvlc_track_description_t *
1567 libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1570 * Set new video subtitle.
1572 * \param p_mi the media player
1573 * \param i_spu video subtitle track to select (i_id from track description)
1574 * \return 0 on success, -1 if out of range
1576 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1579 * Get the current subtitle delay. Positive values means subtitles are being
1580 * displayed later, negative values earlier.
1582 * \param p_mi media player
1583 * \return time (in microseconds) the display of subtitles is being delayed
1584 * \version LibVLC 2.0.0 or later
1586 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1589 * Set the subtitle delay. This affects the timing of when the subtitle will
1590 * be displayed. Positive values result in subtitles being displayed later,
1591 * while negative values will result in subtitles being displayed earlier.
1593 * The subtitle delay will be reset to zero each time the media changes.
1595 * \param p_mi media player
1596 * \param i_delay time (in microseconds) the display of subtitles should be delayed
1597 * \return 0 on success, -1 on error
1598 * \version LibVLC 2.0.0 or later
1600 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1603 * Get the full description of available titles
1605 * \version LibVLC 3.0.0 and later.
1607 * \param p_mi the media player
1608 * \param titles address to store an allocated array of title descriptions
1609 * descriptions (must be freed with libvlc_title_descriptions_release()
1610 * by the caller) [OUT]
1612 * \return the number of titles (-1 on error)
1614 LIBVLC_API int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi,
1615 libvlc_title_description_t ***titles );
1618 * Release a title description
1620 * \version LibVLC 3.0.0 and later
1622 * \param p_titles title description array to release
1623 * \param i_count number of title descriptions to release
1625 LIBVLC_API
1626 void libvlc_title_descriptions_release( libvlc_title_description_t **p_titles,
1627 unsigned i_count );
1630 * Get the full description of available chapters
1632 * \version LibVLC 3.0.0 and later.
1634 * \param p_mi the media player
1635 * \param i_chapters_of_title index of the title to query for chapters (uses current title if set to -1)
1636 * \param pp_chapters address to store an allocated array of chapter descriptions
1637 * descriptions (must be freed with libvlc_chapter_descriptions_release()
1638 * by the caller) [OUT]
1640 * \return the number of chapters (-1 on error)
1642 LIBVLC_API int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_mi,
1643 int i_chapters_of_title,
1644 libvlc_chapter_description_t *** pp_chapters );
1647 * Release a chapter description
1649 * \version LibVLC 3.0.0 and later
1651 * \param p_chapters chapter description array to release
1652 * \param i_count number of chapter descriptions to release
1654 LIBVLC_API
1655 void libvlc_chapter_descriptions_release( libvlc_chapter_description_t **p_chapters,
1656 unsigned i_count );
1659 * Set/unset the video crop ratio.
1661 * This function forces a crop ratio on any and all video tracks rendered by
1662 * the media player. If the display aspect ratio of a video does not match the
1663 * crop ratio, either the top and bottom, or the left and right of the video
1664 * will be cut out to fit the crop ratio.
1666 * For instance, a ratio of 1:1 will force the video to a square shape.
1668 * To disable video crop, set a crop ratio with zero as denominator.
1670 * A call to this function overrides any previous call to any of
1671 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1672 * libvlc_video_set_crop_window().
1674 * \see libvlc_video_set_aspect_ratio()
1676 * \param mp the media player
1677 * \param num crop ratio numerator (ignored if denominator is 0)
1678 * \param den crop ratio denominator (or 0 to unset the crop ratio)
1680 * \version LibVLC 4.0.0 and later
1682 LIBVLC_API
1683 void libvlc_video_set_crop_ratio(libvlc_media_player_t *mp,
1684 unsigned num, unsigned den);
1687 * Set the video crop window.
1689 * This function selects a sub-rectangle of video to show. Any pixels outside
1690 * the rectangle will not be shown.
1692 * To unset the video crop window, use libvlc_video_set_crop_ratio() or
1693 * libvlc_video_set_crop_border().
1695 * A call to this function overrides any previous call to any of
1696 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1697 * libvlc_video_set_crop_window().
1699 * \param mp the media player
1700 * \param x abscissa (i.e. leftmost sample column offset) of the crop window
1701 * \param y ordinate (i.e. topmost sample row offset) of the crop window
1702 * \param width sample width of the crop window (cannot be zero)
1703 * \param height sample height of the crop window (cannot be zero)
1705 * \version LibVLC 4.0.0 and later
1707 LIBVLC_API
1708 void libvlc_video_set_crop_window(libvlc_media_player_t *mp,
1709 unsigned x, unsigned y,
1710 unsigned width, unsigned height);
1713 * Set the video crop borders.
1715 * This function selects the size of video edges to be cropped out.
1717 * To unset the video crop borders, set all borders to zero.
1719 * A call to this function overrides any previous call to any of
1720 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1721 * libvlc_video_set_crop_window().
1723 * \param mp the media player
1724 * \param left number of sample columns to crop on the left
1725 * \param right number of sample columns to crop on the right
1726 * \param top number of sample rows to crop on the top
1727 * \param bottom number of sample rows to corp on the bottom
1729 * \version LibVLC 4.0.0 and later
1731 LIBVLC_API
1732 void libvlc_video_set_crop_border(libvlc_media_player_t *mp,
1733 unsigned left, unsigned right,
1734 unsigned top, unsigned bottom);
1737 * Get current teletext page requested or 0 if it's disabled.
1739 * Teletext is disabled by default, call libvlc_video_set_teletext() to enable
1740 * it.
1742 * \param p_mi the media player
1743 * \return the current teletext page requested.
1745 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1748 * Set new teletext page to retrieve.
1750 * This function can also be used to send a teletext key.
1752 * \param p_mi the media player
1753 * \param i_page teletex page number requested. This value can be 0 to disable
1754 * teletext, a number in the range ]0;1000[ to show the requested page, or a
1755 * \ref libvlc_teletext_key_t. 100 is the default teletext page.
1757 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1760 * Get number of available video tracks.
1762 * \param p_mi media player
1763 * \return the number of available video tracks (int)
1765 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1768 * Get the description of available video tracks.
1770 * \param p_mi media player
1771 * \return list with description of available video tracks, or NULL on error.
1772 * It must be freed with libvlc_track_description_list_release()
1774 LIBVLC_API libvlc_track_description_t *
1775 libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1778 * Get current video track.
1780 * \param p_mi media player
1781 * \return the video track ID (int) or -1 if no active input
1783 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1786 * Set video track.
1788 * \param p_mi media player
1789 * \param i_track the track ID (i_id field from track description)
1790 * \return 0 on success, -1 if out of range
1792 LIBVLC_API
1793 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1796 * Take a snapshot of the current video window.
1798 * If i_width AND i_height is 0, original size is used.
1799 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1801 * \param p_mi media player instance
1802 * \param num number of video output (typically 0 for the first/only one)
1803 * \param psz_filepath the path of a file or a folder to save the screenshot into
1804 * \param i_width the snapshot's width
1805 * \param i_height the snapshot's height
1806 * \return 0 on success, -1 if the video was not found
1808 LIBVLC_API
1809 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1810 const char *psz_filepath, unsigned int i_width,
1811 unsigned int i_height );
1814 * Enable or disable deinterlace filter
1816 * \param p_mi libvlc media player
1817 * \param deinterlace state -1: auto (default), 0: disabled, 1: enabled
1818 * \param psz_mode type of deinterlace filter, NULL for current/default filter
1819 * \version LibVLC 4.0.0 and later
1821 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1822 int deinterlace,
1823 const char *psz_mode );
1826 * Get an integer marquee option value
1828 * \param p_mi libvlc media player
1829 * \param option marq option to get \see libvlc_video_marquee_option_t
1831 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1832 unsigned option );
1835 * Enable, disable or set an integer marquee option
1837 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1838 * or disabling (arg 0) the marq filter.
1840 * \param p_mi libvlc media player
1841 * \param option marq option to set \see libvlc_video_marquee_option_t
1842 * \param i_val marq option value
1844 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1845 unsigned option, int i_val );
1848 * Set a marquee string option
1850 * \param p_mi libvlc media player
1851 * \param option marq option to set \see libvlc_video_marquee_option_t
1852 * \param psz_text marq option value
1854 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1855 unsigned option, const char *psz_text );
1857 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1858 enum libvlc_video_logo_option_t {
1859 libvlc_logo_enable,
1860 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
1861 libvlc_logo_x,
1862 libvlc_logo_y,
1863 libvlc_logo_delay,
1864 libvlc_logo_repeat,
1865 libvlc_logo_opacity,
1866 libvlc_logo_position
1870 * Get integer logo option.
1872 * \param p_mi libvlc media player instance
1873 * \param option logo option to get, values of libvlc_video_logo_option_t
1875 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1876 unsigned option );
1879 * Set logo option as integer. Options that take a different type value
1880 * are ignored.
1881 * Passing libvlc_logo_enable as option value has the side effect of
1882 * starting (arg !0) or stopping (arg 0) the logo filter.
1884 * \param p_mi libvlc media player instance
1885 * \param option logo option to set, values of libvlc_video_logo_option_t
1886 * \param value logo option value
1888 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1889 unsigned option, int value );
1892 * Set logo option as string. Options that take a different type value
1893 * are ignored.
1895 * \param p_mi libvlc media player instance
1896 * \param option logo option to set, values of libvlc_video_logo_option_t
1897 * \param psz_value logo option value
1899 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1900 unsigned option, const char *psz_value );
1903 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1904 enum libvlc_video_adjust_option_t {
1905 libvlc_adjust_Enable = 0,
1906 libvlc_adjust_Contrast,
1907 libvlc_adjust_Brightness,
1908 libvlc_adjust_Hue,
1909 libvlc_adjust_Saturation,
1910 libvlc_adjust_Gamma
1914 * Get integer adjust option.
1916 * \param p_mi libvlc media player instance
1917 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1918 * \version LibVLC 1.1.1 and later.
1920 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1921 unsigned option );
1924 * Set adjust option as integer. Options that take a different type value
1925 * are ignored.
1926 * Passing libvlc_adjust_enable as option value has the side effect of
1927 * starting (arg !0) or stopping (arg 0) the adjust filter.
1929 * \param p_mi libvlc media player instance
1930 * \param option adust option to set, values of libvlc_video_adjust_option_t
1931 * \param value adjust option value
1932 * \version LibVLC 1.1.1 and later.
1934 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1935 unsigned option, int value );
1938 * Get float adjust option.
1940 * \param p_mi libvlc media player instance
1941 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1942 * \version LibVLC 1.1.1 and later.
1944 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1945 unsigned option );
1948 * Set adjust option as float. Options that take a different type value
1949 * are ignored.
1951 * \param p_mi libvlc media player instance
1952 * \param option adust option to set, values of libvlc_video_adjust_option_t
1953 * \param value adjust option value
1954 * \version LibVLC 1.1.1 and later.
1956 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1957 unsigned option, float value );
1959 /** @} video */
1961 /** \defgroup libvlc_audio LibVLC audio controls
1962 * @{
1966 * Audio channels
1968 typedef enum libvlc_audio_output_channel_t {
1969 libvlc_AudioChannel_Error = -1,
1970 libvlc_AudioChannel_Stereo = 1,
1971 libvlc_AudioChannel_RStereo = 2,
1972 libvlc_AudioChannel_Left = 3,
1973 libvlc_AudioChannel_Right = 4,
1974 libvlc_AudioChannel_Dolbys = 5
1975 } libvlc_audio_output_channel_t;
1979 * Gets the list of available audio output modules.
1981 * \param p_instance libvlc instance
1982 * \return list of available audio outputs. It must be freed with
1983 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1984 * In case of error, NULL is returned.
1986 LIBVLC_API libvlc_audio_output_t *
1987 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1990 * Frees the list of available audio output modules.
1992 * \param p_list list with audio outputs for release
1994 LIBVLC_API
1995 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1998 * Selects an audio output module.
1999 * \note Any change will take be effect only after playback is stopped and
2000 * restarted. Audio output cannot be changed while playing.
2002 * \param p_mi media player
2003 * \param psz_name name of audio output,
2004 * use psz_name of \see libvlc_audio_output_t
2005 * \return 0 if function succeeded, -1 on error
2007 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
2008 const char *psz_name );
2011 * Gets a list of potential audio output devices,
2012 * \see libvlc_audio_output_device_set().
2014 * \note Not all audio outputs support enumerating devices.
2015 * The audio output may be functional even if the list is empty (NULL).
2017 * \note The list may not be exhaustive.
2019 * \warning Some audio output devices in the list might not actually work in
2020 * some circumstances. By default, it is recommended to not specify any
2021 * explicit audio device.
2023 * \param mp media player
2024 * \return A NULL-terminated linked list of potential audio output devices.
2025 * It must be freed with libvlc_audio_output_device_list_release()
2026 * \version LibVLC 2.2.0 or later.
2028 LIBVLC_API libvlc_audio_output_device_t *
2029 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
2032 * Gets a list of audio output devices for a given audio output module,
2033 * \see libvlc_audio_output_device_set().
2035 * \note Not all audio outputs support this. In particular, an empty (NULL)
2036 * list of devices does <b>not</b> imply that the specified audio output does
2037 * not work.
2039 * \note The list might not be exhaustive.
2041 * \warning Some audio output devices in the list might not actually work in
2042 * some circumstances. By default, it is recommended to not specify any
2043 * explicit audio device.
2045 * \param p_instance libvlc instance
2046 * \param aout audio output name
2047 * (as returned by libvlc_audio_output_list_get())
2048 * \return A NULL-terminated linked list of potential audio output devices.
2049 * It must be freed with libvlc_audio_output_device_list_release()
2050 * \version LibVLC 2.1.0 or later.
2052 LIBVLC_API libvlc_audio_output_device_t *
2053 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
2054 const char *aout );
2057 * Frees a list of available audio output devices.
2059 * \param p_list list with audio outputs for release
2060 * \version LibVLC 2.1.0 or later.
2062 LIBVLC_API void libvlc_audio_output_device_list_release(
2063 libvlc_audio_output_device_t *p_list );
2066 * Configures an explicit audio output device.
2068 * If the module paramater is NULL, audio output will be moved to the device
2069 * specified by the device identifier string immediately. This is the
2070 * recommended usage.
2072 * A list of adequate potential device strings can be obtained with
2073 * libvlc_audio_output_device_enum().
2075 * However passing NULL is supported in LibVLC version 2.2.0 and later only;
2076 * in earlier versions, this function would have no effects when the module
2077 * parameter was NULL.
2079 * If the module parameter is not NULL, the device parameter of the
2080 * corresponding audio output, if it exists, will be set to the specified
2081 * string. Note that some audio output modules do not have such a parameter
2082 * (notably MMDevice and PulseAudio).
2084 * A list of adequate potential device strings can be obtained with
2085 * libvlc_audio_output_device_list_get().
2087 * \note This function does not select the specified audio output plugin.
2088 * libvlc_audio_output_set() is used for that purpose.
2090 * \warning The syntax for the device parameter depends on the audio output.
2092 * Some audio output modules require further parameters (e.g. a channels map
2093 * in the case of ALSA).
2095 * \param mp media player
2096 * \param module If NULL, current audio output module.
2097 * if non-NULL, name of audio output module
2098 (\see libvlc_audio_output_t)
2099 * \param device_id device identifier string
2100 * \return Nothing. Errors are ignored (this is a design bug).
2102 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
2103 const char *module,
2104 const char *device_id );
2107 * Get the current audio output device identifier.
2109 * This complements libvlc_audio_output_device_set().
2111 * \warning The initial value for the current audio output device identifier
2112 * may not be set or may be some unknown value. A LibVLC application should
2113 * compare this value against the known device identifiers (e.g. those that
2114 * were previously retrieved by a call to libvlc_audio_output_device_enum or
2115 * libvlc_audio_output_device_list_get) to find the current audio output device.
2117 * It is possible that the selected audio output device changes (an external
2118 * change) without a call to libvlc_audio_output_device_set. That may make this
2119 * method unsuitable to use if a LibVLC application is attempting to track
2120 * dynamic audio device changes as they happen.
2122 * \param mp media player
2123 * \return the current audio output device identifier
2124 * NULL if no device is selected or in case of error
2125 * (the result must be released with free()).
2126 * \version LibVLC 3.0.0 or later.
2128 LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
2131 * Toggle mute status.
2133 * \param p_mi media player
2134 * \warning Toggling mute atomically is not always possible: On some platforms,
2135 * other processes can mute the VLC audio playback stream asynchronously. Thus,
2136 * there is a small race condition where toggling will not work.
2137 * See also the limitations of libvlc_audio_set_mute().
2139 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
2142 * Get current mute status.
2144 * \param p_mi media player
2145 * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
2147 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
2150 * Set mute status.
2152 * \param p_mi media player
2153 * \param status If status is true then mute, otherwise unmute
2154 * \warning This function does not always work. If there are no active audio
2155 * playback stream, the mute status might not be available. If digital
2156 * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
2157 * some audio output plugins do not support muting at all.
2158 * \note To force silent playback, disable all audio tracks. This is more
2159 * efficient and reliable than mute.
2161 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
2164 * Get current software audio volume.
2166 * \param p_mi media player
2167 * \return the software volume in percents
2168 * (0 = mute, 100 = nominal / 0dB)
2170 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
2173 * Set current software audio volume.
2175 * \param p_mi media player
2176 * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
2177 * \return 0 if the volume was set, -1 if it was out of range
2179 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
2182 * Get number of available audio tracks.
2184 * \param p_mi media player
2185 * \return the number of available audio tracks (int), or -1 if unavailable
2187 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
2190 * Get the description of available audio tracks.
2192 * \param p_mi media player
2193 * \return list with description of available audio tracks, or NULL.
2194 * It must be freed with libvlc_track_description_list_release()
2196 LIBVLC_API libvlc_track_description_t *
2197 libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
2200 * Get current audio track.
2202 * \param p_mi media player
2203 * \return the audio track ID or -1 if no active input.
2205 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
2208 * Set current audio track.
2210 * \param p_mi media player
2211 * \param i_track the track ID (i_id field from track description)
2212 * \return 0 on success, -1 on error
2214 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
2217 * Get current audio channel.
2219 * \param p_mi media player
2220 * \return the audio channel \see libvlc_audio_output_channel_t
2222 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
2225 * Set current audio channel.
2227 * \param p_mi media player
2228 * \param channel the audio channel, \see libvlc_audio_output_channel_t
2229 * \return 0 on success, -1 on error
2231 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
2234 * Get current audio delay.
2236 * \param p_mi media player
2237 * \return the audio delay (microseconds)
2238 * \version LibVLC 1.1.1 or later
2240 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
2243 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
2245 * \param p_mi media player
2246 * \param i_delay the audio delay (microseconds)
2247 * \return 0 on success, -1 on error
2248 * \version LibVLC 1.1.1 or later
2250 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
2253 * Get the number of equalizer presets.
2255 * \return number of presets
2256 * \version LibVLC 2.2.0 or later
2258 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
2261 * Get the name of a particular equalizer preset.
2263 * This name can be used, for example, to prepare a preset label or menu in a user
2264 * interface.
2266 * \param u_index index of the preset, counting from zero
2267 * \return preset name, or NULL if there is no such preset
2268 * \version LibVLC 2.2.0 or later
2270 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
2273 * Get the number of distinct frequency bands for an equalizer.
2275 * \return number of frequency bands
2276 * \version LibVLC 2.2.0 or later
2278 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
2281 * Get a particular equalizer band frequency.
2283 * This value can be used, for example, to create a label for an equalizer band control
2284 * in a user interface.
2286 * \param u_index index of the band, counting from zero
2287 * \return equalizer band frequency (Hz), or -1 if there is no such band
2288 * \version LibVLC 2.2.0 or later
2290 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
2293 * Create a new default equalizer, with all frequency values zeroed.
2295 * The new equalizer can subsequently be applied to a media player by invoking
2296 * libvlc_media_player_set_equalizer().
2298 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2299 * it is no longer needed.
2301 * \return opaque equalizer handle, or NULL on error
2302 * \version LibVLC 2.2.0 or later
2304 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
2307 * Create a new equalizer, with initial frequency values copied from an existing
2308 * preset.
2310 * The new equalizer can subsequently be applied to a media player by invoking
2311 * libvlc_media_player_set_equalizer().
2313 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2314 * it is no longer needed.
2316 * \param u_index index of the preset, counting from zero
2317 * \return opaque equalizer handle, or NULL on error
2318 * (it must be released with libvlc_audio_equalizer_release())
2319 * \version LibVLC 2.2.0 or later
2321 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
2324 * Release a previously created equalizer instance.
2326 * The equalizer was previously created by using libvlc_audio_equalizer_new() or
2327 * libvlc_audio_equalizer_new_from_preset().
2329 * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
2331 * \param p_equalizer opaque equalizer handle, or NULL
2332 * \version LibVLC 2.2.0 or later
2334 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
2337 * Set a new pre-amplification value for an equalizer.
2339 * The new equalizer settings are subsequently applied to a media player by invoking
2340 * libvlc_media_player_set_equalizer().
2342 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2344 * \param p_equalizer valid equalizer handle, must not be NULL
2345 * \param f_preamp preamp value (-20.0 to 20.0 Hz)
2346 * \return zero on success, -1 on error
2347 * \version LibVLC 2.2.0 or later
2349 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
2352 * Get the current pre-amplification value from an equalizer.
2354 * \param p_equalizer valid equalizer handle, must not be NULL
2355 * \return preamp value (Hz)
2356 * \version LibVLC 2.2.0 or later
2358 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
2361 * Set a new amplification value for a particular equalizer frequency band.
2363 * The new equalizer settings are subsequently applied to a media player by invoking
2364 * libvlc_media_player_set_equalizer().
2366 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2368 * \param p_equalizer valid equalizer handle, must not be NULL
2369 * \param f_amp amplification value (-20.0 to 20.0 Hz)
2370 * \param u_band index, counting from zero, of the frequency band to set
2371 * \return zero on success, -1 on error
2372 * \version LibVLC 2.2.0 or later
2374 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
2377 * Get the amplification value for a particular equalizer frequency band.
2379 * \param p_equalizer valid equalizer handle, must not be NULL
2380 * \param u_band index, counting from zero, of the frequency band to get
2381 * \return amplification value (Hz); NaN if there is no such frequency band
2382 * \version LibVLC 2.2.0 or later
2384 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
2387 * Apply new equalizer settings to a media player.
2389 * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
2390 * libvlc_audio_equalizer_new_from_preset().
2392 * It is possible to apply new equalizer settings to a media player whether the media
2393 * player is currently playing media or not.
2395 * Invoking this method will immediately apply the new equalizer settings to the audio
2396 * output of the currently playing media if there is any.
2398 * If there is no currently playing media, the new equalizer settings will be applied
2399 * later if and when new media is played.
2401 * Equalizer settings will automatically be applied to subsequently played media.
2403 * To disable the equalizer for a media player invoke this method passing NULL for the
2404 * p_equalizer parameter.
2406 * The media player does not keep a reference to the supplied equalizer so it is safe
2407 * for an application to release the equalizer reference any time after this method
2408 * returns.
2410 * \param p_mi opaque media player handle
2411 * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
2412 * \return zero on success, -1 on error
2413 * \version LibVLC 2.2.0 or later
2415 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
2418 * Media player roles.
2420 * \version LibVLC 3.0.0 and later.
2422 * See \ref libvlc_media_player_set_role()
2424 typedef enum libvlc_media_player_role {
2425 libvlc_role_None = 0, /**< Don't use a media player role */
2426 libvlc_role_Music, /**< Music (or radio) playback */
2427 libvlc_role_Video, /**< Video playback */
2428 libvlc_role_Communication, /**< Speech, real-time communication */
2429 libvlc_role_Game, /**< Video game */
2430 libvlc_role_Notification, /**< User interaction feedback */
2431 libvlc_role_Animation, /**< Embedded animation (e.g. in web page) */
2432 libvlc_role_Production, /**< Audio editting/production */
2433 libvlc_role_Accessibility, /**< Accessibility */
2434 libvlc_role_Test /** Testing */
2435 #define libvlc_role_Last libvlc_role_Test
2436 } libvlc_media_player_role_t;
2439 * Gets the media role.
2441 * \version LibVLC 3.0.0 and later.
2443 * \param p_mi media player
2444 * \return the media player role (\ref libvlc_media_player_role_t)
2446 LIBVLC_API int libvlc_media_player_get_role(libvlc_media_player_t *p_mi);
2449 * Sets the media role.
2451 * \param p_mi media player
2452 * \param role the media player role (\ref libvlc_media_player_role_t)
2453 * \return 0 on success, -1 on error
2455 LIBVLC_API int libvlc_media_player_set_role(libvlc_media_player_t *p_mi,
2456 unsigned role);
2458 /** @} audio */
2460 /** @} media_player */
2462 # ifdef __cplusplus
2464 # endif
2466 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */