qt: playlist: use item title if available
[vlc.git] / include / vlc / libvlc_media_player.h
blob13b9f68ab149116d0fca63a789194e62eea9aff5
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 titles
47 enum
49 libvlc_title_menu = 0x01,
50 libvlc_title_interactive = 0x02
53 typedef struct libvlc_title_description_t
55 int64_t i_duration; /**< duration in milliseconds */
56 char *psz_name; /**< title name */
57 unsigned i_flags; /**< info if item was recognized as a menu, interactive or plain content by the demuxer */
58 } libvlc_title_description_t;
60 /**
61 * Description for chapters
63 typedef struct libvlc_chapter_description_t
65 int64_t i_time_offset; /**< time-offset of the chapter in milliseconds */
66 int64_t i_duration; /**< duration of the chapter in milliseconds */
67 char *psz_name; /**< chapter name */
68 } libvlc_chapter_description_t;
70 /**
71 * Description for audio output. It contains
72 * name, description and pointer to next record.
74 typedef struct libvlc_audio_output_t
76 char *psz_name;
77 char *psz_description;
78 struct libvlc_audio_output_t *p_next;
80 } libvlc_audio_output_t;
82 /**
83 * Description for audio output device.
85 typedef struct libvlc_audio_output_device_t
87 struct libvlc_audio_output_device_t *p_next; /**< Next entry in list */
88 char *psz_device; /**< Device identifier string */
89 char *psz_description; /**< User-friendly device description */
90 /* More fields may be added here in later versions */
91 } libvlc_audio_output_device_t;
93 /**
94 * Marq options definition
96 typedef enum libvlc_video_marquee_option_t {
97 libvlc_marquee_Enable = 0,
98 libvlc_marquee_Text, /** string argument */
99 libvlc_marquee_Color,
100 libvlc_marquee_Opacity,
101 libvlc_marquee_Position,
102 libvlc_marquee_Refresh,
103 libvlc_marquee_Size,
104 libvlc_marquee_Timeout,
105 libvlc_marquee_X,
106 libvlc_marquee_Y
107 } libvlc_video_marquee_option_t;
110 * Navigation mode
112 typedef enum libvlc_navigate_mode_t
114 libvlc_navigate_activate = 0,
115 libvlc_navigate_up,
116 libvlc_navigate_down,
117 libvlc_navigate_left,
118 libvlc_navigate_right,
119 libvlc_navigate_popup
120 } libvlc_navigate_mode_t;
123 * Enumeration of values used to set position (e.g. of video title).
125 typedef enum libvlc_position_t {
126 libvlc_position_disable=-1,
127 libvlc_position_center,
128 libvlc_position_left,
129 libvlc_position_right,
130 libvlc_position_top,
131 libvlc_position_top_left,
132 libvlc_position_top_right,
133 libvlc_position_bottom,
134 libvlc_position_bottom_left,
135 libvlc_position_bottom_right
136 } libvlc_position_t;
139 * Enumeration of teletext keys than can be passed via
140 * libvlc_video_set_teletext()
142 typedef enum libvlc_teletext_key_t {
143 libvlc_teletext_key_red = 'r' << 16,
144 libvlc_teletext_key_green = 'g' << 16,
145 libvlc_teletext_key_yellow = 'y' << 16,
146 libvlc_teletext_key_blue = 'b' << 16,
147 libvlc_teletext_key_index = 'i' << 16,
148 } libvlc_teletext_key_t;
151 * Opaque equalizer handle.
153 * Equalizer settings can be applied to a media player.
155 typedef struct libvlc_equalizer_t libvlc_equalizer_t;
158 * Create an empty Media Player object
160 * \param p_libvlc_instance the libvlc instance in which the Media Player
161 * should be created.
162 * \return a new media player object, or NULL on error.
163 * It must be released by libvlc_media_player_release().
165 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
168 * Create a Media Player object from a Media
170 * \param p_md the media. Afterwards the p_md can be safely
171 * destroyed.
172 * \return a new media player object, or NULL on error.
173 * It must be released by libvlc_media_player_release().
175 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
178 * Release a media_player after use
179 * Decrement the reference count of a media player object. If the
180 * reference count is 0, then libvlc_media_player_release() will
181 * release the media player object. If the media player object
182 * has been released, then it should not be used again.
184 * \param p_mi the Media Player to free
186 LIBVLC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
189 * Retain a reference to a media player object. Use
190 * libvlc_media_player_release() to decrement reference count.
192 * \param p_mi media player object
194 LIBVLC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
197 * Set the media that will be used by the media_player. If any,
198 * previous md will be released.
200 * \note The user should listen to the libvlc_MediaPlayerMediaChanged event, to
201 * know when the new media is actually used by the player (or to known that the
202 * older media is no longuer used).
204 * \param p_mi the Media Player
205 * \param p_md the Media. Afterwards the p_md can be safely
206 * destroyed.
208 LIBVLC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
209 libvlc_media_t *p_md );
212 * Get the media used by the media_player.
214 * \warning Calling this function just after libvlc_media_player_set_media()
215 * will return the media that was just set, but this media might not be
216 * currently used internally by the player. To detect such case, the user
217 * should listen to the libvlc_MediaPlayerMediaChanged event.
219 * \param p_mi the Media Player
220 * \return the media associated with p_mi, or NULL if no
221 * media is associated
223 LIBVLC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
226 * Get the Event Manager from which the media player send event.
228 * \param p_mi the Media Player
229 * \return the event manager associated with p_mi
231 LIBVLC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
234 * is_playing
236 * \param p_mi the Media Player
237 * \retval true media player is playing
238 * \retval false media player is not playing
240 LIBVLC_API bool libvlc_media_player_is_playing(libvlc_media_player_t *p_mi);
243 * Play
245 * \param p_mi the Media Player
246 * \return 0 if playback started (and was already started), or -1 on error.
248 LIBVLC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
251 * Pause or resume (no effect if there is no media)
253 * \param mp the Media Player
254 * \param do_pause play/resume if zero, pause if non-zero
255 * \version LibVLC 1.1.1 or later
257 LIBVLC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
258 int do_pause );
261 * Toggle pause (no effect if there is no media)
263 * \param p_mi the Media Player
265 LIBVLC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
268 * Stop asynchronously
270 * \note This function is asynchronous. In case of success, the user should
271 * wait for the libvlc_MediaPlayerStopped event to know when the stop is
272 * finished.
274 * \param p_mi the Media Player
275 * \return 0 if the player is being stopped, -1 otherwise (no-op)
276 * \version LibVLC 4.0.0 or later
278 LIBVLC_API int libvlc_media_player_stop_async ( libvlc_media_player_t *p_mi );
281 * Set a renderer to the media player
283 * \note must be called before the first call of libvlc_media_player_play() to
284 * take effect.
286 * \see libvlc_renderer_discoverer_new
288 * \param p_mi the Media Player
289 * \param p_item an item discovered by libvlc_renderer_discoverer_start()
290 * \return 0 on success, -1 on error.
291 * \version LibVLC 3.0.0 or later
293 LIBVLC_API int libvlc_media_player_set_renderer( libvlc_media_player_t *p_mi,
294 libvlc_renderer_item_t *p_item );
297 * Enumeration of the Video color primaries.
299 typedef enum libvlc_video_color_primaries_t {
300 libvlc_video_primaries_BT601_525 = 1,
301 libvlc_video_primaries_BT601_625 = 2,
302 libvlc_video_primaries_BT709 = 3,
303 libvlc_video_primaries_BT2020 = 4,
304 libvlc_video_primaries_DCI_P3 = 5,
305 libvlc_video_primaries_BT470_M = 6,
306 } libvlc_video_color_primaries_t;
309 * Enumeration of the Video color spaces.
311 typedef enum libvlc_video_color_space_t {
312 libvlc_video_colorspace_BT601 = 1,
313 libvlc_video_colorspace_BT709 = 2,
314 libvlc_video_colorspace_BT2020 = 3,
315 } libvlc_video_color_space_t;
318 * Enumeration of the Video transfer functions.
320 typedef enum libvlc_video_transfer_func_t {
321 libvlc_video_transfer_func_LINEAR = 1,
322 libvlc_video_transfer_func_SRGB = 2,
323 libvlc_video_transfer_func_BT470_BG = 3,
324 libvlc_video_transfer_func_BT470_M = 4,
325 libvlc_video_transfer_func_BT709 = 5,
326 libvlc_video_transfer_func_PQ = 6,
327 libvlc_video_transfer_func_SMPTE_240 = 7,
328 libvlc_video_transfer_func_HLG = 8,
329 } libvlc_video_transfer_func_t;
333 * Callback prototype to allocate and lock a picture buffer.
335 * Whenever a new video frame needs to be decoded, the lock callback is
336 * invoked. Depending on the video chroma, one or three pixel planes of
337 * adequate dimensions must be returned via the second parameter. Those
338 * planes must be aligned on 32-bytes boundaries.
340 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
341 * \param planes start address of the pixel planes (LibVLC allocates the array
342 * of void pointers, this callback must initialize the array) [OUT]
343 * \return a private pointer for the display and unlock callbacks to identify
344 * the picture buffers
346 typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
349 * Callback prototype to unlock a picture buffer.
351 * When the video frame decoding is complete, the unlock callback is invoked.
352 * This callback might not be needed at all. It is only an indication that the
353 * application can now read the pixel values if it needs to.
355 * \note A picture buffer is unlocked after the picture is decoded,
356 * but before the picture is displayed.
358 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
359 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
360 * callback [IN]
361 * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
362 * callback (this parameter is only for convenience) [IN]
364 typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
365 void *const *planes);
368 * Callback prototype to display a picture.
370 * When the video frame needs to be shown, as determined by the media playback
371 * clock, the display callback is invoked.
373 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
374 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
375 * callback [IN]
377 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
380 * Callback prototype to configure picture buffers format.
381 * This callback gets the format of the video as output by the video decoder
382 * and the chain of video filters (if any). It can opt to change any parameter
383 * as it needs. In that case, LibVLC will attempt to convert the video format
384 * (rescaling and chroma conversion) but these operations can be CPU intensive.
386 * \param opaque pointer to the private pointer passed to
387 * libvlc_video_set_callbacks() [IN/OUT]
388 * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
389 * \param width pointer to the buffer width in pixels[IN/OUT]
390 * \param height pointer to the buffer height in pixels[IN/OUT]
391 * \param pitches table of scanline pitches in bytes for each pixel plane
392 * (the table is allocated by LibVLC) [OUT]
393 * \param lines table of scanlines count for each plane [OUT]
394 * \return the number of picture buffers allocated, 0 indicates failure
396 * \version LibVLC 4.0.0 and later.
397 * \param (width+1) - pointer to display width in pixels[IN]
398 * \param (height+1) - pointer to display height in pixels[IN]
400 * \note
401 * For each pixels plane, the scanline pitch must be bigger than or equal to
402 * the number of bytes per pixel multiplied by the pixel width.
403 * Similarly, the number of scanlines must be bigger than of equal to
404 * the pixel height.
405 * Furthermore, we recommend that pitches and lines be multiple of 32
406 * to not break assumptions that might be held by optimized code
407 * in the video decoders, video filters and/or video converters.
409 typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
410 unsigned *width, unsigned *height,
411 unsigned *pitches,
412 unsigned *lines);
415 * Callback prototype to configure picture buffers format.
417 * \param opaque private pointer as passed to libvlc_video_set_format_callbacks()
418 * (and possibly modified by @ref libvlc_video_format_cb) [IN]
420 typedef void (*libvlc_video_cleanup_cb)(void *opaque);
424 * Set callbacks and private data to render decoded video to a custom area
425 * in memory.
426 * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
427 * to configure the decoded format.
429 * \warning Rendering video into custom memory buffers is considerably less
430 * efficient than rendering in a custom window as normal.
432 * For optimal perfomances, VLC media player renders into a custom window, and
433 * does not use this function and associated callbacks. It is <b>highly
434 * recommended</b> that other LibVLC-based application do likewise.
435 * To embed video in a window, use libvlc_media_player_set_xid() or equivalent
436 * depending on the operating system.
438 * If window embedding does not fit the application use case, then a custom
439 * LibVLC video output display plugin is required to maintain optimal video
440 * rendering performances.
442 * The following limitations affect performance:
443 * - Hardware video decoding acceleration will either be disabled completely,
444 * or require (relatively slow) copy from video/DSP memory to main memory.
445 * - Sub-pictures (subtitles, on-screen display, etc.) must be blent into the
446 * main picture by the CPU instead of the GPU.
447 * - Depending on the video format, pixel format conversion, picture scaling,
448 * cropping and/or picture re-orientation, must be performed by the CPU
449 * instead of the GPU.
450 * - Memory copying is required between LibVLC reference picture buffers and
451 * application buffers (between lock and unlock callbacks).
453 * \param mp the media player
454 * \param lock callback to lock video memory (must not be NULL)
455 * \param unlock callback to unlock video memory (or NULL if not needed)
456 * \param display callback to display video (or NULL if not needed)
457 * \param opaque private pointer for the three callbacks (as first parameter)
458 * \version LibVLC 1.1.1 or later
460 LIBVLC_API
461 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
462 libvlc_video_lock_cb lock,
463 libvlc_video_unlock_cb unlock,
464 libvlc_video_display_cb display,
465 void *opaque );
468 * Set decoded video chroma and dimensions.
469 * This only works in combination with libvlc_video_set_callbacks(),
470 * and is mutually exclusive with libvlc_video_set_format_callbacks().
472 * \param mp the media player
473 * \param chroma a four-characters string identifying the chroma
474 * (e.g. "RV32" or "YUYV")
475 * \param width pixel width
476 * \param height pixel height
477 * \param pitch line pitch (in bytes)
478 * \version LibVLC 1.1.1 or later
479 * \bug All pixel planes are expected to have the same pitch.
480 * To use the YCbCr color space with chrominance subsampling,
481 * consider using libvlc_video_set_format_callbacks() instead.
483 LIBVLC_API
484 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
485 unsigned width, unsigned height,
486 unsigned pitch );
489 * Set decoded video chroma and dimensions. This only works in combination with
490 * libvlc_video_set_callbacks().
492 * \param mp the media player
493 * \param setup callback to select the video format (cannot be NULL)
494 * \param cleanup callback to release any allocated resources (or NULL)
495 * \version LibVLC 2.0.0 or later
497 LIBVLC_API
498 void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
499 libvlc_video_format_cb setup,
500 libvlc_video_cleanup_cb cleanup );
503 typedef struct libvlc_video_setup_device_cfg_t
505 bool hardware_decoding; /** set if D3D11_CREATE_DEVICE_VIDEO_SUPPORT is needed for D3D11 */
506 } libvlc_video_setup_device_cfg_t;
508 typedef struct libvlc_video_setup_device_info_t
510 union {
511 struct {
512 void *device_context; /** ID3D11DeviceContext* */
513 void *context_mutex; /** Windows Mutex HANDLE to protect ID3D11DeviceContext usage */
514 } d3d11;
515 struct {
516 void *device; /** IDirect3D9* */
517 int adapter; /** Adapter to use with the IDirect3D9* */
518 } d3d9;
520 } libvlc_video_setup_device_info_t;
523 * Callback prototype called to initialize user data.
524 * Setup the rendering environment.
526 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks()
527 * on input. The callback can change this value on output to be
528 * passed to all the other callbacks set on @a libvlc_video_set_output_callbacks().
529 * [IN/OUT]
530 * \param cfg requested configuration of the video device [IN]
531 * \param out libvlc_video_setup_device_info_t* to fill [OUT]
532 * \return true on success
533 * \version LibVLC 4.0.0 or later
535 * For \ref libvlc_video_engine_d3d9 the output must be a IDirect3D9*.
536 * A reference to this object is held until the \ref libvlc_video_output_cleanup_cb is called.
537 * the device must be created with D3DPRESENT_PARAMETERS.hDeviceWindow set to 0.
539 * For \ref libvlc_video_engine_d3d11 the output must be a ID3D11DeviceContext*.
540 * A reference to this object is held until the \ref libvlc_video_output_cleanup_cb is called.
541 * The ID3D11Device used to create ID3D11DeviceContext must have multithreading enabled.
543 * If the ID3D11DeviceContext is used outside of the callbacks called by libvlc, the host
544 * MUST use a mutex to protect the access to the ID3D11DeviceContext of libvlc. This mutex
545 * value is set on d3d11.context_mutex. If the ID3D11DeviceContext is not used outside of
546 * the callbacks, the mutex d3d11.context_mutex may be NULL.
548 typedef bool (*libvlc_video_output_setup_cb)(void **opaque,
549 const libvlc_video_setup_device_cfg_t *cfg,
550 libvlc_video_setup_device_info_t *out);
554 * Callback prototype called to release user data
556 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
557 * \version LibVLC 4.0.0 or later
559 typedef void (*libvlc_video_output_cleanup_cb)(void* opaque);
561 typedef struct libvlc_video_render_cfg_t
563 unsigned width; /** rendering video width in pixel */
564 unsigned height; /** rendering video height in pixel */
565 unsigned bitdepth; /** rendering video bit depth in bits per channel */
566 bool full_range; /** video is full range or studio/limited range */
567 libvlc_video_color_space_t colorspace; /** video color space */
568 libvlc_video_color_primaries_t primaries; /** video color primaries */
569 libvlc_video_transfer_func_t transfer; /** video transfer function */
570 void *device; /** device used for rendering, IDirect3DDevice9* for D3D9 */
571 } libvlc_video_render_cfg_t;
573 typedef struct libvlc_video_output_cfg_t
575 union {
576 int dxgi_format; /** the rendering DXGI_FORMAT for \ref libvlc_video_engine_d3d11*/
577 uint32_t d3d9_format; /** the rendering D3DFORMAT for \ref libvlc_video_engine_d3d9 */
578 int opengl_format; /** the rendering GLint GL_RGBA or GL_RGB for \ref libvlc_video_engine_opengl and
579 for \ref libvlc_video_engine_gles2 */
580 void *p_surface; /** currently unused */
582 bool full_range; /** video is full range or studio/limited range */
583 libvlc_video_color_space_t colorspace; /** video color space */
584 libvlc_video_color_primaries_t primaries; /** video color primaries */
585 libvlc_video_transfer_func_t transfer; /** video transfer function */
586 } libvlc_video_output_cfg_t;
589 * Callback prototype called on video size changes.
590 * Update the rendering output setup.
592 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
593 * \param cfg configuration of the video that will be rendered [IN]
594 * \param output configuration describing with how the rendering is setup [OUT]
595 * \version LibVLC 4.0.0 or later
597 * \note the configuration device for Direct3D9 is the IDirect3DDevice9 that VLC
598 * uses to render. The host must set a Render target and call Present()
599 * when it needs the drawing from VLC to be done. This object is not valid
600 * anymore after Cleanup is called.
602 * Tone mapping, range and color conversion will be done depending on the values
603 * set in the output structure.
605 typedef bool (*libvlc_video_update_output_cb)(void* opaque, const libvlc_video_render_cfg_t *cfg,
606 libvlc_video_output_cfg_t *output );
610 * Callback prototype called after performing drawing calls.
612 * This callback is called outside of libvlc_video_makeCurrent_cb current/not-current
613 * calls.
615 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
616 * \version LibVLC 4.0.0 or later
618 typedef void (*libvlc_video_swap_cb)(void* opaque);
621 * Callback prototype to set up the OpenGL context for rendering.
622 * Tell the host the rendering is about to start/has finished.
624 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
625 * \param enter true to set the context as current, false to unset it [IN]
626 * \return true on success
627 * \version LibVLC 4.0.0 or later
629 * On Direct3D11 the following may change on the provided ID3D11DeviceContext*
630 * between \ref enter being true and \ref enter being false:
631 * - IASetPrimitiveTopology()
632 * - IASetInputLayout()
633 * - IASetVertexBuffers()
634 * - IASetIndexBuffer()
635 * - VSSetConstantBuffers()
636 * - VSSetShader()
637 * - PSSetSamplers()
638 * - PSSetConstantBuffers()
639 * - PSSetShaderResources()
640 * - PSSetShader()
641 * - RSSetViewports()
642 * - DrawIndexed()
644 typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter);
647 * Callback prototype to load opengl functions
649 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
650 * \param fct_name name of the opengl function to load
651 * \return a pointer to the named OpenGL function the NULL otherwise
652 * \version LibVLC 4.0.0 or later
654 typedef void* (*libvlc_video_getProcAddress_cb)(void* opaque, const char* fct_name);
656 typedef struct libvlc_video_frame_hdr10_metadata_t
658 /* similar to SMPTE ST 2086 mastering display color volume */
659 uint16_t RedPrimary[2];
660 uint16_t GreenPrimary[2];
661 uint16_t BluePrimary[2];
662 uint16_t WhitePoint[2];
663 unsigned int MaxMasteringLuminance;
664 unsigned int MinMasteringLuminance;
665 uint16_t MaxContentLightLevel;
666 uint16_t MaxFrameAverageLightLevel;
667 } libvlc_video_frame_hdr10_metadata_t;
669 typedef enum libvlc_video_metadata_type_t {
670 libvlc_video_metadata_frame_hdr10, /**< libvlc_video_frame_hdr10_metadata_t */
671 } libvlc_video_metadata_type_t;
674 * Callback prototype to receive metadata before rendering.
676 * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
677 * \param type type of data passed in metadata [IN]
678 * \param metadata the type of metadata [IN]
679 * \version LibVLC 4.0.0 or later
681 typedef void (*libvlc_video_frameMetadata_cb)(void* opaque, libvlc_video_metadata_type_t type, const void *metadata);
684 * Enumeration of the Video engine to be used on output.
685 * can be passed to @a libvlc_video_set_output_callbacks
687 typedef enum libvlc_video_engine_t {
688 /** Disable rendering engine */
689 libvlc_video_engine_disable,
690 libvlc_video_engine_opengl,
691 libvlc_video_engine_gles2,
692 /** Direct3D11 rendering engine */
693 libvlc_video_engine_d3d11,
694 /** Direct3D9 rendering engine */
695 libvlc_video_engine_d3d9,
696 } libvlc_video_engine_t;
698 /** Set the callback to call when the host app resizes the rendering area.
700 * This allows text rendering and aspect ratio to be handled properly when the host
701 * rendering size changes.
703 * It may be called before the \ref libvlc_video_output_setup_cb callback.
705 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
706 * \param report_size_change callback which must be called when the host size changes. [IN]
707 * The callback is valid until another call to \ref libvlc_video_output_set_resize_cb
708 * is done. This may be called from any thread.
709 * \param report_opaque private pointer to pass to the \ref report_size_change callback. [IN]
711 typedef void( *libvlc_video_output_set_resize_cb )( void *opaque,
712 void (*report_size_change)(void *report_opaque, unsigned width, unsigned height),
713 void *report_opaque );
715 /** Tell the host the rendering for the given plane is about to start
717 * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [IN]
718 * \param plane number of the rendering plane to select
719 * \param output handle of the rendering output for the given plane
720 * \return true on success
721 * \version LibVLC 4.0.0 or later
723 * \note This is only used with \ref libvlc_video_engine_d3d11.
725 * The output parameter receives the ID3D11RenderTargetView* to use for rendering
726 * the plane.
728 * If this callback is not used (set to NULL in @a libvlc_video_set_output_callbacks())
729 * OMSetRenderTargets has to be set during the @a libvlc_video_makeCurrent_cb()
730 * entering call.
732 * The number of planes depend on the DXGI_FORMAT returned during the
733 * @a libvlc_video_update_output_cb() call. It's usually one plane except for
734 * semi-planar formats like DXGI_FORMAT_NV12 or DXGI_FORMAT_P010.
736 * This callback is called between libvlc_video_makeCurrent_cb current/not-current
737 * calls.
739 typedef bool( *libvlc_video_output_select_plane_cb )( void *opaque, size_t plane, void *output );
742 * Set callbacks and data to render decoded video to a custom texture
744 * \warning VLC will perform video rendering in its own thread and at its own rate,
745 * You need to provide your own synchronisation mechanism.
747 * \param mp the media player
748 * \param engine the GPU engine to use
749 * \param setup_cb callback called to initialize user data
750 * \param cleanup_cb callback called to clean up user data
751 * \param resize_cb callback to set the resize callback
752 * \param update_output_cb callback to get the rendering format of the host (cannot be NULL)
753 * \param swap_cb callback called after rendering a video frame (cannot be NULL)
754 * \param makeCurrent_cb callback called to enter/leave the rendering context (cannot be NULL)
755 * \param getProcAddress_cb opengl function loading callback (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
756 * \param metadata_cb callback to provide frame metadata (D3D11 only)
757 * \param select_plane_cb callback to select different D3D11 rendering targets
758 * \param opaque private pointer passed to callbacks
760 * \note the \param setup_cb and \param cleanup_cb may be called more than once per
761 * playback.
763 * \retval true engine selected and callbacks set
764 * \retval false engine type unknown, callbacks not set
765 * \version LibVLC 4.0.0 or later
767 LIBVLC_API
768 bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
769 libvlc_video_engine_t engine,
770 libvlc_video_output_setup_cb setup_cb,
771 libvlc_video_output_cleanup_cb cleanup_cb,
772 libvlc_video_output_set_resize_cb resize_cb,
773 libvlc_video_update_output_cb update_output_cb,
774 libvlc_video_swap_cb swap_cb,
775 libvlc_video_makeCurrent_cb makeCurrent_cb,
776 libvlc_video_getProcAddress_cb getProcAddress_cb,
777 libvlc_video_frameMetadata_cb metadata_cb,
778 libvlc_video_output_select_plane_cb select_plane_cb,
779 void* opaque );
782 * Set the NSView handler where the media player should render its video output.
784 * Use the vout called "macosx".
786 * The drawable is an NSObject that follow the VLCVideoViewEmbedding
787 * protocol:
789 * @code{.m}
790 * @protocol VLCVideoViewEmbedding <NSObject>
791 * - (void)addVoutSubview:(NSView *)view;
792 * - (void)removeVoutSubview:(NSView *)view;
793 * @end
794 * @endcode
796 * Or it can be an NSView object.
798 * If you want to use it along with Qt see the QMacCocoaViewContainer. Then
799 * the following code should work:
800 * @code{.mm}
802 * NSView *video = [[NSView alloc] init];
803 * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
804 * libvlc_media_player_set_nsobject(mp, video);
805 * [video release];
807 * @endcode
809 * You can find a live example in VLCVideoView in VLCKit.framework.
811 * \param p_mi the Media Player
812 * \param drawable the drawable that is either an NSView or an object following
813 * the VLCVideoViewEmbedding protocol.
815 LIBVLC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
818 * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
820 * \param p_mi the Media Player
821 * \return the NSView handler or 0 if none where set
823 LIBVLC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
826 * Set an X Window System drawable where the media player should render its
827 * video output. The call takes effect when the playback starts. If it is
828 * already started, it might need to be stopped before changes apply.
829 * If LibVLC was built without X11 output support, then this function has no
830 * effects.
832 * By default, LibVLC will capture input events on the video rendering area.
833 * Use libvlc_video_set_mouse_input() and libvlc_video_set_key_input() to
834 * disable that and deliver events to the parent window / to the application
835 * instead. By design, the X11 protocol delivers input events to only one
836 * recipient.
838 * \warning
839 * The application must call the XInitThreads() function from Xlib before
840 * libvlc_new(), and before any call to XOpenDisplay() directly or via any
841 * other library. Failure to call XInitThreads() will seriously impede LibVLC
842 * performance. Calling XOpenDisplay() before XInitThreads() will eventually
843 * crash the process. That is a limitation of Xlib.
845 * \param p_mi media player
846 * \param drawable X11 window ID
848 * \note
849 * The specified identifier must correspond to an existing Input/Output class
850 * X11 window. Pixmaps are <b>not</b> currently supported. The default X11
851 * server is assumed, i.e. that specified in the DISPLAY environment variable.
853 * \warning
854 * LibVLC can deal with invalid X11 handle errors, however some display drivers
855 * (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle
856 * must remain valid until playback is stopped, otherwise the process may
857 * abort or crash.
859 * \bug
860 * No more than one window handle per media player instance can be specified.
861 * If the media has multiple simultaneously active video tracks, extra tracks
862 * will be rendered into external windows beyond the control of the
863 * application.
865 LIBVLC_API void libvlc_media_player_set_xwindow(libvlc_media_player_t *p_mi,
866 uint32_t drawable);
869 * Get the X Window System window identifier previously set with
870 * libvlc_media_player_set_xwindow(). Note that this will return the identifier
871 * even if VLC is not currently using it (for instance if it is playing an
872 * audio-only input).
874 * \param p_mi the Media Player
875 * \return an X window ID, or 0 if none where set.
877 LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
880 * Set a Win32/Win64 API window handle (HWND) where the media player should
881 * render its video output. If LibVLC was built without Win32/Win64 API output
882 * support, then this has no effects.
884 * \param p_mi the Media Player
885 * \param drawable windows handle of the drawable
887 LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
890 * Get the Windows API window handle (HWND) previously set with
891 * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
892 * is not currently outputting any video to it.
894 * \param p_mi the Media Player
895 * \return a window handle or NULL if there are none.
897 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
900 * Set the android context.
902 * \version LibVLC 3.0.0 and later.
904 * \param p_mi the media player
905 * \param p_awindow_handler org.videolan.libvlc.AWindow jobject owned by the
906 * org.videolan.libvlc.MediaPlayer class from the libvlc-android project.
908 LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
909 void *p_awindow_handler );
912 * Callback prototype for audio playback.
914 * The LibVLC media player decodes and post-processes the audio signal
915 * asynchronously (in an internal thread). Whenever audio samples are ready
916 * to be queued to the output, this callback is invoked.
918 * The number of samples provided per invocation may depend on the file format,
919 * the audio coding algorithm, the decoder plug-in, the post-processing
920 * filters and timing. Application must not assume a certain number of samples.
922 * The exact format of audio samples is determined by libvlc_audio_set_format()
923 * or libvlc_audio_set_format_callbacks() as is the channels layout.
925 * Note that the number of samples is per channel. For instance, if the audio
926 * track sampling rate is 48000 Hz, then 1200 samples represent 25 milliseconds
927 * of audio signal - regardless of the number of audio channels.
929 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
930 * \param samples pointer to a table of audio samples to play back [IN]
931 * \param count number of audio samples to play back
932 * \param pts expected play time stamp (see libvlc_delay())
934 typedef void (*libvlc_audio_play_cb)(void *data, const void *samples,
935 unsigned count, int64_t pts);
938 * Callback prototype for audio pause.
940 * LibVLC invokes this callback to pause audio playback.
942 * \note The pause callback is never called if the audio is already paused.
943 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
944 * \param pts time stamp of the pause request (should be elapsed already)
946 typedef void (*libvlc_audio_pause_cb)(void *data, int64_t pts);
949 * Callback prototype for audio resumption.
951 * LibVLC invokes this callback to resume audio playback after it was
952 * previously paused.
954 * \note The resume callback is never called if the audio is not paused.
955 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
956 * \param pts time stamp of the resumption request (should be elapsed already)
958 typedef void (*libvlc_audio_resume_cb)(void *data, int64_t pts);
961 * Callback prototype for audio buffer flush.
963 * LibVLC invokes this callback if it needs to discard all pending buffers and
964 * stop playback as soon as possible. This typically occurs when the media is
965 * stopped.
967 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
969 typedef void (*libvlc_audio_flush_cb)(void *data, int64_t pts);
972 * Callback prototype for audio buffer drain.
974 * LibVLC may invoke this callback when the decoded audio track is ending.
975 * There will be no further decoded samples for the track, but playback should
976 * nevertheless continue until all already pending buffers are rendered.
978 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
980 typedef void (*libvlc_audio_drain_cb)(void *data);
983 * Callback prototype for audio volume change.
984 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
985 * \param volume software volume (1. = nominal, 0. = mute)
986 * \param mute muted flag
988 typedef void (*libvlc_audio_set_volume_cb)(void *data,
989 float volume, bool mute);
992 * Sets callbacks and private data for decoded audio.
994 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
995 * to configure the decoded audio format.
997 * \note The audio callbacks override any other audio output mechanism.
998 * If the callbacks are set, LibVLC will <b>not</b> output audio in any way.
1000 * \param mp the media player
1001 * \param play callback to play audio samples (must not be NULL)
1002 * \param pause callback to pause playback (or NULL to ignore)
1003 * \param resume callback to resume playback (or NULL to ignore)
1004 * \param flush callback to flush audio buffers (or NULL to ignore)
1005 * \param drain callback to drain audio buffers (or NULL to ignore)
1006 * \param opaque private pointer for the audio callbacks (as first parameter)
1007 * \version LibVLC 2.0.0 or later
1009 LIBVLC_API
1010 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
1011 libvlc_audio_play_cb play,
1012 libvlc_audio_pause_cb pause,
1013 libvlc_audio_resume_cb resume,
1014 libvlc_audio_flush_cb flush,
1015 libvlc_audio_drain_cb drain,
1016 void *opaque );
1019 * Set callbacks and private data for decoded audio. This only works in
1020 * combination with libvlc_audio_set_callbacks().
1021 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
1022 * to configure the decoded audio format.
1024 * \param mp the media player
1025 * \param set_volume callback to apply audio volume,
1026 * or NULL to apply volume in software
1027 * \version LibVLC 2.0.0 or later
1029 LIBVLC_API
1030 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
1031 libvlc_audio_set_volume_cb set_volume );
1034 * Callback prototype to setup the audio playback.
1036 * This is called when the media player needs to create a new audio output.
1037 * \param opaque pointer to the data pointer passed to
1038 * libvlc_audio_set_callbacks() [IN/OUT]
1039 * \param format 4 bytes sample format [IN/OUT]
1040 * \param rate sample rate [IN/OUT]
1041 * \param channels channels count [IN/OUT]
1042 * \return 0 on success, anything else to skip audio playback
1044 typedef int (*libvlc_audio_setup_cb)(void **opaque, char *format, unsigned *rate,
1045 unsigned *channels);
1048 * Callback prototype for audio playback cleanup.
1050 * This is called when the media player no longer needs an audio output.
1051 * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
1053 typedef void (*libvlc_audio_cleanup_cb)(void *data);
1056 * Sets decoded audio format via callbacks.
1058 * This only works in combination with libvlc_audio_set_callbacks().
1060 * \param mp the media player
1061 * \param setup callback to select the audio format (cannot be NULL)
1062 * \param cleanup callback to release any allocated resources (or NULL)
1063 * \version LibVLC 2.0.0 or later
1065 LIBVLC_API
1066 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
1067 libvlc_audio_setup_cb setup,
1068 libvlc_audio_cleanup_cb cleanup );
1071 * Sets a fixed decoded audio format.
1073 * This only works in combination with libvlc_audio_set_callbacks(),
1074 * and is mutually exclusive with libvlc_audio_set_format_callbacks().
1076 * \param mp the media player
1077 * \param format a four-characters string identifying the sample format
1078 * (e.g. "S16N" or "f32l")
1079 * \param rate sample rate (expressed in Hz)
1080 * \param channels channels count
1081 * \version LibVLC 2.0.0 or later
1083 LIBVLC_API
1084 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
1085 unsigned rate, unsigned channels );
1087 /** \bug This might go away ... to be replaced by a broader system */
1090 * Get the current movie length (in ms).
1092 * \param p_mi the Media Player
1093 * \return the movie length (in ms), or -1 if there is no media.
1095 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
1098 * Get the current movie time (in ms).
1100 * \param p_mi the Media Player
1101 * \return the movie time (in ms), or -1 if there is no media.
1103 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
1106 * Set the movie time (in ms). This has no effect if no media is being played.
1107 * Not all formats and protocols support this.
1109 * \param p_mi the Media Player
1110 * \param b_fast prefer fast seeking or precise seeking
1111 * \param i_time the movie time (in ms).
1112 * \return 0 on success, -1 on error
1114 LIBVLC_API int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
1115 libvlc_time_t i_time, bool b_fast );
1118 * Get movie position as percentage between 0.0 and 1.0.
1120 * \param p_mi the Media Player
1121 * \return movie position, or -1. in case of error
1123 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
1126 * Set movie position as percentage between 0.0 and 1.0.
1127 * This has no effect if playback is not enabled.
1128 * This might not work depending on the underlying input format and protocol.
1130 * \param p_mi the Media Player
1131 * \param b_fast prefer fast seeking or precise seeking
1132 * \param f_pos the position
1133 * \return 0 on success, -1 on error
1135 LIBVLC_API int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
1136 float f_pos, bool b_fast );
1139 * Set movie chapter (if applicable).
1141 * \param p_mi the Media Player
1142 * \param i_chapter chapter number to play
1144 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
1147 * Get movie chapter.
1149 * \param p_mi the Media Player
1150 * \return chapter number currently playing, or -1 if there is no media.
1152 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
1155 * Get movie chapter count
1157 * \param p_mi the Media Player
1158 * \return number of chapters in movie, or -1.
1160 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
1163 * Get title chapter count
1165 * \param p_mi the Media Player
1166 * \param i_title title
1167 * \return number of chapters in title, or -1
1169 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
1170 libvlc_media_player_t *p_mi, int i_title );
1173 * Set movie title
1175 * \param p_mi the Media Player
1176 * \param i_title title number to play
1178 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
1181 * Get movie title
1183 * \param p_mi the Media Player
1184 * \return title number currently playing, or -1
1186 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
1189 * Get movie title count
1191 * \param p_mi the Media Player
1192 * \return title number count, or -1
1194 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
1197 * Set previous chapter (if applicable)
1199 * \param p_mi the Media Player
1201 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
1204 * Set next chapter (if applicable)
1206 * \param p_mi the Media Player
1208 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
1211 * Get the requested movie play rate.
1212 * @warning Depending on the underlying media, the requested rate may be
1213 * different from the real playback rate.
1215 * \param p_mi the Media Player
1216 * \return movie play rate
1218 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
1221 * Set movie play rate
1223 * \param p_mi the Media Player
1224 * \param rate movie play rate to set
1225 * \return -1 if an error was detected, 0 otherwise (but even then, it might
1226 * not actually work depending on the underlying media protocol)
1228 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
1231 * Get current movie state
1233 * \param p_mi the Media Player
1234 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
1236 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
1239 * How many video outputs does this media player have?
1241 * \param p_mi the media player
1242 * \return the number of video outputs
1244 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
1247 * Is this media player seekable?
1249 * \param p_mi the media player
1250 * \retval true media player can seek
1251 * \retval false media player cannot seek
1253 LIBVLC_API bool libvlc_media_player_is_seekable(libvlc_media_player_t *p_mi);
1256 * Can this media player be paused?
1258 * \param p_mi the media player
1259 * \retval true media player can be paused
1260 * \retval false media player cannot be paused
1262 LIBVLC_API bool libvlc_media_player_can_pause(libvlc_media_player_t *p_mi);
1265 * Check if the current program is scrambled
1267 * \param p_mi the media player
1268 * \retval true current program is scrambled
1269 * \retval false current program is not scrambled
1271 * \version LibVLC 2.2.0 or later
1273 LIBVLC_API bool libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
1276 * Display the next frame (if supported)
1278 * \param p_mi the media player
1280 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
1283 * Navigate through DVD Menu
1285 * \param p_mi the Media Player
1286 * \param navigate the Navigation mode
1287 * \version libVLC 2.0.0 or later
1289 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
1290 unsigned navigate );
1293 * Set if, and how, the video title will be shown when media is played.
1295 * \param p_mi the media player
1296 * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
1297 * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
1298 * \version libVLC 2.1.0 or later
1300 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
1303 * Get the track list for one type
1305 * \version LibVLC 4.0.0 and later.
1307 * \note You need to call libvlc_media_parse_with_options() or play the media
1308 * at least once before calling this function. Not doing this will result in
1309 * an empty list.
1311 * \note This track list is a snapshot of the current tracks when this function
1312 * is called. If a track is updated after this call, the user will need to call
1313 * this function again to get the updated track.
1316 * The track list can be used to get track informations and to select specific
1317 * tracks.
1319 * \param p_mi the media player
1320 * \param type type of the track list to request
1322 * \return a valid libvlc_media_tracklist_t or NULL in case of error, if there
1323 * is no track for a category, the returned list will have a size of 0, delete
1324 * with libvlc_media_tracklist_delete()
1326 LIBVLC_API libvlc_media_tracklist_t *
1327 libvlc_media_player_get_tracklist( libvlc_media_player_t *p_mi,
1328 libvlc_track_type_t type );
1332 * Get the selected track for one type
1334 * \version LibVLC 4.0.0 and later.
1336 * \warning More than one tracks can be selected for one type. In that case,
1337 * libvlc_media_player_get_tracklist() should be used.
1339 * \param p_mi the media player
1340 * \param type type of the selected track
1342 * \return a valid track or NULL if there is no selected tracks for this type,
1343 * release it with libvlc_media_track_release().
1345 LIBVLC_API libvlc_media_track_t *
1346 libvlc_media_player_get_selected_track( libvlc_media_player_t *p_mi,
1347 libvlc_track_type_t type );
1350 * Get a track from a track id
1352 * \version LibVLC 4.0.0 and later.
1354 * This function can be used to get the last updated informations of a track.
1356 * \param p_mi the media player
1357 * \param psz_id valid string representing a track id (cf. psz_id from \ref
1358 * libvlc_media_track_t)
1360 * \return a valid track or NULL if there is currently no tracks identified by
1361 * the string id, release it with libvlc_media_track_release().
1363 LIBVLC_API libvlc_media_track_t *
1364 libvlc_media_player_get_track_from_id( libvlc_media_player_t *p_mi,
1365 const char *psz_id );
1369 * Select a track
1371 * This will unselected the current track.
1373 * \version LibVLC 4.0.0 and later.
1375 * \note Use libvlc_media_player_select_tracks() for multiple selection
1377 * \param p_mi the media player
1378 * \param track track to select, can't be NULL
1380 LIBVLC_API void
1381 libvlc_media_player_select_track( libvlc_media_player_t *p_mi,
1382 const libvlc_media_track_t *track );
1385 * Unselect all tracks for a given type
1387 * \version LibVLC 4.0.0 and later.
1389 * \param p_mi the media player
1390 * \param type type to unselect
1392 LIBVLC_API void
1393 libvlc_media_player_unselect_track_type( libvlc_media_player_t *p_mi,
1394 libvlc_track_type_t type );
1397 * Select multiple tracks for one type
1399 * \version LibVLC 4.0.0 and later.
1401 * \note The internal track list can change between the calls of
1402 * libvlc_media_player_get_tracklist() and
1403 * libvlc_media_player_set_tracks(). If a track selection change but the
1404 * track is not present anymore, the player will just ignore it.
1406 * \note selecting multiple audio tracks is currently not supported.
1408 * \param p_mi the media player
1409 * \param type type of the selected track
1410 * \param tracks pointer to the track array, or NULL if track_count is 0
1411 * \param track_count number of tracks in the track array
1413 LIBVLC_API void
1414 libvlc_media_player_select_tracks( libvlc_media_player_t *p_mi,
1415 libvlc_track_type_t type,
1416 const libvlc_media_track_t **tracks,
1417 size_t track_count );
1420 * Select tracks by their string identifier
1422 * \version LibVLC 4.0.0 and later.
1424 * This function can be used pre-select a list of tracks before starting the
1425 * player. It has only effect for the current media. It can also be used when
1426 * the player is already started.
1428 * 'str_ids' can contain more than one track id, delimited with ','. "" or any
1429 * invalid track id will cause the player to unselect all tracks of that
1430 * category. NULL will disable the preference for newer tracks without
1431 * unselecting any current tracks.
1433 * Example:
1434 * - (libvlc_track_video, "video/1,video/2") will select these 2 video tracks.
1435 * If there is only one video track with the id "video/0", no tracks will be
1436 * selected.
1437 * - (libvlc_track_type_t, "${slave_url_md5sum}/spu/0) will select one spu
1438 * added by an input slave with the corresponding url.
1440 * \note The string identifier of a track can be found via psz_id from \ref
1441 * libvlc_media_track_t
1443 * \note selecting multiple audio tracks is currently not supported.
1445 * \param p_mi the media player
1446 * \param type type to select
1447 * \param psz_ids list of string identifier or NULL
1449 LIBVLC_API void
1450 libvlc_media_player_select_tracks_by_ids( libvlc_media_player_t *p_mi,
1451 libvlc_track_type_t type,
1452 const char *psz_ids );
1455 * Add a slave to the current media player.
1457 * \note If the player is playing, the slave will be added directly. This call
1458 * will also update the slave list of the attached libvlc_media_t.
1460 * \version LibVLC 3.0.0 and later.
1462 * \see libvlc_media_slaves_add
1464 * \param p_mi the media player
1465 * \param i_type subtitle or audio
1466 * \param psz_uri Uri of the slave (should contain a valid scheme).
1467 * \param b_select True if this slave should be selected when it's loaded
1469 * \return 0 on success, -1 on error.
1471 LIBVLC_API
1472 int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
1473 libvlc_media_slave_type_t i_type,
1474 const char *psz_uri, bool b_select );
1476 typedef struct libvlc_player_program_t
1478 /** Id used for libvlc_media_player_select_program() */
1479 int i_group_id;
1480 /** Program name, always valid */
1481 char *psz_name;
1482 /** True if the program is selected */
1483 bool b_selected;
1484 /** True if the program is scrambled */
1485 bool b_scrambled;
1486 } libvlc_player_program_t;
1489 * Opaque struct containing a list of program
1491 typedef struct libvlc_player_programlist_t libvlc_player_programlist_t;
1494 * Delete a program struct
1496 * \version LibVLC 4.0.0 and later.
1498 * \param program returned by libvlc_media_player_get_selected_program() or
1499 * libvlc_media_player_get_program_from_id()
1502 LIBVLC_API void
1503 libvlc_player_program_delete( libvlc_player_program_t *program );
1506 * Get the number of programs in a programlist
1508 * \version LibVLC 4.0.0 and later.
1510 * \param list valid programlist
1512 * \return number of programs, or 0 if the list is empty
1514 LIBVLC_API size_t
1515 libvlc_player_programlist_count( const libvlc_player_programlist_t *list );
1518 * Get a program at a specific index
1520 * \warning The behaviour is undefined if the index is not valid.
1522 * \version LibVLC 4.0.0 and later.
1524 * \param list valid programlist
1525 * \param index valid index in the range [0; count[
1527 * \return a valid program (can't be NULL if libvlc_player_programlist_count()
1528 * returned a valid count)
1530 LIBVLC_API libvlc_player_program_t *
1531 libvlc_player_programlist_at( libvlc_player_programlist_t *list, size_t index );
1534 * Release a programlist
1536 * \version LibVLC 4.0.0 and later.
1538 * \see libvlc_media_get_programlist
1539 * \see libvlc_media_player_get_programlist
1541 * \param list valid programlist
1543 LIBVLC_API void
1544 libvlc_player_programlist_delete( libvlc_player_programlist_t *list );
1547 * Select program with a given program id.
1549 * \note program ids are sent via the libvlc_MediaPlayerProgramAdded event or
1550 * can be fetch via libvlc_media_player_get_programlist()
1552 * \version LibVLC 4.0.0 or later
1554 * \param p_mi opaque media player handle
1555 * \param program_id
1557 LIBVLC_API void libvlc_media_player_select_program_id( libvlc_media_player_t *p_mi, int program_id);
1560 * Get the selected program
1562 * \version LibVLC 4.0.0 or later
1564 * \param p_mi opaque media player handle
1566 * \return a valid program struct or NULL if no programs are selected. The
1567 * program need to be freed with libvlc_player_program_delete().
1569 LIBVLC_API libvlc_player_program_t *
1570 libvlc_media_player_get_selected_program( libvlc_media_player_t *p_mi);
1573 * Get a program struct from a program id
1575 * \version LibVLC 4.0.0 or later
1577 * \param p_mi opaque media player handle
1578 * \param i_group_id program id
1580 * \return a valid program struct or NULL if the group_id is not found. The
1581 * program need to be freed with libvlc_player_program_delete().
1583 LIBVLC_API libvlc_player_program_t *
1584 libvlc_media_player_get_program_from_id( libvlc_media_player_t *p_mi, int i_group_id );
1587 * Get the program list
1589 * \version LibVLC 4.0.0 and later.
1590 * \note This program list is a snapshot of the current programs when this
1591 * function is called. If a program is updated after this call, the user will
1592 * need to call this function again to get the updated program.
1594 * The program list can be used to get program informations and to select
1595 * specific programs.
1597 * \param p_mi the media player
1598 * \param type type of the program list to request
1600 * \return a valid libvlc_media_programlist_t or NULL in case of error or empty
1601 * list, delete with libvlc_media_programlist_delete()
1603 LIBVLC_API libvlc_player_programlist_t *
1604 libvlc_media_player_get_programlist( libvlc_media_player_t *p_mi );
1607 /** \defgroup libvlc_video LibVLC video controls
1608 * @{
1612 * Toggle fullscreen status on non-embedded video outputs.
1614 * @warning The same limitations applies to this function
1615 * as to libvlc_set_fullscreen().
1617 * \param p_mi the media player
1619 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
1622 * Enable or disable fullscreen.
1624 * @warning With most window managers, only a top-level windows can be in
1625 * full-screen mode. Hence, this function will not operate properly if
1626 * libvlc_media_player_set_xwindow() was used to embed the video in a
1627 * non-top-level window. In that case, the embedding window must be reparented
1628 * to the root window <b>before</b> fullscreen mode is enabled. You will want
1629 * to reparent it back to its normal parent when disabling fullscreen.
1631 * \note This setting applies to any and all current or future active video
1632 * tracks and windows for the given media player. The choice of fullscreen
1633 * output for each window is left to the operating system.
1635 * \param p_mi the media player
1636 * \param b_fullscreen boolean for fullscreen status
1638 LIBVLC_API void libvlc_set_fullscreen(libvlc_media_player_t *p_mi, bool b_fullscreen);
1641 * Get current fullscreen status.
1643 * \param p_mi the media player
1644 * \return the fullscreen status (boolean)
1646 * \retval false media player is windowed
1647 * \retval true media player is in fullscreen mode
1649 LIBVLC_API bool libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
1652 * Enable or disable key press events handling, according to the LibVLC hotkeys
1653 * configuration. By default and for historical reasons, keyboard events are
1654 * handled by the LibVLC video widget.
1656 * \note On X11, there can be only one subscriber for key press and mouse
1657 * click events per window. If your application has subscribed to those events
1658 * for the X window ID of the video widget, then LibVLC will not be able to
1659 * handle key presses and mouse clicks in any case.
1661 * \warning This function is only implemented for X11 and Win32 at the moment.
1663 * \param p_mi the media player
1664 * \param on true to handle key press events, false to ignore them.
1666 LIBVLC_API
1667 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
1670 * Enable or disable mouse click events handling. By default, those events are
1671 * handled. This is needed for DVD menus to work, as well as a few video
1672 * filters such as "puzzle".
1674 * \see libvlc_video_set_key_input().
1676 * \warning This function is only implemented for X11 and Win32 at the moment.
1678 * \param p_mi the media player
1679 * \param on true to handle mouse click events, false to ignore them.
1681 LIBVLC_API
1682 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
1685 * Get the pixel dimensions of a video.
1687 * \param p_mi media player
1688 * \param num number of the video (starting from, and most commonly 0)
1689 * \param px pointer to get the pixel width [OUT]
1690 * \param py pointer to get the pixel height [OUT]
1691 * \return 0 on success, -1 if the specified video does not exist
1693 LIBVLC_API
1694 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
1695 unsigned *px, unsigned *py );
1698 * Get the mouse pointer coordinates over a video.
1699 * Coordinates are expressed in terms of the decoded video resolution,
1700 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
1701 * you can query your windowing system directly).
1703 * Either of the coordinates may be negative or larger than the corresponding
1704 * dimension of the video, if the cursor is outside the rendering area.
1706 * @warning The coordinates may be out-of-date if the pointer is not located
1707 * on the video rendering area. LibVLC does not track the pointer if it is
1708 * outside of the video widget.
1710 * @note LibVLC does not support multiple pointers (it does of course support
1711 * multiple input devices sharing the same pointer) at the moment.
1713 * \param p_mi media player
1714 * \param num number of the video (starting from, and most commonly 0)
1715 * \param px pointer to get the abscissa [OUT]
1716 * \param py pointer to get the ordinate [OUT]
1717 * \return 0 on success, -1 if the specified video does not exist
1719 LIBVLC_API
1720 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1721 int *px, int *py );
1724 * Get the current video scaling factor.
1725 * See also libvlc_video_set_scale().
1727 * \param p_mi the media player
1728 * \return the currently configured zoom factor, or 0. if the video is set
1729 * to fit to the output window/drawable automatically.
1731 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1734 * Set the video scaling factor. That is the ratio of the number of pixels on
1735 * screen to the number of pixels in the original decoded video in each
1736 * dimension. Zero is a special value; it will adjust the video to the output
1737 * window/drawable (in windowed mode) or the entire screen.
1739 * Note that not all video outputs support scaling.
1741 * \param p_mi the media player
1742 * \param f_factor the scaling factor, or zero
1744 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1747 * Get current video aspect ratio.
1749 * \param p_mi the media player
1750 * \return the video aspect ratio or NULL if unspecified
1751 * (the result must be released with free() or libvlc_free()).
1753 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1756 * Set new video aspect ratio.
1758 * \param p_mi the media player
1759 * \param psz_aspect new video aspect-ratio or NULL to reset to default
1760 * \note Invalid aspect ratios are ignored.
1762 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1765 * Create a video viewpoint structure.
1767 * \version LibVLC 3.0.0 and later
1769 * \return video viewpoint or NULL
1770 * (the result must be released with free()).
1772 LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
1775 * Update the video viewpoint information.
1777 * \note It is safe to call this function before the media player is started.
1779 * \version LibVLC 3.0.0 and later
1781 * \param p_mi the media player
1782 * \param p_viewpoint video viewpoint allocated via libvlc_video_new_viewpoint()
1783 * \param b_absolute if true replace the old viewpoint with the new one. If
1784 * false, increase/decrease it.
1785 * \return -1 in case of error, 0 otherwise
1787 * \note the values are set asynchronously, it will be used by the next frame displayed.
1789 LIBVLC_API int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
1790 const libvlc_video_viewpoint_t *p_viewpoint,
1791 bool b_absolute);
1794 * Get the current subtitle delay. Positive values means subtitles are being
1795 * displayed later, negative values earlier.
1797 * \param p_mi media player
1798 * \return time (in microseconds) the display of subtitles is being delayed
1799 * \version LibVLC 2.0.0 or later
1801 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1804 * Get the current subtitle text scale
1806 * The scale factor is expressed as a percentage of the default size, where
1807 * 1.0 represents 100 percent.
1809 * \param p_mi media player
1810 * \version LibVLC 4.0.0 or later
1812 LIBVLC_API float libvlc_video_get_spu_text_scale( libvlc_media_player_t *p_mi );
1815 * Set the subtitle text scale.
1817 * The scale factor is expressed as a percentage of the default size, where
1818 * 1.0 represents 100 percent.
1820 * A value of 0.5 would result in text half the normal size, and a value of 2.0
1821 * would result in text twice the normal size.
1823 * The minimum acceptable value for the scale factor is 0.1.
1825 * The maximum is 5.0 (five times normal size).
1827 * \param p_mi media player
1828 * \param f_scale scale factor in the range [0.1;5.0] (default: 1.0)
1829 * \version LibVLC 4.0.0 or later
1831 LIBVLC_API void libvlc_video_set_spu_text_scale( libvlc_media_player_t *p_mi, float f_scale );
1834 * Set the subtitle delay. This affects the timing of when the subtitle will
1835 * be displayed. Positive values result in subtitles being displayed later,
1836 * while negative values will result in subtitles being displayed earlier.
1838 * The subtitle delay will be reset to zero each time the media changes.
1840 * \param p_mi media player
1841 * \param i_delay time (in microseconds) the display of subtitles should be delayed
1842 * \return 0 on success, -1 on error
1843 * \version LibVLC 2.0.0 or later
1845 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1848 * Get the full description of available titles
1850 * \version LibVLC 3.0.0 and later.
1852 * \param p_mi the media player
1853 * \param titles address to store an allocated array of title descriptions
1854 * descriptions (must be freed with libvlc_title_descriptions_release()
1855 * by the caller) [OUT]
1857 * \return the number of titles (-1 on error)
1859 LIBVLC_API int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi,
1860 libvlc_title_description_t ***titles );
1863 * Release a title description
1865 * \version LibVLC 3.0.0 and later
1867 * \param p_titles title description array to release
1868 * \param i_count number of title descriptions to release
1870 LIBVLC_API
1871 void libvlc_title_descriptions_release( libvlc_title_description_t **p_titles,
1872 unsigned i_count );
1875 * Get the full description of available chapters
1877 * \version LibVLC 3.0.0 and later.
1879 * \param p_mi the media player
1880 * \param i_chapters_of_title index of the title to query for chapters (uses current title if set to -1)
1881 * \param pp_chapters address to store an allocated array of chapter descriptions
1882 * descriptions (must be freed with libvlc_chapter_descriptions_release()
1883 * by the caller) [OUT]
1885 * \return the number of chapters (-1 on error)
1887 LIBVLC_API int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_mi,
1888 int i_chapters_of_title,
1889 libvlc_chapter_description_t *** pp_chapters );
1892 * Release a chapter description
1894 * \version LibVLC 3.0.0 and later
1896 * \param p_chapters chapter description array to release
1897 * \param i_count number of chapter descriptions to release
1899 LIBVLC_API
1900 void libvlc_chapter_descriptions_release( libvlc_chapter_description_t **p_chapters,
1901 unsigned i_count );
1904 * Set/unset the video crop ratio.
1906 * This function forces a crop ratio on any and all video tracks rendered by
1907 * the media player. If the display aspect ratio of a video does not match the
1908 * crop ratio, either the top and bottom, or the left and right of the video
1909 * will be cut out to fit the crop ratio.
1911 * For instance, a ratio of 1:1 will force the video to a square shape.
1913 * To disable video crop, set a crop ratio with zero as denominator.
1915 * A call to this function overrides any previous call to any of
1916 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1917 * libvlc_video_set_crop_window().
1919 * \see libvlc_video_set_aspect_ratio()
1921 * \param mp the media player
1922 * \param num crop ratio numerator (ignored if denominator is 0)
1923 * \param den crop ratio denominator (or 0 to unset the crop ratio)
1925 * \version LibVLC 4.0.0 and later
1927 LIBVLC_API
1928 void libvlc_video_set_crop_ratio(libvlc_media_player_t *mp,
1929 unsigned num, unsigned den);
1932 * Set the video crop window.
1934 * This function selects a sub-rectangle of video to show. Any pixels outside
1935 * the rectangle will not be shown.
1937 * To unset the video crop window, use libvlc_video_set_crop_ratio() or
1938 * libvlc_video_set_crop_border().
1940 * A call to this function overrides any previous call to any of
1941 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1942 * libvlc_video_set_crop_window().
1944 * \param mp the media player
1945 * \param x abscissa (i.e. leftmost sample column offset) of the crop window
1946 * \param y ordinate (i.e. topmost sample row offset) of the crop window
1947 * \param width sample width of the crop window (cannot be zero)
1948 * \param height sample height of the crop window (cannot be zero)
1950 * \version LibVLC 4.0.0 and later
1952 LIBVLC_API
1953 void libvlc_video_set_crop_window(libvlc_media_player_t *mp,
1954 unsigned x, unsigned y,
1955 unsigned width, unsigned height);
1958 * Set the video crop borders.
1960 * This function selects the size of video edges to be cropped out.
1962 * To unset the video crop borders, set all borders to zero.
1964 * A call to this function overrides any previous call to any of
1965 * libvlc_video_set_crop_ratio(), libvlc_video_set_crop_border() and/or
1966 * libvlc_video_set_crop_window().
1968 * \param mp the media player
1969 * \param left number of sample columns to crop on the left
1970 * \param right number of sample columns to crop on the right
1971 * \param top number of sample rows to crop on the top
1972 * \param bottom number of sample rows to corp on the bottom
1974 * \version LibVLC 4.0.0 and later
1976 LIBVLC_API
1977 void libvlc_video_set_crop_border(libvlc_media_player_t *mp,
1978 unsigned left, unsigned right,
1979 unsigned top, unsigned bottom);
1982 * Get current teletext page requested or 0 if it's disabled.
1984 * Teletext is disabled by default, call libvlc_video_set_teletext() to enable
1985 * it.
1987 * \param p_mi the media player
1988 * \return the current teletext page requested.
1990 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1993 * Set new teletext page to retrieve.
1995 * This function can also be used to send a teletext key.
1997 * \param p_mi the media player
1998 * \param i_page teletex page number requested. This value can be 0 to disable
1999 * teletext, a number in the range ]0;1000[ to show the requested page, or a
2000 * \ref libvlc_teletext_key_t. 100 is the default teletext page.
2002 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
2005 * Take a snapshot of the current video window.
2007 * If i_width AND i_height is 0, original size is used.
2008 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
2010 * \param p_mi media player instance
2011 * \param num number of video output (typically 0 for the first/only one)
2012 * \param psz_filepath the path of a file or a folder to save the screenshot into
2013 * \param i_width the snapshot's width
2014 * \param i_height the snapshot's height
2015 * \return 0 on success, -1 if the video was not found
2017 LIBVLC_API
2018 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
2019 const char *psz_filepath, unsigned int i_width,
2020 unsigned int i_height );
2023 * Enable or disable deinterlace filter
2025 * \param p_mi libvlc media player
2026 * \param deinterlace state -1: auto (default), 0: disabled, 1: enabled
2027 * \param psz_mode type of deinterlace filter, NULL for current/default filter
2028 * \version LibVLC 4.0.0 and later
2030 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
2031 int deinterlace,
2032 const char *psz_mode );
2035 * Get an integer marquee option value
2037 * \param p_mi libvlc media player
2038 * \param option marq option to get \see libvlc_video_marquee_option_t
2040 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
2041 unsigned option );
2044 * Enable, disable or set an integer marquee option
2046 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
2047 * or disabling (arg 0) the marq filter.
2049 * \param p_mi libvlc media player
2050 * \param option marq option to set \see libvlc_video_marquee_option_t
2051 * \param i_val marq option value
2053 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
2054 unsigned option, int i_val );
2057 * Set a marquee string option
2059 * \param p_mi libvlc media player
2060 * \param option marq option to set \see libvlc_video_marquee_option_t
2061 * \param psz_text marq option value
2063 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
2064 unsigned option, const char *psz_text );
2066 /** option values for libvlc_video_{get,set}_logo_{int,string} */
2067 enum libvlc_video_logo_option_t {
2068 libvlc_logo_enable,
2069 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
2070 libvlc_logo_x,
2071 libvlc_logo_y,
2072 libvlc_logo_delay,
2073 libvlc_logo_repeat,
2074 libvlc_logo_opacity,
2075 libvlc_logo_position
2079 * Get integer logo option.
2081 * \param p_mi libvlc media player instance
2082 * \param option logo option to get, values of libvlc_video_logo_option_t
2084 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
2085 unsigned option );
2088 * Set logo option as integer. Options that take a different type value
2089 * are ignored.
2090 * Passing libvlc_logo_enable as option value has the side effect of
2091 * starting (arg !0) or stopping (arg 0) the logo filter.
2093 * \param p_mi libvlc media player instance
2094 * \param option logo option to set, values of libvlc_video_logo_option_t
2095 * \param value logo option value
2097 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
2098 unsigned option, int value );
2101 * Set logo option as string. Options that take a different type value
2102 * are ignored.
2104 * \param p_mi libvlc media player instance
2105 * \param option logo option to set, values of libvlc_video_logo_option_t
2106 * \param psz_value logo option value
2108 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
2109 unsigned option, const char *psz_value );
2112 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
2113 enum libvlc_video_adjust_option_t {
2114 libvlc_adjust_Enable = 0,
2115 libvlc_adjust_Contrast,
2116 libvlc_adjust_Brightness,
2117 libvlc_adjust_Hue,
2118 libvlc_adjust_Saturation,
2119 libvlc_adjust_Gamma
2123 * Get integer adjust option.
2125 * \param p_mi libvlc media player instance
2126 * \param option adjust option to get, values of libvlc_video_adjust_option_t
2127 * \version LibVLC 1.1.1 and later.
2129 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
2130 unsigned option );
2133 * Set adjust option as integer. Options that take a different type value
2134 * are ignored.
2135 * Passing libvlc_adjust_enable as option value has the side effect of
2136 * starting (arg !0) or stopping (arg 0) the adjust filter.
2138 * \param p_mi libvlc media player instance
2139 * \param option adust option to set, values of libvlc_video_adjust_option_t
2140 * \param value adjust option value
2141 * \version LibVLC 1.1.1 and later.
2143 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
2144 unsigned option, int value );
2147 * Get float adjust option.
2149 * \param p_mi libvlc media player instance
2150 * \param option adjust option to get, values of libvlc_video_adjust_option_t
2151 * \version LibVLC 1.1.1 and later.
2153 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
2154 unsigned option );
2157 * Set adjust option as float. Options that take a different type value
2158 * are ignored.
2160 * \param p_mi libvlc media player instance
2161 * \param option adust option to set, values of libvlc_video_adjust_option_t
2162 * \param value adjust option value
2163 * \version LibVLC 1.1.1 and later.
2165 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
2166 unsigned option, float value );
2168 /** @} video */
2170 /** \defgroup libvlc_audio LibVLC audio controls
2171 * @{
2175 * Audio channels
2177 typedef enum libvlc_audio_output_channel_t {
2178 libvlc_AudioChannel_Error = -1,
2179 libvlc_AudioChannel_Stereo = 1,
2180 libvlc_AudioChannel_RStereo = 2,
2181 libvlc_AudioChannel_Left = 3,
2182 libvlc_AudioChannel_Right = 4,
2183 libvlc_AudioChannel_Dolbys = 5
2184 } libvlc_audio_output_channel_t;
2188 * Gets the list of available audio output modules.
2190 * \param p_instance libvlc instance
2191 * \return list of available audio outputs. It must be freed with
2192 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
2193 * In case of error, NULL is returned.
2195 LIBVLC_API libvlc_audio_output_t *
2196 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
2199 * Frees the list of available audio output modules.
2201 * \param p_list list with audio outputs for release
2203 LIBVLC_API
2204 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
2207 * Selects an audio output module.
2208 * \note Any change will take be effect only after playback is stopped and
2209 * restarted. Audio output cannot be changed while playing.
2211 * \param p_mi media player
2212 * \param psz_name name of audio output,
2213 * use psz_name of \see libvlc_audio_output_t
2214 * \return 0 if function succeeded, -1 on error
2216 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
2217 const char *psz_name );
2220 * Gets a list of potential audio output devices,
2221 * \see libvlc_audio_output_device_set().
2223 * \note Not all audio outputs support enumerating devices.
2224 * The audio output may be functional even if the list is empty (NULL).
2226 * \note The list may not be exhaustive.
2228 * \warning Some audio output devices in the list might not actually work in
2229 * some circumstances. By default, it is recommended to not specify any
2230 * explicit audio device.
2232 * \param mp media player
2233 * \return A NULL-terminated linked list of potential audio output devices.
2234 * It must be freed with libvlc_audio_output_device_list_release()
2235 * \version LibVLC 2.2.0 or later.
2237 LIBVLC_API libvlc_audio_output_device_t *
2238 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
2241 * Gets a list of audio output devices for a given audio output module,
2242 * \see libvlc_audio_output_device_set().
2244 * \note Not all audio outputs support this. In particular, an empty (NULL)
2245 * list of devices does <b>not</b> imply that the specified audio output does
2246 * not work.
2248 * \note The list might not be exhaustive.
2250 * \warning Some audio output devices in the list might not actually work in
2251 * some circumstances. By default, it is recommended to not specify any
2252 * explicit audio device.
2254 * \param p_instance libvlc instance
2255 * \param aout audio output name
2256 * (as returned by libvlc_audio_output_list_get())
2257 * \return A NULL-terminated linked list of potential audio output devices.
2258 * It must be freed with libvlc_audio_output_device_list_release()
2259 * \version LibVLC 2.1.0 or later.
2261 LIBVLC_API libvlc_audio_output_device_t *
2262 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
2263 const char *aout );
2266 * Frees a list of available audio output devices.
2268 * \param p_list list with audio outputs for release
2269 * \version LibVLC 2.1.0 or later.
2271 LIBVLC_API void libvlc_audio_output_device_list_release(
2272 libvlc_audio_output_device_t *p_list );
2275 * Configures an explicit audio output device.
2277 * If the module paramater is NULL, audio output will be moved to the device
2278 * specified by the device identifier string immediately. This is the
2279 * recommended usage.
2281 * A list of adequate potential device strings can be obtained with
2282 * libvlc_audio_output_device_enum().
2284 * However passing NULL is supported in LibVLC version 2.2.0 and later only;
2285 * in earlier versions, this function would have no effects when the module
2286 * parameter was NULL.
2288 * If the module parameter is not NULL, the device parameter of the
2289 * corresponding audio output, if it exists, will be set to the specified
2290 * string. Note that some audio output modules do not have such a parameter
2291 * (notably MMDevice and PulseAudio).
2293 * A list of adequate potential device strings can be obtained with
2294 * libvlc_audio_output_device_list_get().
2296 * \note This function does not select the specified audio output plugin.
2297 * libvlc_audio_output_set() is used for that purpose.
2299 * \warning The syntax for the device parameter depends on the audio output.
2301 * Some audio output modules require further parameters (e.g. a channels map
2302 * in the case of ALSA).
2304 * \param mp media player
2305 * \param module If NULL, current audio output module.
2306 * if non-NULL, name of audio output module
2307 (\see libvlc_audio_output_t)
2308 * \param device_id device identifier string
2309 * \return Nothing. Errors are ignored (this is a design bug).
2311 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
2312 const char *module,
2313 const char *device_id );
2316 * Get the current audio output device identifier.
2318 * This complements libvlc_audio_output_device_set().
2320 * \warning The initial value for the current audio output device identifier
2321 * may not be set or may be some unknown value. A LibVLC application should
2322 * compare this value against the known device identifiers (e.g. those that
2323 * were previously retrieved by a call to libvlc_audio_output_device_enum or
2324 * libvlc_audio_output_device_list_get) to find the current audio output device.
2326 * It is possible that the selected audio output device changes (an external
2327 * change) without a call to libvlc_audio_output_device_set. That may make this
2328 * method unsuitable to use if a LibVLC application is attempting to track
2329 * dynamic audio device changes as they happen.
2331 * \param mp media player
2332 * \return the current audio output device identifier
2333 * NULL if no device is selected or in case of error
2334 * (the result must be released with free()).
2335 * \version LibVLC 3.0.0 or later.
2337 LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
2340 * Toggle mute status.
2342 * \param p_mi media player
2343 * \warning Toggling mute atomically is not always possible: On some platforms,
2344 * other processes can mute the VLC audio playback stream asynchronously. Thus,
2345 * there is a small race condition where toggling will not work.
2346 * See also the limitations of libvlc_audio_set_mute().
2348 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
2351 * Get current mute status.
2353 * \param p_mi media player
2354 * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
2356 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
2359 * Set mute status.
2361 * \param p_mi media player
2362 * \param status If status is true then mute, otherwise unmute
2363 * \warning This function does not always work. If there are no active audio
2364 * playback stream, the mute status might not be available. If digital
2365 * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
2366 * some audio output plugins do not support muting at all.
2367 * \note To force silent playback, disable all audio tracks. This is more
2368 * efficient and reliable than mute.
2370 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
2373 * Get current software audio volume.
2375 * \param p_mi media player
2376 * \return the software volume in percents
2377 * (0 = mute, 100 = nominal / 0dB)
2379 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
2382 * Set current software audio volume.
2384 * \param p_mi media player
2385 * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
2386 * \return 0 if the volume was set, -1 if it was out of range
2388 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
2391 * Get current audio channel.
2393 * \param p_mi media player
2394 * \return the audio channel \see libvlc_audio_output_channel_t
2396 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
2399 * Set current audio channel.
2401 * \param p_mi media player
2402 * \param channel the audio channel, \see libvlc_audio_output_channel_t
2403 * \return 0 on success, -1 on error
2405 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
2408 * Get current audio delay.
2410 * \param p_mi media player
2411 * \return the audio delay (microseconds)
2412 * \version LibVLC 1.1.1 or later
2414 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
2417 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
2419 * \param p_mi media player
2420 * \param i_delay the audio delay (microseconds)
2421 * \return 0 on success, -1 on error
2422 * \version LibVLC 1.1.1 or later
2424 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
2427 * Get the number of equalizer presets.
2429 * \return number of presets
2430 * \version LibVLC 2.2.0 or later
2432 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
2435 * Get the name of a particular equalizer preset.
2437 * This name can be used, for example, to prepare a preset label or menu in a user
2438 * interface.
2440 * \param u_index index of the preset, counting from zero
2441 * \return preset name, or NULL if there is no such preset
2442 * \version LibVLC 2.2.0 or later
2444 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
2447 * Get the number of distinct frequency bands for an equalizer.
2449 * \return number of frequency bands
2450 * \version LibVLC 2.2.0 or later
2452 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
2455 * Get a particular equalizer band frequency.
2457 * This value can be used, for example, to create a label for an equalizer band control
2458 * in a user interface.
2460 * \param u_index index of the band, counting from zero
2461 * \return equalizer band frequency (Hz), or -1 if there is no such band
2462 * \version LibVLC 2.2.0 or later
2464 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
2467 * Create a new default equalizer, with all frequency values zeroed.
2469 * The new equalizer can subsequently be applied to a media player by invoking
2470 * libvlc_media_player_set_equalizer().
2472 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2473 * it is no longer needed.
2475 * \return opaque equalizer handle, or NULL on error
2476 * \version LibVLC 2.2.0 or later
2478 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
2481 * Create a new equalizer, with initial frequency values copied from an existing
2482 * preset.
2484 * The new equalizer can subsequently be applied to a media player by invoking
2485 * libvlc_media_player_set_equalizer().
2487 * The returned handle should be freed via libvlc_audio_equalizer_release() when
2488 * it is no longer needed.
2490 * \param u_index index of the preset, counting from zero
2491 * \return opaque equalizer handle, or NULL on error
2492 * (it must be released with libvlc_audio_equalizer_release())
2493 * \version LibVLC 2.2.0 or later
2495 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
2498 * Release a previously created equalizer instance.
2500 * The equalizer was previously created by using libvlc_audio_equalizer_new() or
2501 * libvlc_audio_equalizer_new_from_preset().
2503 * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
2505 * \param p_equalizer opaque equalizer handle, or NULL
2506 * \version LibVLC 2.2.0 or later
2508 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
2511 * Set a new pre-amplification value for an equalizer.
2513 * The new equalizer settings are subsequently applied to a media player by invoking
2514 * libvlc_media_player_set_equalizer().
2516 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2518 * \param p_equalizer valid equalizer handle, must not be NULL
2519 * \param f_preamp preamp value (-20.0 to 20.0 Hz)
2520 * \return zero on success, -1 on error
2521 * \version LibVLC 2.2.0 or later
2523 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
2526 * Get the current pre-amplification value from an equalizer.
2528 * \param p_equalizer valid equalizer handle, must not be NULL
2529 * \return preamp value (Hz)
2530 * \version LibVLC 2.2.0 or later
2532 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
2535 * Set a new amplification value for a particular equalizer frequency band.
2537 * The new equalizer settings are subsequently applied to a media player by invoking
2538 * libvlc_media_player_set_equalizer().
2540 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
2542 * \param p_equalizer valid equalizer handle, must not be NULL
2543 * \param f_amp amplification value (-20.0 to 20.0 Hz)
2544 * \param u_band index, counting from zero, of the frequency band to set
2545 * \return zero on success, -1 on error
2546 * \version LibVLC 2.2.0 or later
2548 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
2551 * Get the amplification value for a particular equalizer frequency band.
2553 * \param p_equalizer valid equalizer handle, must not be NULL
2554 * \param u_band index, counting from zero, of the frequency band to get
2555 * \return amplification value (Hz); NaN if there is no such frequency band
2556 * \version LibVLC 2.2.0 or later
2558 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
2561 * Apply new equalizer settings to a media player.
2563 * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
2564 * libvlc_audio_equalizer_new_from_preset().
2566 * It is possible to apply new equalizer settings to a media player whether the media
2567 * player is currently playing media or not.
2569 * Invoking this method will immediately apply the new equalizer settings to the audio
2570 * output of the currently playing media if there is any.
2572 * If there is no currently playing media, the new equalizer settings will be applied
2573 * later if and when new media is played.
2575 * Equalizer settings will automatically be applied to subsequently played media.
2577 * To disable the equalizer for a media player invoke this method passing NULL for the
2578 * p_equalizer parameter.
2580 * The media player does not keep a reference to the supplied equalizer so it is safe
2581 * for an application to release the equalizer reference any time after this method
2582 * returns.
2584 * \param p_mi opaque media player handle
2585 * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
2586 * \return zero on success, -1 on error
2587 * \version LibVLC 2.2.0 or later
2589 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
2592 * Media player roles.
2594 * \version LibVLC 3.0.0 and later.
2596 * See \ref libvlc_media_player_set_role()
2598 typedef enum libvlc_media_player_role {
2599 libvlc_role_None = 0, /**< Don't use a media player role */
2600 libvlc_role_Music, /**< Music (or radio) playback */
2601 libvlc_role_Video, /**< Video playback */
2602 libvlc_role_Communication, /**< Speech, real-time communication */
2603 libvlc_role_Game, /**< Video game */
2604 libvlc_role_Notification, /**< User interaction feedback */
2605 libvlc_role_Animation, /**< Embedded animation (e.g. in web page) */
2606 libvlc_role_Production, /**< Audio editting/production */
2607 libvlc_role_Accessibility, /**< Accessibility */
2608 libvlc_role_Test /** Testing */
2609 #define libvlc_role_Last libvlc_role_Test
2610 } libvlc_media_player_role_t;
2613 * Gets the media role.
2615 * \version LibVLC 3.0.0 and later.
2617 * \param p_mi media player
2618 * \return the media player role (\ref libvlc_media_player_role_t)
2620 LIBVLC_API int libvlc_media_player_get_role(libvlc_media_player_t *p_mi);
2623 * Sets the media role.
2625 * \param p_mi media player
2626 * \param role the media player role (\ref libvlc_media_player_role_t)
2627 * \return 0 on success, -1 on error
2629 LIBVLC_API int libvlc_media_player_set_role(libvlc_media_player_t *p_mi,
2630 unsigned role);
2632 /** @} audio */
2634 /** @} media_player */
2636 # ifdef __cplusplus
2638 # endif
2640 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */