lib: add new player track API
[vlc.git] / include / vlc / libvlc_media_player.h
blobc067e0acc9ba830188f09793577251116e154473
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_format_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 );
506 typedef struct
508 bool hardware_decoding; /** set if D3D11_CREATE_DEVICE_VIDEO_SUPPORT is needed for D3D11 */
509 } libvlc_video_setup_device_cfg_t;
511 typedef struct
513 union {
514 struct {
515 void *device_context; /** ID3D11DeviceContext* */
516 } d3d11;
517 struct {
518 void *device; /** IDirect3D9* */
519 int adapter; /** Adapter to use with the IDirect3D9* */
520 } d3d9;
522 } libvlc_video_setup_device_info_t;
525 * Callback prototype called to initialize user data.
526 * Setup the rendering environment.
528 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks()
529 * on input. The callback can change this value on output to be
530 * passed to all the other callbacks set on @a libvlc_video_set_output_callbacks().
531 * [IN/OUT]
532 * \param cfg requested configuration of the video device [IN]
533 * \param out libvlc_video_setup_device_info_t* to fill [OUT]
534 * \return true on success
535 * \version LibVLC 4.0.0 or later
537 * For \ref libvlc_video_engine_d3d9 the output must be a IDirect3D9*.
538 * A reference to this object is held until the \ref LIBVLC_VIDEO_DEVICE_CLEANUP is called.
539 * the device must be created with D3DPRESENT_PARAMETERS.hDeviceWindow set to 0.
541 * For \ref libvlc_video_engine_d3d11 the output must be a ID3D11DeviceContext*.
542 * A reference to this object is held until the \ref LIBVLC_VIDEO_DEVICE_CLEANUP is called.
543 * The ID3D11Device used to create ID3D11DeviceContext must have multithreading enabled.
545 typedef bool (*libvlc_video_output_setup_cb)(void **opaque,
546 const libvlc_video_setup_device_cfg_t *cfg,
547 libvlc_video_setup_device_info_t *out);
551 * Callback prototype called to release user data
553 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
554 * \version LibVLC 4.0.0 or later
556 typedef void (*libvlc_video_output_cleanup_cb)(void* opaque);
558 typedef struct
560 unsigned width; /** rendering video width in pixel */
561 unsigned height; /** rendering video height in pixel */
562 unsigned bitdepth; /** rendering video bit depth in bits per channel */
563 bool full_range; /** video is full range or studio/limited range */
564 libvlc_video_color_space_t colorspace; /** video color space */
565 libvlc_video_color_primaries_t primaries; /** video color primaries */
566 libvlc_video_transfer_func_t transfer; /** video transfer function */
567 void *device; /** device used for rendering, IDirect3DDevice9* for D3D9 */
568 } libvlc_video_render_cfg_t;
570 typedef struct
572 union {
573 int dxgi_format; /** the rendering DXGI_FORMAT for \ref libvlc_video_engine_d3d11*/
574 uint32_t d3d9_format; /** the rendering D3DFORMAT for \ref libvlc_video_engine_d3d9 */
575 int opengl_format; /** the rendering GLint GL_RGBA or GL_RGB for \ref libvlc_video_engine_opengl and
576 for \ref libvlc_video_engine_gles2 */
577 void *p_surface; /** currently unused */
579 bool full_range; /** video is full range or studio/limited range */
580 libvlc_video_color_space_t colorspace; /** video color space */
581 libvlc_video_color_primaries_t primaries; /** video color primaries */
582 libvlc_video_transfer_func_t transfer; /** video transfer function */
583 } libvlc_video_output_cfg_t;
586 * Callback prototype called on video size changes.
587 * Update the rendering output setup.
589 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
590 * \param cfg configuration of the video that will be rendered [IN]
591 * \param output configuration describing with how the rendering is setup [OUT]
592 * \version LibVLC 4.0.0 or later
594 * \note the configuration device for Direct3D9 is the IDirect3DDevice9 that VLC
595 * uses to render. The host must set a Render target and call Present()
596 * when it needs the drawing from VLC to be done. This object is not valid
597 * anymore after Cleanup is called.
599 * Tone mapping, range and color conversion will be done depending on the values
600 * set in the output structure.
602 typedef bool (*libvlc_video_update_output_cb)(void* opaque, const libvlc_video_render_cfg_t *cfg,
603 libvlc_video_output_cfg_t *output );
607 * Callback prototype called after performing drawing calls.
609 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
610 * \version LibVLC 4.0.0 or later
612 typedef void (*libvlc_video_swap_cb)(void* opaque);
615 * Callback prototype to set up the OpenGL context for rendering.
616 * Tell the host the rendering is about to start/has finished.
618 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
619 * \param enter true to set the context as current, false to unset it [IN]
620 * \return true on success
621 * \version LibVLC 4.0.0 or later
623 * On Direct3D11 the following may change on the provided ID3D11DeviceContext*
624 * between \ref enter being true and \ref enter being false:
625 * - IASetPrimitiveTopology()
626 * - IASetInputLayout()
627 * - IASetVertexBuffers()
628 * - IASetIndexBuffer()
629 * - VSSetConstantBuffers()
630 * - VSSetShader()
631 * - PSSetSamplers()
632 * - PSSetConstantBuffers()
633 * - PSSetShaderResources()
634 * - PSSetShader()
635 * - RSSetViewports()
636 * - DrawIndexed()
638 typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter);
641 * Callback prototype to load opengl functions
643 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
644 * \param fct_name name of the opengl function to load
645 * \return a pointer to the named OpenGL function the NULL otherwise
646 * \version LibVLC 4.0.0 or later
648 typedef void* (*libvlc_video_getProcAddress_cb)(void* opaque, const char* fct_name);
650 typedef struct
652 /* similar to SMPTE ST 2086 mastering display color volume */
653 uint16_t RedPrimary[2];
654 uint16_t GreenPrimary[2];
655 uint16_t BluePrimary[2];
656 uint16_t WhitePoint[2];
657 unsigned int MaxMasteringLuminance;
658 unsigned int MinMasteringLuminance;
659 uint16_t MaxContentLightLevel;
660 uint16_t MaxFrameAverageLightLevel;
661 } libvlc_video_frame_hdr10_metadata_t;
663 typedef enum libvlc_video_metadata_type_t {
664 libvlc_video_metadata_frame_hdr10, /**< libvlc_video_frame_hdr10_metadata_t */
665 } libvlc_video_metadata_type_t;
668 * Callback prototype to receive metadata before rendering.
670 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
671 * \param type type of data passed in metadata [IN]
672 * \param metadata the type of metadata [IN]
673 * \version LibVLC 4.0.0 or later
675 typedef void (*libvlc_video_frameMetadata_cb)(void* opaque, libvlc_video_metadata_type_t type, const void *metadata);
678 * Enumeration of the Video engine to be used on output.
679 * can be passed to @a libvlc_video_set_output_callbacks
681 typedef enum libvlc_video_engine_t {
682 /** Disable rendering engine */
683 libvlc_video_engine_disable,
684 libvlc_video_engine_opengl,
685 libvlc_video_engine_gles2,
686 /** Direct3D11 rendering engine */
687 libvlc_video_engine_d3d11,
688 /** Direct3D9 rendering engine */
689 libvlc_video_engine_d3d9,
690 } libvlc_video_engine_t;
692 /** Set the callback to call when the host app resizes the rendering area.
694 * This allows text rendering and aspect ratio to be handled properly when the host
695 * rendering size changes.
697 * It may be called before the \ref libvlc_video_output_setup_cb callback.
699 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
700 * \param report_size_change callback which must be called when the host size changes. [IN]
701 * The callback is valid until another call to \ref libvlc_video_output_set_resize_cb
702 * is done. This may be called from any thread.
703 * \param report_opaque private pointer to pass to the \ref report_size_change callback. [IN]
705 typedef void( *libvlc_video_output_set_resize_cb )( void *opaque,
706 void (*report_size_change)(void *report_opaque, unsigned width, unsigned height),
707 void *report_opaque );
709 /** Tell the host the rendering for the given plane is about to start
711 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
712 * \param plane number of the rendering plane to select
713 * \return true on success
714 * \version LibVLC 4.0.0 or later
716 * \note This is only used with \ref libvlc_video_engine_d3d11.
718 * The host should call OMSetRenderTargets for Direct3D11. If this callback is
719 * not used (set to NULL in @a libvlc_video_set_output_callbacks()) OMSetRenderTargets
720 * has to be set during the @a libvlc_video_makeCurrent_cb()
721 * entering call.
723 * The number of planes depend on the DXGI_FORMAT returned during the
724 * \ref LIBVLC_VIDEO_UPDATE_OUTPUT call. It's usually one plane except for
725 * semi-planar formats like DXGI_FORMAT_NV12 or DXGI_FORMAT_P010.
727 typedef bool( *libvlc_video_output_select_plane_cb )( void *opaque, size_t plane );
730 * Set callbacks and data to render decoded video to a custom texture
732 * \warning VLC will perform video rendering in its own thread and at its own rate,
733 * You need to provide your own synchronisation mechanism.
735 * \param mp the media player
736 * \param engine the GPU engine to use
737 * \param setup_cb callback called to initialize user data
738 * \param cleanup_cb callback called to clean up user data
739 * \param resize_cb callback to set the resize callback
740 * \param update_output_cb callback to get the rendering format of the host (cannot be NULL)
741 * \param swap_cb callback called after rendering a video frame (cannot be NULL)
742 * \param makeCurrent_cb callback called to enter/leave the rendering context (cannot be NULL)
743 * \param getProcAddress_cb opengl function loading callback (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
744 * \param metadata_cb callback to provide frame metadata (D3D11 only)
745 * \param select_plane_cb callback to select different D3D11 rendering targets
746 * \param opaque private pointer passed to callbacks
748 * \retval true engine selected and callbacks set
749 * \retval false engine type unknown, callbacks not set
750 * \version LibVLC 4.0.0 or later
752 LIBVLC_API
753 bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
754 libvlc_video_engine_t engine,
755 libvlc_video_output_setup_cb setup_cb,
756 libvlc_video_output_cleanup_cb cleanup_cb,
757 libvlc_video_output_set_resize_cb resize_cb,
758 libvlc_video_update_output_cb update_output_cb,
759 libvlc_video_swap_cb swap_cb,
760 libvlc_video_makeCurrent_cb makeCurrent_cb,
761 libvlc_video_getProcAddress_cb getProcAddress_cb,
762 libvlc_video_frameMetadata_cb metadata_cb,
763 libvlc_video_output_select_plane_cb select_plane_cb,
764 void* opaque );
767 * Set the NSView handler where the media player should render its video output.
769 * Use the vout called "macosx".
771 * The drawable is an NSObject that follow the VLCVideoViewEmbedding
772 * protocol:
774 * @code{.m}
775 * @protocol VLCVideoViewEmbedding <NSObject>
776 * - (void)addVoutSubview:(NSView *)view;
777 * - (void)removeVoutSubview:(NSView *)view;
778 * @end
779 * @endcode
781 * Or it can be an NSView object.
783 * If you want to use it along with Qt see the QMacCocoaViewContainer. Then
784 * the following code should work:
785 * @code{.mm}
787 * NSView *video = [[NSView alloc] init];
788 * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
789 * libvlc_media_player_set_nsobject(mp, video);
790 * [video release];
792 * @endcode
794 * You can find a live example in VLCVideoView in VLCKit.framework.
796 * \param p_mi the Media Player
797 * \param drawable the drawable that is either an NSView or an object following
798 * the VLCVideoViewEmbedding protocol.
800 LIBVLC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
803 * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
805 * \param p_mi the Media Player
806 * \return the NSView handler or 0 if none where set
808 LIBVLC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
811 * Set an X Window System drawable where the media player should render its
812 * video output. The call takes effect when the playback starts. If it is
813 * already started, it might need to be stopped before changes apply.
814 * If LibVLC was built without X11 output support, then this function has no
815 * effects.
817 * By default, LibVLC will capture input events on the video rendering area.
818 * Use libvlc_video_set_mouse_input() and libvlc_video_set_key_input() to
819 * disable that and deliver events to the parent window / to the application
820 * instead. By design, the X11 protocol delivers input events to only one
821 * recipient.
823 * \warning
824 * The application must call the XInitThreads() function from Xlib before
825 * libvlc_new(), and before any call to XOpenDisplay() directly or via any
826 * other library. Failure to call XInitThreads() will seriously impede LibVLC
827 * performance. Calling XOpenDisplay() before XInitThreads() will eventually
828 * crash the process. That is a limitation of Xlib.
830 * \param p_mi media player
831 * \param drawable X11 window ID
833 * \note
834 * The specified identifier must correspond to an existing Input/Output class
835 * X11 window. Pixmaps are <b>not</b> currently supported. The default X11
836 * server is assumed, i.e. that specified in the DISPLAY environment variable.
838 * \warning
839 * LibVLC can deal with invalid X11 handle errors, however some display drivers
840 * (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle
841 * must remain valid until playback is stopped, otherwise the process may
842 * abort or crash.
844 * \bug
845 * No more than one window handle per media player instance can be specified.
846 * If the media has multiple simultaneously active video tracks, extra tracks
847 * will be rendered into external windows beyond the control of the
848 * application.
850 LIBVLC_API void libvlc_media_player_set_xwindow(libvlc_media_player_t *p_mi,
851 uint32_t drawable);
854 * Get the X Window System window identifier previously set with
855 * libvlc_media_player_set_xwindow(). Note that this will return the identifier
856 * even if VLC is not currently using it (for instance if it is playing an
857 * audio-only input).
859 * \param p_mi the Media Player
860 * \return an X window ID, or 0 if none where set.
862 LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
865 * Set a Win32/Win64 API window handle (HWND) where the media player should
866 * render its video output. If LibVLC was built without Win32/Win64 API output
867 * support, then this has no effects.
869 * \param p_mi the Media Player
870 * \param drawable windows handle of the drawable
872 LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
875 * Get the Windows API window handle (HWND) previously set with
876 * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
877 * is not currently outputting any video to it.
879 * \param p_mi the Media Player
880 * \return a window handle or NULL if there are none.
882 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
885 * Set the android context.
887 * \version LibVLC 3.0.0 and later.
889 * \param p_mi the media player
890 * \param p_awindow_handler org.videolan.libvlc.AWindow jobject owned by the
891 * org.videolan.libvlc.MediaPlayer class from the libvlc-android project.
893 LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
894 void *p_awindow_handler );
897 * Callback prototype for audio playback.
899 * The LibVLC media player decodes and post-processes the audio signal
900 * asynchronously (in an internal thread). Whenever audio samples are ready
901 * to be queued to the output, this callback is invoked.
903 * The number of samples provided per invocation may depend on the file format,
904 * the audio coding algorithm, the decoder plug-in, the post-processing
905 * filters and timing. Application must not assume a certain number of samples.
907 * The exact format of audio samples is determined by libvlc_audio_set_format()
908 * or libvlc_audio_set_format_callbacks() as is the channels layout.
910 * Note that the number of samples is per channel. For instance, if the audio
911 * track sampling rate is 48000 Hz, then 1200 samples represent 25 milliseconds
912 * of audio signal - regardless of the number of audio channels.
914 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
915 * \param samples pointer to a table of audio samples to play back [IN]
916 * \param count number of audio samples to play back
917 * \param pts expected play time stamp (see libvlc_delay())
919 typedef void (*libvlc_audio_play_cb)(void *data, const void *samples,
920 unsigned count, int64_t pts);
923 * Callback prototype for audio pause.
925 * LibVLC invokes this callback to pause audio playback.
927 * \note The pause callback is never called if the audio is already paused.
928 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
929 * \param pts time stamp of the pause request (should be elapsed already)
931 typedef void (*libvlc_audio_pause_cb)(void *data, int64_t pts);
934 * Callback prototype for audio resumption.
936 * LibVLC invokes this callback to resume audio playback after it was
937 * previously paused.
939 * \note The resume callback is never called if the audio is not paused.
940 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
941 * \param pts time stamp of the resumption request (should be elapsed already)
943 typedef void (*libvlc_audio_resume_cb)(void *data, int64_t pts);
946 * Callback prototype for audio buffer flush.
948 * LibVLC invokes this callback if it needs to discard all pending buffers and
949 * stop playback as soon as possible. This typically occurs when the media is
950 * stopped.
952 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
954 typedef void (*libvlc_audio_flush_cb)(void *data, int64_t pts);
957 * Callback prototype for audio buffer drain.
959 * LibVLC may invoke this callback when the decoded audio track is ending.
960 * There will be no further decoded samples for the track, but playback should
961 * nevertheless continue until all already pending buffers are rendered.
963 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
965 typedef void (*libvlc_audio_drain_cb)(void *data);
968 * Callback prototype for audio volume change.
969 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
970 * \param volume software volume (1. = nominal, 0. = mute)
971 * \param mute muted flag
973 typedef void (*libvlc_audio_set_volume_cb)(void *data,
974 float volume, bool mute);
977 * Sets callbacks and private data for decoded audio.
979 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
980 * to configure the decoded audio format.
982 * \note The audio callbacks override any other audio output mechanism.
983 * If the callbacks are set, LibVLC will <b>not</b> output audio in any way.
985 * \param mp the media player
986 * \param play callback to play audio samples (must not be NULL)
987 * \param pause callback to pause playback (or NULL to ignore)
988 * \param resume callback to resume playback (or NULL to ignore)
989 * \param flush callback to flush audio buffers (or NULL to ignore)
990 * \param drain callback to drain audio buffers (or NULL to ignore)
991 * \param opaque private pointer for the audio callbacks (as first parameter)
992 * \version LibVLC 2.0.0 or later
994 LIBVLC_API
995 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
996 libvlc_audio_play_cb play,
997 libvlc_audio_pause_cb pause,
998 libvlc_audio_resume_cb resume,
999 libvlc_audio_flush_cb flush,
1000 libvlc_audio_drain_cb drain,
1001 void *opaque );
1004 * Set callbacks and private data for decoded audio. This only works in
1005 * combination with libvlc_audio_set_callbacks().
1006 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
1007 * to configure the decoded audio format.
1009 * \param mp the media player
1010 * \param set_volume callback to apply audio volume,
1011 * or NULL to apply volume in software
1012 * \version LibVLC 2.0.0 or later
1014 LIBVLC_API
1015 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
1016 libvlc_audio_set_volume_cb set_volume );
1019 * Callback prototype to setup the audio playback.
1021 * This is called when the media player needs to create a new audio output.
1022 * \param opaque pointer to the data pointer passed to
1023 * libvlc_audio_set_callbacks() [IN/OUT]
1024 * \param format 4 bytes sample format [IN/OUT]
1025 * \param rate sample rate [IN/OUT]
1026 * \param channels channels count [IN/OUT]
1027 * \return 0 on success, anything else to skip audio playback
1029 typedef int (*libvlc_audio_setup_cb)(void **opaque, char *format, unsigned *rate,
1030 unsigned *channels);
1033 * Callback prototype for audio playback cleanup.
1035 * This is called when the media player no longer needs an audio output.
1036 * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
1038 typedef void (*libvlc_audio_cleanup_cb)(void *data);
1041 * Sets decoded audio format via callbacks.
1043 * This only works in combination with libvlc_audio_set_callbacks().
1045 * \param mp the media player
1046 * \param setup callback to select the audio format (cannot be NULL)
1047 * \param cleanup callback to release any allocated resources (or NULL)
1048 * \version LibVLC 2.0.0 or later
1050 LIBVLC_API
1051 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
1052 libvlc_audio_setup_cb setup,
1053 libvlc_audio_cleanup_cb cleanup );
1056 * Sets a fixed decoded audio format.
1058 * This only works in combination with libvlc_audio_set_callbacks(),
1059 * and is mutually exclusive with libvlc_audio_set_format_callbacks().
1061 * \param mp the media player
1062 * \param format a four-characters string identifying the sample format
1063 * (e.g. "S16N" or "f32l")
1064 * \param rate sample rate (expressed in Hz)
1065 * \param channels channels count
1066 * \version LibVLC 2.0.0 or later
1068 LIBVLC_API
1069 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
1070 unsigned rate, unsigned channels );
1072 /** \bug This might go away ... to be replaced by a broader system */
1075 * Get the current movie length (in ms).
1077 * \param p_mi the Media Player
1078 * \return the movie length (in ms), or -1 if there is no media.
1080 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
1083 * Get the current movie time (in ms).
1085 * \param p_mi the Media Player
1086 * \return the movie time (in ms), or -1 if there is no media.
1088 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
1091 * Set the movie time (in ms). This has no effect if no media is being played.
1092 * Not all formats and protocols support this.
1094 * \param p_mi the Media Player
1095 * \param b_fast prefer fast seeking or precise seeking
1096 * \param i_time the movie time (in ms).
1097 * \return 0 on success, -1 on error
1099 LIBVLC_API int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
1100 libvlc_time_t i_time, bool b_fast );
1103 * Get movie position as percentage between 0.0 and 1.0.
1105 * \param p_mi the Media Player
1106 * \return movie position, or -1. in case of error
1108 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
1111 * Set movie position as percentage between 0.0 and 1.0.
1112 * This has no effect if playback is not enabled.
1113 * This might not work depending on the underlying input format and protocol.
1115 * \param p_mi the Media Player
1116 * \param b_fast prefer fast seeking or precise seeking
1117 * \param f_pos the position
1118 * \return 0 on success, -1 on error
1120 LIBVLC_API int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
1121 float f_pos, bool b_fast );
1124 * Set movie chapter (if applicable).
1126 * \param p_mi the Media Player
1127 * \param i_chapter chapter number to play
1129 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
1132 * Get movie chapter.
1134 * \param p_mi the Media Player
1135 * \return chapter number currently playing, or -1 if there is no media.
1137 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
1140 * Get movie chapter count
1142 * \param p_mi the Media Player
1143 * \return number of chapters in movie, or -1.
1145 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
1148 * Get title chapter count
1150 * \param p_mi the Media Player
1151 * \param i_title title
1152 * \return number of chapters in title, or -1
1154 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
1155 libvlc_media_player_t *p_mi, int i_title );
1158 * Set movie title
1160 * \param p_mi the Media Player
1161 * \param i_title title number to play
1163 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
1166 * Get movie title
1168 * \param p_mi the Media Player
1169 * \return title number currently playing, or -1
1171 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
1174 * Get movie title count
1176 * \param p_mi the Media Player
1177 * \return title number count, or -1
1179 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
1182 * Set previous chapter (if applicable)
1184 * \param p_mi the Media Player
1186 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
1189 * Set next chapter (if applicable)
1191 * \param p_mi the Media Player
1193 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
1196 * Get the requested movie play rate.
1197 * @warning Depending on the underlying media, the requested rate may be
1198 * different from the real playback rate.
1200 * \param p_mi the Media Player
1201 * \return movie play rate
1203 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
1206 * Set movie play rate
1208 * \param p_mi the Media Player
1209 * \param rate movie play rate to set
1210 * \return -1 if an error was detected, 0 otherwise (but even then, it might
1211 * not actually work depending on the underlying media protocol)
1213 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
1216 * Get current movie state
1218 * \param p_mi the Media Player
1219 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
1221 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
1224 * How many video outputs does this media player have?
1226 * \param p_mi the media player
1227 * \return the number of video outputs
1229 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
1232 * Is this media player seekable?
1234 * \param p_mi the media player
1235 * \retval true media player can seek
1236 * \retval false media player cannot seek
1238 LIBVLC_API bool libvlc_media_player_is_seekable(libvlc_media_player_t *p_mi);
1241 * Can this media player be paused?
1243 * \param p_mi the media player
1244 * \retval true media player can be paused
1245 * \retval false media player cannot be paused
1247 LIBVLC_API bool libvlc_media_player_can_pause(libvlc_media_player_t *p_mi);
1250 * Check if the current program is scrambled
1252 * \param p_mi the media player
1253 * \retval true current program is scrambled
1254 * \retval false current program is not scrambled
1256 * \version LibVLC 2.2.0 or later
1258 LIBVLC_API bool libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
1261 * Display the next frame (if supported)
1263 * \param p_mi the media player
1265 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
1268 * Navigate through DVD Menu
1270 * \param p_mi the Media Player
1271 * \param navigate the Navigation mode
1272 * \version libVLC 2.0.0 or later
1274 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
1275 unsigned navigate );
1278 * Set if, and how, the video title will be shown when media is played.
1280 * \param p_mi the media player
1281 * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
1282 * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
1283 * \version libVLC 2.1.0 or later
1285 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
1288 * Get the track list for one type
1290 * \version LibVLC 4.0.0 and later.
1292 * \note You need to call libvlc_media_parse_with_options() or play the media
1293 * at least once before calling this function. Not doing this will result in
1294 * an empty list.
1296 * \note This track list is a snapshot of the current tracks when this function
1297 * is called. If a track is updated after this call, the user will need to call
1298 * this function again to get the updated track.
1301 * The track list can be used to get track informations and to select specific
1302 * tracks.
1304 * \param p_mi the media player
1305 * \param type type of the track list to request
1307 * \return a valid libvlc_media_tracklist_t or NULL in case of error, if there
1308 * is no track for a category, the returned list will have a size of 0, delete
1309 * with libvlc_media_tracklist_delete()
1311 LIBVLC_API libvlc_media_tracklist_t *
1312 libvlc_media_player_get_tracklist( libvlc_media_player_t *p_mi,
1313 libvlc_track_type_t type );
1317 * Get the selected track for one type
1319 * \version LibVLC 4.0.0 and later.
1321 * \warning More than one tracks can be selected for one type. In that case,
1322 * libvlc_media_player_get_tracklist() should be used.
1324 * \param p_mi the media player
1325 * \param type type of the selected track
1327 * \return a valid track or NULL if there is no selected tracks for this type,
1328 * release it with libvlc_media_track_delete().
1330 LIBVLC_API libvlc_media_track_t *
1331 libvlc_media_player_get_selected_track( libvlc_media_player_t *p_mi,
1332 libvlc_track_type_t type );
1335 * Get a track from a track id
1337 * \version LibVLC 4.0.0 and later.
1339 * This function can be used to get the last updated informations of a track.
1341 * \param p_mi the media player
1342 * \param psz_id valid string representing a track id (cf. psz_id from \ref
1343 * libvlc_media_track_t)
1345 * \return a valid track or NULL if there is currently no tracks identified by
1346 * the string id, release it with libvlc_media_track_delete().
1348 LIBVLC_API libvlc_media_track_t *
1349 libvlc_media_player_get_track_from_id( libvlc_media_player_t *p_mi,
1350 const char *psz_id );
1354 * Select a track or unselect all tracks for one type
1356 * \version LibVLC 4.0.0 and later.
1358 * \note Use libvlc_media_player_update_tracklist() for finer track selection
1359 * control.
1361 * \param p_mi the media player
1362 * \param type type of the selected track
1363 * \param track track to select or NULL to unselect all tracks of for this type
1365 LIBVLC_API void
1366 libvlc_media_player_select_track( libvlc_media_player_t *p_mi,
1367 libvlc_track_type_t type,
1368 const libvlc_media_track_t *track );
1371 * Select tracks by their string identifier
1373 * \version LibVLC 4.0.0 and later.
1375 * This function can be used pre-select a list of tracks before starting the
1376 * player. It has only effect for the current media. It can also be used when
1377 * the player is already started.
1379 * 'str_ids' can contain more than one track id, delimited with ','. "" or any
1380 * invalid track id will cause the player to unselect all tracks of that
1381 * category. NULL will disable the preference for newer tracks without
1382 * unselecting any current tracks.
1384 * Example:
1385 * - (libvlc_track_video, "video/1,video/2") will select these 2 video tracks.
1386 * If there is only one video track with the id "video/0", no tracks will be
1387 * selected.
1388 * - (libvlc_track_type_t, "${slave_url_md5sum}/spu/0) will select one spu
1389 * added by an input slave with the corresponding url.
1391 * \note The string identifier of a track can be found via psz_id from \ref
1392 * libvlc_media_track_t
1394 * \param p_mi the media player
1395 * \param type type to select
1396 * \param psz_ids list of string identifier or NULL
1398 LIBVLC_API void
1399 libvlc_media_player_select_tracks_by_ids( libvlc_media_player_t *p_mi,
1400 libvlc_track_type_t type,
1401 const char *psz_ids );
1404 * Update the track selection for one type
1406 * This function allow to select or unselect multiple tracks using the
1407 * track list returned by libvlc_media_player_get_tracklist(). The user can
1408 * iterate on all or few libvlc_media_track_t from this list and change the
1409 * 'selected' boolean before calling this function.
1411 * \note The internal track list can change between the calls of
1412 * libvlc_media_player_get_tracklist() and
1413 * libvlc_media_player_update_tracklist(). If a track selection change but the
1414 * track is not present anymore, the player will just ignore it.
1416 * \param p_mi the media player
1417 * \param type type of the selected track
1418 * \param list list returned by libvlc_media_player_get_tracklist()
1420 LIBVLC_API void
1421 libvlc_media_player_update_tracklist( libvlc_media_player_t *p_mi,
1422 libvlc_track_type_t type,
1423 libvlc_media_tracklist_t *list );
1426 * Add a slave to the current media player.
1428 * \note If the player is playing, the slave will be added directly. This call
1429 * will also update the slave list of the attached libvlc_media_t.
1431 * \version LibVLC 3.0.0 and later.
1433 * \see libvlc_media_slaves_add
1435 * \param p_mi the media player
1436 * \param i_type subtitle or audio
1437 * \param psz_uri Uri of the slave (should contain a valid scheme).
1438 * \param b_select True if this slave should be selected when it's loaded
1440 * \return 0 on success, -1 on error.
1442 LIBVLC_API
1443 int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
1444 libvlc_media_slave_type_t i_type,
1445 const char *psz_uri, bool b_select );
1448 * Release (free) libvlc_track_description_t
1450 * \param p_track_description the structure to release
1452 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
1454 /** \defgroup libvlc_video LibVLC video controls
1455 * @{
1459 * Toggle fullscreen status on non-embedded video outputs.
1461 * @warning The same limitations applies to this function
1462 * as to libvlc_set_fullscreen().
1464 * \param p_mi the media player
1466 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
1469 * Enable or disable fullscreen.
1471 * @warning With most window managers, only a top-level windows can be in
1472 * full-screen mode. Hence, this function will not operate properly if
1473 * libvlc_media_player_set_xwindow() was used to embed the video in a
1474 * non-top-level window. In that case, the embedding window must be reparented
1475 * to the root window <b>before</b> fullscreen mode is enabled. You will want
1476 * to reparent it back to its normal parent when disabling fullscreen.
1478 * \note This setting applies to any and all current or future active video
1479 * tracks and windows for the given media player. The choice of fullscreen
1480 * output for each window is left to the operating system.
1482 * \param p_mi the media player
1483 * \param b_fullscreen boolean for fullscreen status
1485 LIBVLC_API void libvlc_set_fullscreen(libvlc_media_player_t *p_mi, bool b_fullscreen);
1488 * Get current fullscreen status.
1490 * \param p_mi the media player
1491 * \return the fullscreen status (boolean)
1493 * \retval false media player is windowed
1494 * \retval true media player is in fullscreen mode
1496 LIBVLC_API bool libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
1499 * Enable or disable key press events handling, according to the LibVLC hotkeys
1500 * configuration. By default and for historical reasons, keyboard events are
1501 * handled by the LibVLC video widget.
1503 * \note On X11, there can be only one subscriber for key press and mouse
1504 * click events per window. If your application has subscribed to those events
1505 * for the X window ID of the video widget, then LibVLC will not be able to
1506 * handle key presses and mouse clicks in any case.
1508 * \warning This function is only implemented for X11 and Win32 at the moment.
1510 * \param p_mi the media player
1511 * \param on true to handle key press events, false to ignore them.
1513 LIBVLC_API
1514 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
1517 * Enable or disable mouse click events handling. By default, those events are
1518 * handled. This is needed for DVD menus to work, as well as a few video
1519 * filters such as "puzzle".
1521 * \see libvlc_video_set_key_input().
1523 * \warning This function is only implemented for X11 and Win32 at the moment.
1525 * \param p_mi the media player
1526 * \param on true to handle mouse click events, false to ignore them.
1528 LIBVLC_API
1529 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
1532 * Get the pixel dimensions of a video.
1534 * \param p_mi media player
1535 * \param num number of the video (starting from, and most commonly 0)
1536 * \param px pointer to get the pixel width [OUT]
1537 * \param py pointer to get the pixel height [OUT]
1538 * \return 0 on success, -1 if the specified video does not exist
1540 LIBVLC_API
1541 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
1542 unsigned *px, unsigned *py );
1545 * Get the mouse pointer coordinates over a video.
1546 * Coordinates are expressed in terms of the decoded video resolution,
1547 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
1548 * you can query your windowing system directly).
1550 * Either of the coordinates may be negative or larger than the corresponding
1551 * dimension of the video, if the cursor is outside the rendering area.
1553 * @warning The coordinates may be out-of-date if the pointer is not located
1554 * on the video rendering area. LibVLC does not track the pointer if it is
1555 * outside of the video widget.
1557 * @note LibVLC does not support multiple pointers (it does of course support
1558 * multiple input devices sharing the same pointer) at the moment.
1560 * \param p_mi media player
1561 * \param num number of the video (starting from, and most commonly 0)
1562 * \param px pointer to get the abscissa [OUT]
1563 * \param py pointer to get the ordinate [OUT]
1564 * \return 0 on success, -1 if the specified video does not exist
1566 LIBVLC_API
1567 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1568 int *px, int *py );
1571 * Get the current video scaling factor.
1572 * See also libvlc_video_set_scale().
1574 * \param p_mi the media player
1575 * \return the currently configured zoom factor, or 0. if the video is set
1576 * to fit to the output window/drawable automatically.
1578 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1581 * Set the video scaling factor. That is the ratio of the number of pixels on
1582 * screen to the number of pixels in the original decoded video in each
1583 * dimension. Zero is a special value; it will adjust the video to the output
1584 * window/drawable (in windowed mode) or the entire screen.
1586 * Note that not all video outputs support scaling.
1588 * \param p_mi the media player
1589 * \param f_factor the scaling factor, or zero
1591 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1594 * Get current video aspect ratio.
1596 * \param p_mi the media player
1597 * \return the video aspect ratio or NULL if unspecified
1598 * (the result must be released with free() or libvlc_free()).
1600 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1603 * Set new video aspect ratio.
1605 * \param p_mi the media player
1606 * \param psz_aspect new video aspect-ratio or NULL to reset to default
1607 * \note Invalid aspect ratios are ignored.
1609 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1612 * Create a video viewpoint structure.
1614 * \version LibVLC 3.0.0 and later
1616 * \return video viewpoint or NULL
1617 * (the result must be released with free()).
1619 LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
1622 * Update the video viewpoint information.
1624 * \note It is safe to call this function before the media player is started.
1626 * \version LibVLC 3.0.0 and later
1628 * \param p_mi the media player
1629 * \param p_viewpoint video viewpoint allocated via libvlc_video_new_viewpoint()
1630 * \param b_absolute if true replace the old viewpoint with the new one. If
1631 * false, increase/decrease it.
1632 * \return -1 in case of error, 0 otherwise
1634 * \note the values are set asynchronously, it will be used by the next frame displayed.
1636 LIBVLC_API int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
1637 const libvlc_video_viewpoint_t *p_viewpoint,
1638 bool b_absolute);
1641 * Get current video subtitle.
1643 * \param p_mi the media player
1644 * \return the video subtitle selected, or -1 if none
1646 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1649 * Get the number of available video subtitles.
1651 * \param p_mi the media player
1652 * \return the number of available video subtitles
1654 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1657 * Get the description of available video subtitles.
1659 * \param p_mi the media player
1660 * \return list containing description of available video subtitles.
1661 * It must be freed with libvlc_track_description_list_release()
1663 LIBVLC_API libvlc_track_description_t *
1664 libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1667 * Set new video subtitle.
1669 * \param p_mi the media player
1670 * \param i_spu video subtitle track to select (i_id from track description)
1671 * \return 0 on success, -1 if out of range
1673 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1676 * Get the current subtitle delay. Positive values means subtitles are being
1677 * displayed later, negative values earlier.
1679 * \param p_mi media player
1680 * \return time (in microseconds) the display of subtitles is being delayed
1681 * \version LibVLC 2.0.0 or later
1683 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1686 * Set the subtitle text scale.
1688 * The scale factor is expressed as a percentage of the default size, where
1689 * 1.0 represents 100 percent.
1691 * A value of 0.5 would result in text half the normal size, and a value of 2.0
1692 * would result in text twice the normal size.
1694 * The minimum acceptable value for the scale factor is 0.1.
1696 * The maximum is 5.0 (five times normal size).
1698 * \param p_mi media player
1699 * \param f_scale scale factor in the range [0.1;5.0] (default: 1.0)
1700 * \version LibVLC 4.0.0 or later
1702 LIBVLC_API void libvlc_video_set_spu_text_scale( libvlc_media_player_t *p_mi, float f_scale );
1705 * Set the subtitle delay. This affects the timing of when the subtitle will
1706 * be displayed. Positive values result in subtitles being displayed later,
1707 * while negative values will result in subtitles being displayed earlier.
1709 * The subtitle delay will be reset to zero each time the media changes.
1711 * \param p_mi media player
1712 * \param i_delay time (in microseconds) the display of subtitles should be delayed
1713 * \return 0 on success, -1 on error
1714 * \version LibVLC 2.0.0 or later
1716 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1719 * Get the full description of available titles
1721 * \version LibVLC 3.0.0 and later.
1723 * \param p_mi the media player
1724 * \param titles address to store an allocated array of title descriptions
1725 * descriptions (must be freed with libvlc_title_descriptions_release()
1726 * by the caller) [OUT]
1728 * \return the number of titles (-1 on error)
1730 LIBVLC_API int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi,
1731 libvlc_title_description_t ***titles );
1734 * Release a title description
1736 * \version LibVLC 3.0.0 and later
1738 * \param p_titles title description array to release
1739 * \param i_count number of title descriptions to release
1741 LIBVLC_API
1742 void libvlc_title_descriptions_release( libvlc_title_description_t **p_titles,
1743 unsigned i_count );
1746 * Get the full description of available chapters
1748 * \version LibVLC 3.0.0 and later.
1750 * \param p_mi the media player
1751 * \param i_chapters_of_title index of the title to query for chapters (uses current title if set to -1)
1752 * \param pp_chapters address to store an allocated array of chapter descriptions
1753 * descriptions (must be freed with libvlc_chapter_descriptions_release()
1754 * by the caller) [OUT]
1756 * \return the number of chapters (-1 on error)
1758 LIBVLC_API int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_mi,
1759 int i_chapters_of_title,
1760 libvlc_chapter_description_t *** pp_chapters );
1763 * Release a chapter description
1765 * \version LibVLC 3.0.0 and later
1767 * \param p_chapters chapter description array to release
1768 * \param i_count number of chapter descriptions to release
1770 LIBVLC_API
1771 void libvlc_chapter_descriptions_release( libvlc_chapter_description_t **p_chapters,
1772 unsigned i_count );
1775 * Set/unset the video crop ratio.
1777 * This function forces a crop ratio on any and all video tracks rendered by
1778 * the media player. If the display aspect ratio of a video does not match the
1779 * crop ratio, either the top and bottom, or the left and right of the video
1780 * will be cut out to fit the crop ratio.
1782 * For instance, a ratio of 1:1 will force the video to a square shape.
1784 * To disable video crop, set a crop ratio with zero as denominator.
1786 * A call to this function overrides any previous call to any of
1787 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1788 * libvlc_video_set_crop_window().
1790 * \see libvlc_video_set_aspect_ratio()
1792 * \param mp the media player
1793 * \param num crop ratio numerator (ignored if denominator is 0)
1794 * \param den crop ratio denominator (or 0 to unset the crop ratio)
1796 * \version LibVLC 4.0.0 and later
1798 LIBVLC_API
1799 void libvlc_video_set_crop_ratio(libvlc_media_player_t *mp,
1800 unsigned num, unsigned den);
1803 * Set the video crop window.
1805 * This function selects a sub-rectangle of video to show. Any pixels outside
1806 * the rectangle will not be shown.
1808 * To unset the video crop window, use libvlc_video_set_crop_ratio() or
1809 * libvlc_video_set_crop_border().
1811 * A call to this function overrides any previous call to any of
1812 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1813 * libvlc_video_set_crop_window().
1815 * \param mp the media player
1816 * \param x abscissa (i.e. leftmost sample column offset) of the crop window
1817 * \param y ordinate (i.e. topmost sample row offset) of the crop window
1818 * \param width sample width of the crop window (cannot be zero)
1819 * \param height sample height of the crop window (cannot be zero)
1821 * \version LibVLC 4.0.0 and later
1823 LIBVLC_API
1824 void libvlc_video_set_crop_window(libvlc_media_player_t *mp,
1825 unsigned x, unsigned y,
1826 unsigned width, unsigned height);
1829 * Set the video crop borders.
1831 * This function selects the size of video edges to be cropped out.
1833 * To unset the video crop borders, set all borders to zero.
1835 * A call to this function overrides any previous call to any of
1836 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1837 * libvlc_video_set_crop_window().
1839 * \param mp the media player
1840 * \param left number of sample columns to crop on the left
1841 * \param right number of sample columns to crop on the right
1842 * \param top number of sample rows to crop on the top
1843 * \param bottom number of sample rows to corp on the bottom
1845 * \version LibVLC 4.0.0 and later
1847 LIBVLC_API
1848 void libvlc_video_set_crop_border(libvlc_media_player_t *mp,
1849 unsigned left, unsigned right,
1850 unsigned top, unsigned bottom);
1853 * Get current teletext page requested or 0 if it's disabled.
1855 * Teletext is disabled by default, call libvlc_video_set_teletext() to enable
1856 * it.
1858 * \param p_mi the media player
1859 * \return the current teletext page requested.
1861 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1864 * Set new teletext page to retrieve.
1866 * This function can also be used to send a teletext key.
1868 * \param p_mi the media player
1869 * \param i_page teletex page number requested. This value can be 0 to disable
1870 * teletext, a number in the range ]0;1000[ to show the requested page, or a
1871 * \ref libvlc_teletext_key_t. 100 is the default teletext page.
1873 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1876 * Get number of available video tracks.
1878 * \param p_mi media player
1879 * \return the number of available video tracks (int)
1881 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1884 * Get the description of available video tracks.
1886 * \param p_mi media player
1887 * \return list with description of available video tracks, or NULL on error.
1888 * It must be freed with libvlc_track_description_list_release()
1890 LIBVLC_API libvlc_track_description_t *
1891 libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1894 * Get current video track.
1896 * \param p_mi media player
1897 * \return the video track ID (int) or -1 if no active input
1899 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1902 * Set video track.
1904 * \param p_mi media player
1905 * \param i_track the track ID (i_id field from track description)
1906 * \return 0 on success, -1 if out of range
1908 LIBVLC_API
1909 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1912 * Take a snapshot of the current video window.
1914 * If i_width AND i_height is 0, original size is used.
1915 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1917 * \param p_mi media player instance
1918 * \param num number of video output (typically 0 for the first/only one)
1919 * \param psz_filepath the path of a file or a folder to save the screenshot into
1920 * \param i_width the snapshot's width
1921 * \param i_height the snapshot's height
1922 * \return 0 on success, -1 if the video was not found
1924 LIBVLC_API
1925 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1926 const char *psz_filepath, unsigned int i_width,
1927 unsigned int i_height );
1930 * Enable or disable deinterlace filter
1932 * \param p_mi libvlc media player
1933 * \param deinterlace state -1: auto (default), 0: disabled, 1: enabled
1934 * \param psz_mode type of deinterlace filter, NULL for current/default filter
1935 * \version LibVLC 4.0.0 and later
1937 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1938 int deinterlace,
1939 const char *psz_mode );
1942 * Get an integer marquee option value
1944 * \param p_mi libvlc media player
1945 * \param option marq option to get \see libvlc_video_marquee_option_t
1947 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1948 unsigned option );
1951 * Enable, disable or set an integer marquee option
1953 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1954 * or disabling (arg 0) the marq filter.
1956 * \param p_mi libvlc media player
1957 * \param option marq option to set \see libvlc_video_marquee_option_t
1958 * \param i_val marq option value
1960 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1961 unsigned option, int i_val );
1964 * Set a marquee string option
1966 * \param p_mi libvlc media player
1967 * \param option marq option to set \see libvlc_video_marquee_option_t
1968 * \param psz_text marq option value
1970 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1971 unsigned option, const char *psz_text );
1973 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1974 enum libvlc_video_logo_option_t {
1975 libvlc_logo_enable,
1976 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
1977 libvlc_logo_x,
1978 libvlc_logo_y,
1979 libvlc_logo_delay,
1980 libvlc_logo_repeat,
1981 libvlc_logo_opacity,
1982 libvlc_logo_position
1986 * Get integer logo option.
1988 * \param p_mi libvlc media player instance
1989 * \param option logo option to get, values of libvlc_video_logo_option_t
1991 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1992 unsigned option );
1995 * Set logo option as integer. Options that take a different type value
1996 * are ignored.
1997 * Passing libvlc_logo_enable as option value has the side effect of
1998 * starting (arg !0) or stopping (arg 0) the logo filter.
2000 * \param p_mi libvlc media player instance
2001 * \param option logo option to set, values of libvlc_video_logo_option_t
2002 * \param value logo option value
2004 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
2005 unsigned option, int value );
2008 * Set logo option as string. Options that take a different type value
2009 * are ignored.
2011 * \param p_mi libvlc media player instance
2012 * \param option logo option to set, values of libvlc_video_logo_option_t
2013 * \param psz_value logo option value
2015 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
2016 unsigned option, const char *psz_value );
2019 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
2020 enum libvlc_video_adjust_option_t {
2021 libvlc_adjust_Enable = 0,
2022 libvlc_adjust_Contrast,
2023 libvlc_adjust_Brightness,
2024 libvlc_adjust_Hue,
2025 libvlc_adjust_Saturation,
2026 libvlc_adjust_Gamma
2030 * Get integer adjust option.
2032 * \param p_mi libvlc media player instance
2033 * \param option adjust option to get, values of libvlc_video_adjust_option_t
2034 * \version LibVLC 1.1.1 and later.
2036 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
2037 unsigned option );
2040 * Set adjust option as integer. Options that take a different type value
2041 * are ignored.
2042 * Passing libvlc_adjust_enable as option value has the side effect of
2043 * starting (arg !0) or stopping (arg 0) the adjust filter.
2045 * \param p_mi libvlc media player instance
2046 * \param option adust option to set, values of libvlc_video_adjust_option_t
2047 * \param value adjust option value
2048 * \version LibVLC 1.1.1 and later.
2050 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
2051 unsigned option, int value );
2054 * Get float adjust option.
2056 * \param p_mi libvlc media player instance
2057 * \param option adjust option to get, values of libvlc_video_adjust_option_t
2058 * \version LibVLC 1.1.1 and later.
2060 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
2061 unsigned option );
2064 * Set adjust option as float. Options that take a different type value
2065 * are ignored.
2067 * \param p_mi libvlc media player instance
2068 * \param option adust option to set, values of libvlc_video_adjust_option_t
2069 * \param value adjust option value
2070 * \version LibVLC 1.1.1 and later.
2072 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
2073 unsigned option, float value );
2075 /** @} video */
2077 /** \defgroup libvlc_audio LibVLC audio controls
2078 * @{
2082 * Audio channels
2084 typedef enum libvlc_audio_output_channel_t {
2085 libvlc_AudioChannel_Error = -1,
2086 libvlc_AudioChannel_Stereo = 1,
2087 libvlc_AudioChannel_RStereo = 2,
2088 libvlc_AudioChannel_Left = 3,
2089 libvlc_AudioChannel_Right = 4,
2090 libvlc_AudioChannel_Dolbys = 5
2091 } libvlc_audio_output_channel_t;
2095 * Gets the list of available audio output modules.
2097 * \param p_instance libvlc instance
2098 * \return list of available audio outputs. It must be freed with
2099 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
2100 * In case of error, NULL is returned.
2102 LIBVLC_API libvlc_audio_output_t *
2103 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
2106 * Frees the list of available audio output modules.
2108 * \param p_list list with audio outputs for release
2110 LIBVLC_API
2111 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
2114 * Selects an audio output module.
2115 * \note Any change will take be effect only after playback is stopped and
2116 * restarted. Audio output cannot be changed while playing.
2118 * \param p_mi media player
2119 * \param psz_name name of audio output,
2120 * use psz_name of \see libvlc_audio_output_t
2121 * \return 0 if function succeeded, -1 on error
2123 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
2124 const char *psz_name );
2127 * Gets a list of potential audio output devices,
2128 * \see libvlc_audio_output_device_set().
2130 * \note Not all audio outputs support enumerating devices.
2131 * The audio output may be functional even if the list is empty (NULL).
2133 * \note The list may not be exhaustive.
2135 * \warning Some audio output devices in the list might not actually work in
2136 * some circumstances. By default, it is recommended to not specify any
2137 * explicit audio device.
2139 * \param mp media player
2140 * \return A NULL-terminated linked list of potential audio output devices.
2141 * It must be freed with libvlc_audio_output_device_list_release()
2142 * \version LibVLC 2.2.0 or later.
2144 LIBVLC_API libvlc_audio_output_device_t *
2145 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
2148 * Gets a list of audio output devices for a given audio output module,
2149 * \see libvlc_audio_output_device_set().
2151 * \note Not all audio outputs support this. In particular, an empty (NULL)
2152 * list of devices does <b>not</b> imply that the specified audio output does
2153 * not work.
2155 * \note The list might not be exhaustive.
2157 * \warning Some audio output devices in the list might not actually work in
2158 * some circumstances. By default, it is recommended to not specify any
2159 * explicit audio device.
2161 * \param p_instance libvlc instance
2162 * \param aout audio output name
2163 * (as returned by libvlc_audio_output_list_get())
2164 * \return A NULL-terminated linked list of potential audio output devices.
2165 * It must be freed with libvlc_audio_output_device_list_release()
2166 * \version LibVLC 2.1.0 or later.
2168 LIBVLC_API libvlc_audio_output_device_t *
2169 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
2170 const char *aout );
2173 * Frees a list of available audio output devices.
2175 * \param p_list list with audio outputs for release
2176 * \version LibVLC 2.1.0 or later.
2178 LIBVLC_API void libvlc_audio_output_device_list_release(
2179 libvlc_audio_output_device_t *p_list );
2182 * Configures an explicit audio output device.
2184 * If the module paramater is NULL, audio output will be moved to the device
2185 * specified by the device identifier string immediately. This is the
2186 * recommended usage.
2188 * A list of adequate potential device strings can be obtained with
2189 * libvlc_audio_output_device_enum().
2191 * However passing NULL is supported in LibVLC version 2.2.0 and later only;
2192 * in earlier versions, this function would have no effects when the module
2193 * parameter was NULL.
2195 * If the module parameter is not NULL, the device parameter of the
2196 * corresponding audio output, if it exists, will be set to the specified
2197 * string. Note that some audio output modules do not have such a parameter
2198 * (notably MMDevice and PulseAudio).
2200 * A list of adequate potential device strings can be obtained with
2201 * libvlc_audio_output_device_list_get().
2203 * \note This function does not select the specified audio output plugin.
2204 * libvlc_audio_output_set() is used for that purpose.
2206 * \warning The syntax for the device parameter depends on the audio output.
2208 * Some audio output modules require further parameters (e.g. a channels map
2209 * in the case of ALSA).
2211 * \param mp media player
2212 * \param module If NULL, current audio output module.
2213 * if non-NULL, name of audio output module
2214 (\see libvlc_audio_output_t)
2215 * \param device_id device identifier string
2216 * \return Nothing. Errors are ignored (this is a design bug).
2218 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
2219 const char *module,
2220 const char *device_id );
2223 * Get the current audio output device identifier.
2225 * This complements libvlc_audio_output_device_set().
2227 * \warning The initial value for the current audio output device identifier
2228 * may not be set or may be some unknown value. A LibVLC application should
2229 * compare this value against the known device identifiers (e.g. those that
2230 * were previously retrieved by a call to libvlc_audio_output_device_enum or
2231 * libvlc_audio_output_device_list_get) to find the current audio output device.
2233 * It is possible that the selected audio output device changes (an external
2234 * change) without a call to libvlc_audio_output_device_set. That may make this
2235 * method unsuitable to use if a LibVLC application is attempting to track
2236 * dynamic audio device changes as they happen.
2238 * \param mp media player
2239 * \return the current audio output device identifier
2240 * NULL if no device is selected or in case of error
2241 * (the result must be released with free()).
2242 * \version LibVLC 3.0.0 or later.
2244 LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
2247 * Toggle mute status.
2249 * \param p_mi media player
2250 * \warning Toggling mute atomically is not always possible: On some platforms,
2251 * other processes can mute the VLC audio playback stream asynchronously. Thus,
2252 * there is a small race condition where toggling will not work.
2253 * See also the limitations of libvlc_audio_set_mute().
2255 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
2258 * Get current mute status.
2260 * \param p_mi media player
2261 * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
2263 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
2266 * Set mute status.
2268 * \param p_mi media player
2269 * \param status If status is true then mute, otherwise unmute
2270 * \warning This function does not always work. If there are no active audio
2271 * playback stream, the mute status might not be available. If digital
2272 * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
2273 * some audio output plugins do not support muting at all.
2274 * \note To force silent playback, disable all audio tracks. This is more
2275 * efficient and reliable than mute.
2277 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
2280 * Get current software audio volume.
2282 * \param p_mi media player
2283 * \return the software volume in percents
2284 * (0 = mute, 100 = nominal / 0dB)
2286 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
2289 * Set current software audio volume.
2291 * \param p_mi media player
2292 * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
2293 * \return 0 if the volume was set, -1 if it was out of range
2295 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
2298 * Get number of available audio tracks.
2300 * \param p_mi media player
2301 * \return the number of available audio tracks (int), or -1 if unavailable
2303 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
2306 * Get the description of available audio tracks.
2308 * \param p_mi media player
2309 * \return list with description of available audio tracks, or NULL.
2310 * It must be freed with libvlc_track_description_list_release()
2312 LIBVLC_API libvlc_track_description_t *
2313 libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
2316 * Get current audio track.
2318 * \param p_mi media player
2319 * \return the audio track ID or -1 if no active input.
2321 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
2324 * Set current audio track.
2326 * \param p_mi media player
2327 * \param i_track the track ID (i_id field from track description)
2328 * \return 0 on success, -1 on error
2330 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
2333 * Get current audio channel.
2335 * \param p_mi media player
2336 * \return the audio channel \see libvlc_audio_output_channel_t
2338 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
2341 * Set current audio channel.
2343 * \param p_mi media player
2344 * \param channel the audio channel, \see libvlc_audio_output_channel_t
2345 * \return 0 on success, -1 on error
2347 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
2350 * Get current audio delay.
2352 * \param p_mi media player
2353 * \return the audio delay (microseconds)
2354 * \version LibVLC 1.1.1 or later
2356 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
2359 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
2361 * \param p_mi media player
2362 * \param i_delay the audio delay (microseconds)
2363 * \return 0 on success, -1 on error
2364 * \version LibVLC 1.1.1 or later
2366 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
2369 * Get the number of equalizer presets.
2371 * \return number of presets
2372 * \version LibVLC 2.2.0 or later
2374 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
2377 * Get the name of a particular equalizer preset.
2379 * This name can be used, for example, to prepare a preset label or menu in a user
2380 * interface.
2382 * \param u_index index of the preset, counting from zero
2383 * \return preset name, or NULL if there is no such preset
2384 * \version LibVLC 2.2.0 or later
2386 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
2389 * Get the number of distinct frequency bands for an equalizer.
2391 * \return number of frequency bands
2392 * \version LibVLC 2.2.0 or later
2394 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
2397 * Get a particular equalizer band frequency.
2399 * This value can be used, for example, to create a label for an equalizer band control
2400 * in a user interface.
2402 * \param u_index index of the band, counting from zero
2403 * \return equalizer band frequency (Hz), or -1 if there is no such band
2404 * \version LibVLC 2.2.0 or later
2406 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
2409 * Create a new default equalizer, with all frequency values zeroed.
2411 * The new equalizer can subsequently be applied to a media player by invoking
2412 * libvlc_media_player_set_equalizer().
2414 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2415 * it is no longer needed.
2417 * \return opaque equalizer handle, or NULL on error
2418 * \version LibVLC 2.2.0 or later
2420 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
2423 * Create a new equalizer, with initial frequency values copied from an existing
2424 * preset.
2426 * The new equalizer can subsequently be applied to a media player by invoking
2427 * libvlc_media_player_set_equalizer().
2429 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2430 * it is no longer needed.
2432 * \param u_index index of the preset, counting from zero
2433 * \return opaque equalizer handle, or NULL on error
2434 * (it must be released with libvlc_audio_equalizer_release())
2435 * \version LibVLC 2.2.0 or later
2437 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
2440 * Release a previously created equalizer instance.
2442 * The equalizer was previously created by using libvlc_audio_equalizer_new() or
2443 * libvlc_audio_equalizer_new_from_preset().
2445 * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
2447 * \param p_equalizer opaque equalizer handle, or NULL
2448 * \version LibVLC 2.2.0 or later
2450 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
2453 * Set a new pre-amplification value for an equalizer.
2455 * The new equalizer settings are subsequently applied to a media player by invoking
2456 * libvlc_media_player_set_equalizer().
2458 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2460 * \param p_equalizer valid equalizer handle, must not be NULL
2461 * \param f_preamp preamp value (-20.0 to 20.0 Hz)
2462 * \return zero on success, -1 on error
2463 * \version LibVLC 2.2.0 or later
2465 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
2468 * Get the current pre-amplification value from an equalizer.
2470 * \param p_equalizer valid equalizer handle, must not be NULL
2471 * \return preamp value (Hz)
2472 * \version LibVLC 2.2.0 or later
2474 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
2477 * Set a new amplification value for a particular equalizer frequency band.
2479 * The new equalizer settings are subsequently applied to a media player by invoking
2480 * libvlc_media_player_set_equalizer().
2482 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2484 * \param p_equalizer valid equalizer handle, must not be NULL
2485 * \param f_amp amplification value (-20.0 to 20.0 Hz)
2486 * \param u_band index, counting from zero, of the frequency band to set
2487 * \return zero on success, -1 on error
2488 * \version LibVLC 2.2.0 or later
2490 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
2493 * Get the amplification value for a particular equalizer frequency band.
2495 * \param p_equalizer valid equalizer handle, must not be NULL
2496 * \param u_band index, counting from zero, of the frequency band to get
2497 * \return amplification value (Hz); NaN if there is no such frequency band
2498 * \version LibVLC 2.2.0 or later
2500 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
2503 * Apply new equalizer settings to a media player.
2505 * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
2506 * libvlc_audio_equalizer_new_from_preset().
2508 * It is possible to apply new equalizer settings to a media player whether the media
2509 * player is currently playing media or not.
2511 * Invoking this method will immediately apply the new equalizer settings to the audio
2512 * output of the currently playing media if there is any.
2514 * If there is no currently playing media, the new equalizer settings will be applied
2515 * later if and when new media is played.
2517 * Equalizer settings will automatically be applied to subsequently played media.
2519 * To disable the equalizer for a media player invoke this method passing NULL for the
2520 * p_equalizer parameter.
2522 * The media player does not keep a reference to the supplied equalizer so it is safe
2523 * for an application to release the equalizer reference any time after this method
2524 * returns.
2526 * \param p_mi opaque media player handle
2527 * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
2528 * \return zero on success, -1 on error
2529 * \version LibVLC 2.2.0 or later
2531 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
2534 * Media player roles.
2536 * \version LibVLC 3.0.0 and later.
2538 * See \ref libvlc_media_player_set_role()
2540 typedef enum libvlc_media_player_role {
2541 libvlc_role_None = 0, /**< Don't use a media player role */
2542 libvlc_role_Music, /**< Music (or radio) playback */
2543 libvlc_role_Video, /**< Video playback */
2544 libvlc_role_Communication, /**< Speech, real-time communication */
2545 libvlc_role_Game, /**< Video game */
2546 libvlc_role_Notification, /**< User interaction feedback */
2547 libvlc_role_Animation, /**< Embedded animation (e.g. in web page) */
2548 libvlc_role_Production, /**< Audio editting/production */
2549 libvlc_role_Accessibility, /**< Accessibility */
2550 libvlc_role_Test /** Testing */
2551 #define libvlc_role_Last libvlc_role_Test
2552 } libvlc_media_player_role_t;
2555 * Gets the media role.
2557 * \version LibVLC 3.0.0 and later.
2559 * \param p_mi media player
2560 * \return the media player role (\ref libvlc_media_player_role_t)
2562 LIBVLC_API int libvlc_media_player_get_role(libvlc_media_player_t *p_mi);
2565 * Sets the media role.
2567 * \param p_mi media player
2568 * \param role the media player role (\ref libvlc_media_player_role_t)
2569 * \return 0 on success, -1 on error
2571 LIBVLC_API int libvlc_media_player_set_role(libvlc_media_player_t *p_mi,
2572 unsigned role);
2574 /** @} audio */
2576 /** @} media_player */
2578 # ifdef __cplusplus
2580 # endif
2582 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */