1 /*****************************************************************************
2 * libvlc_media_player.h: libvlc_media_player external API
3 *****************************************************************************
4 * Copyright (C) 1998-2010 VLC authors and VideoLAN
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Paul Saman <jpsaman@videolan.org>
9 * Pierre d'Herbemont <pdherbemont@videolan.org>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
28 * This file defines libvlc_media_player external API
31 #ifndef VLC_LIBVLC_MEDIA_PLAYER_H
32 #define VLC_LIBVLC_MEDIA_PLAYER_H 1
40 /*****************************************************************************
42 *****************************************************************************/
43 /** \defgroup libvlc_media_player LibVLC media player
45 * A LibVLC media player plays one media (usually in a custom drawable).
49 typedef struct libvlc_media_player_t libvlc_media_player_t;
52 * Description for video, audio tracks and subtitles. It contains
53 * id, name (description string) and pointer to next record.
55 typedef struct libvlc_track_description_t
59 struct libvlc_track_description_t *p_next;
61 } libvlc_track_description_t;
64 * Description for audio output. It contains
65 * name, description and pointer to next record.
67 typedef struct libvlc_audio_output_t
70 char *psz_description;
71 struct libvlc_audio_output_t *p_next;
73 } libvlc_audio_output_t;
76 * Description for audio output device.
78 typedef struct libvlc_audio_output_device_t
80 struct libvlc_audio_output_device_t *p_next; /**< Next entry in list */
81 char *psz_device; /**< Device identifier string */
82 char *psz_description; /**< User-friendly device description */
83 /* More fields may be added here in later versions */
84 } libvlc_audio_output_device_t;
87 * Rectangle type for video geometry
89 typedef struct libvlc_rectangle_t
96 * Marq options definition
98 typedef enum libvlc_video_marquee_option_t {
99 libvlc_marquee_Enable = 0,
100 libvlc_marquee_Text, /** string argument */
101 libvlc_marquee_Color,
102 libvlc_marquee_Opacity,
103 libvlc_marquee_Position,
104 libvlc_marquee_Refresh,
106 libvlc_marquee_Timeout,
109 } libvlc_video_marquee_option_t;
114 typedef enum libvlc_navigate_mode_t
116 libvlc_navigate_activate = 0,
118 libvlc_navigate_down,
119 libvlc_navigate_left,
120 libvlc_navigate_right
121 } libvlc_navigate_mode_t;
124 * Enumeration of values used to set position (e.g. of video title).
126 typedef enum libvlc_position_t {
127 libvlc_position_disable=-1,
128 libvlc_position_center,
129 libvlc_position_left,
130 libvlc_position_right,
132 libvlc_position_top_left,
133 libvlc_position_top_right,
134 libvlc_position_bottom,
135 libvlc_position_bottom_left,
136 libvlc_position_bottom_right
140 * Opaque equalizer handle.
142 * Equalizer settings can be applied to a media player.
144 typedef struct libvlc_equalizer_t libvlc_equalizer_t;
147 * Create an empty Media Player object
149 * \param p_libvlc_instance the libvlc instance in which the Media Player
151 * \return a new media player object, or NULL on error.
153 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
156 * Create a Media Player object from a Media
158 * \param p_md the media. Afterwards the p_md can be safely
160 * \return a new media player object, or NULL on error.
162 LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
165 * Release a media_player after use
166 * Decrement the reference count of a media player object. If the
167 * reference count is 0, then libvlc_media_player_release() will
168 * release the media player object. If the media player object
169 * has been released, then it should not be used again.
171 * \param p_mi the Media Player to free
173 LIBVLC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
176 * Retain a reference to a media player object. Use
177 * libvlc_media_player_release() to decrement reference count.
179 * \param p_mi media player object
181 LIBVLC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
184 * Set the media that will be used by the media_player. If any,
185 * previous md will be released.
187 * \param p_mi the Media Player
188 * \param p_md the Media. Afterwards the p_md can be safely
191 LIBVLC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
192 libvlc_media_t *p_md );
195 * Get the media used by the media_player.
197 * \param p_mi the Media Player
198 * \return the media associated with p_mi, or NULL if no
199 * media is associated
201 LIBVLC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
204 * Get the Event Manager from which the media player send event.
206 * \param p_mi the Media Player
207 * \return the event manager associated with p_mi
209 LIBVLC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
214 * \param p_mi the Media Player
215 * \return 1 if the media player is playing, 0 otherwise
217 * \libvlc_return_bool
219 LIBVLC_API int libvlc_media_player_is_playing ( libvlc_media_player_t *p_mi );
224 * \param p_mi the Media Player
225 * \return 0 if playback started (and was already started), or -1 on error.
227 LIBVLC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
230 * Pause or resume (no effect if there is no media)
232 * \param mp the Media Player
233 * \param do_pause play/resume if zero, pause if non-zero
234 * \version LibVLC 1.1.1 or later
236 LIBVLC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
240 * Toggle pause (no effect if there is no media)
242 * \param p_mi the Media Player
244 LIBVLC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
247 * Stop (no effect if there is no media)
249 * \param p_mi the Media Player
251 LIBVLC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
254 * Callback prototype to allocate and lock a picture buffer.
256 * Whenever a new video frame needs to be decoded, the lock callback is
257 * invoked. Depending on the video chroma, one or three pixel planes of
258 * adequate dimensions must be returned via the second parameter. Those
259 * planes must be aligned on 32-bytes boundaries.
261 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
262 * \param planes start address of the pixel planes (LibVLC allocates the array
263 * of void pointers, this callback must initialize the array) [OUT]
264 * \return a private pointer for the display and unlock callbacks to identify
265 * the picture buffers
267 typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
270 * Callback prototype to unlock a picture buffer.
272 * When the video frame decoding is complete, the unlock callback is invoked.
273 * This callback might not be needed at all. It is only an indication that the
274 * application can now read the pixel values if it needs to.
276 * \warning A picture buffer is unlocked after the picture is decoded,
277 * but before the picture is displayed.
279 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
280 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
282 * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
283 * callback (this parameter is only for convenience) [IN]
285 typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
286 void *const *planes);
289 * Callback prototype to display a picture.
291 * When the video frame needs to be shown, as determined by the media playback
292 * clock, the display callback is invoked.
294 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
295 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
298 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
301 * Callback prototype to configure picture buffers format.
302 * This callback gets the format of the video as output by the video decoder
303 * and the chain of video filters (if any). It can opt to change any parameter
304 * as it needs. In that case, LibVLC will attempt to convert the video format
305 * (rescaling and chroma conversion) but these operations can be CPU intensive.
307 * \param opaque pointer to the private pointer passed to
308 * libvlc_video_set_callbacks() [IN/OUT]
309 * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
310 * \param width pointer to the pixel width [IN/OUT]
311 * \param height pointer to the pixel height [IN/OUT]
312 * \param pitches table of scanline pitches in bytes for each pixel plane
313 * (the table is allocated by LibVLC) [OUT]
314 * \param lines table of scanlines count for each plane [OUT]
315 * \return the number of picture buffers allocated, 0 indicates failure
318 * For each pixels plane, the scanline pitch must be bigger than or equal to
319 * the number of bytes per pixel multiplied by the pixel width.
320 * Similarly, the number of scanlines must be bigger than of equal to
322 * Furthermore, we recommend that pitches and lines be multiple of 32
323 * to not break assumptions that might be held by optimized code
324 * in the video decoders, video filters and/or video converters.
326 typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
327 unsigned *width, unsigned *height,
332 * Callback prototype to configure picture buffers format.
334 * \param opaque private pointer as passed to libvlc_video_set_callbacks()
335 * (and possibly modified by @ref libvlc_video_format_cb) [IN]
337 typedef void (*libvlc_video_cleanup_cb)(void *opaque);
341 * Set callbacks and private data to render decoded video to a custom area
343 * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
344 * to configure the decoded format.
346 * \param mp the media player
347 * \param lock callback to lock video memory (must not be NULL)
348 * \param unlock callback to unlock video memory (or NULL if not needed)
349 * \param display callback to display video (or NULL if not needed)
350 * \param opaque private pointer for the three callbacks (as first parameter)
351 * \version LibVLC 1.1.1 or later
354 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
355 libvlc_video_lock_cb lock,
356 libvlc_video_unlock_cb unlock,
357 libvlc_video_display_cb display,
361 * Set decoded video chroma and dimensions.
362 * This only works in combination with libvlc_video_set_callbacks(),
363 * and is mutually exclusive with libvlc_video_set_format_callbacks().
365 * \param mp the media player
366 * \param chroma a four-characters string identifying the chroma
367 * (e.g. "RV32" or "YUYV")
368 * \param width pixel width
369 * \param height pixel height
370 * \param pitch line pitch (in bytes)
371 * \version LibVLC 1.1.1 or later
372 * \bug All pixel planes are expected to have the same pitch.
373 * To use the YCbCr color space with chrominance subsampling,
374 * consider using libvlc_video_set_format_callbacks() instead.
377 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
378 unsigned width, unsigned height,
382 * Set decoded video chroma and dimensions. This only works in combination with
383 * libvlc_video_set_callbacks().
385 * \param mp the media player
386 * \param setup callback to select the video format (cannot be NULL)
387 * \param cleanup callback to release any allocated resources (or NULL)
388 * \version LibVLC 2.0.0 or later
391 void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
392 libvlc_video_format_cb setup,
393 libvlc_video_cleanup_cb cleanup );
396 * Set the NSView handler where the media player should render its video output.
398 * Use the vout called "macosx".
400 * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
404 * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
405 * - (void)addVoutSubview:(NSView *)view;
406 * - (void)removeVoutSubview:(NSView *)view;
410 * Or it can be an NSView object.
412 * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
413 * the following code should work:
416 * NSView *video = [[NSView alloc] init];
417 * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
418 * libvlc_media_player_set_nsobject(mp, video);
423 * You can find a live example in VLCVideoView in VLCKit.framework.
425 * \param p_mi the Media Player
426 * \param drawable the drawable that is either an NSView or an object following
427 * the VLCOpenGLVideoViewEmbedding protocol.
429 LIBVLC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
432 * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
434 * \param p_mi the Media Player
435 * \return the NSView handler or 0 if none where set
437 LIBVLC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
440 * Set the agl handler where the media player should render its video output.
442 * \param p_mi the Media Player
443 * \param drawable the agl handler
445 LIBVLC_API void libvlc_media_player_set_agl ( libvlc_media_player_t *p_mi, uint32_t drawable );
448 * Get the agl handler previously set with libvlc_media_player_set_agl().
450 * \param p_mi the Media Player
451 * \return the agl handler or 0 if none where set
453 LIBVLC_API uint32_t libvlc_media_player_get_agl ( libvlc_media_player_t *p_mi );
456 * Set an X Window System drawable where the media player should render its
457 * video output. If LibVLC was built without X11 output support, then this has
460 * The specified identifier must correspond to an existing Input/Output class
461 * X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
462 * the X11 server is the same as the one the VLC instance has been configured
463 * with. This function must be called before video playback is started;
464 * otherwise it will only take effect after playback stop and restart.
466 * \param p_mi the Media Player
467 * \param drawable the ID of the X window
469 LIBVLC_API void libvlc_media_player_set_xwindow ( libvlc_media_player_t *p_mi, uint32_t drawable );
472 * Get the X Window System window identifier previously set with
473 * libvlc_media_player_set_xwindow(). Note that this will return the identifier
474 * even if VLC is not currently using it (for instance if it is playing an
477 * \param p_mi the Media Player
478 * \return an X window ID, or 0 if none where set.
480 LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
483 * Set a Win32/Win64 API window handle (HWND) where the media player should
484 * render its video output. If LibVLC was built without Win32/Win64 API output
485 * support, then this has no effects.
487 * \param p_mi the Media Player
488 * \param drawable windows handle of the drawable
490 LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
493 * Get the Windows API window handle (HWND) previously set with
494 * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
495 * is not currently outputting any video to it.
497 * \param p_mi the Media Player
498 * \return a window handle or NULL if there are none.
500 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
503 * Callback prototype for audio playback.
504 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
505 * \param samples pointer to the first audio sample to play back [IN]
506 * \param count number of audio samples to play back
507 * \param pts expected play time stamp (see libvlc_delay())
509 typedef void (*libvlc_audio_play_cb)(void *data, const void *samples,
510 unsigned count, int64_t pts);
513 * Callback prototype for audio pause.
514 * \note The pause callback is never called if the audio is already paused.
515 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
516 * \param pts time stamp of the pause request (should be elapsed already)
518 typedef void (*libvlc_audio_pause_cb)(void *data, int64_t pts);
521 * Callback prototype for audio resumption (i.e. restart from pause).
522 * \note The resume callback is never called if the audio is not paused.
523 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
524 * \param pts time stamp of the resumption request (should be elapsed already)
526 typedef void (*libvlc_audio_resume_cb)(void *data, int64_t pts);
529 * Callback prototype for audio buffer flush
530 * (i.e. discard all pending buffers and stop playback as soon as possible).
531 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
533 typedef void (*libvlc_audio_flush_cb)(void *data, int64_t pts);
536 * Callback prototype for audio buffer drain
537 * (i.e. wait for pending buffers to be played).
538 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
540 typedef void (*libvlc_audio_drain_cb)(void *data);
543 * Callback prototype for audio volume change.
544 * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
545 * \param volume software volume (1. = nominal, 0. = mute)
546 * \param mute muted flag
548 typedef void (*libvlc_audio_set_volume_cb)(void *data,
549 float volume, bool mute);
552 * Set callbacks and private data for decoded audio.
553 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
554 * to configure the decoded audio format.
556 * \param mp the media player
557 * \param play callback to play audio samples (must not be NULL)
558 * \param pause callback to pause playback (or NULL to ignore)
559 * \param resume callback to resume playback (or NULL to ignore)
560 * \param flush callback to flush audio buffers (or NULL to ignore)
561 * \param drain callback to drain audio buffers (or NULL to ignore)
562 * \param opaque private pointer for the audio callbacks (as first parameter)
563 * \version LibVLC 2.0.0 or later
566 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
567 libvlc_audio_play_cb play,
568 libvlc_audio_pause_cb pause,
569 libvlc_audio_resume_cb resume,
570 libvlc_audio_flush_cb flush,
571 libvlc_audio_drain_cb drain,
575 * Set callbacks and private data for decoded audio. This only works in
576 * combination with libvlc_audio_set_callbacks().
577 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
578 * to configure the decoded audio format.
580 * \param mp the media player
581 * \param set_volume callback to apply audio volume,
582 * or NULL to apply volume in software
583 * \version LibVLC 2.0.0 or later
586 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
587 libvlc_audio_set_volume_cb set_volume );
590 * Callback prototype to setup the audio playback.
591 * This is called when the media player needs to create a new audio output.
592 * \param opaque pointer to the data pointer passed to
593 * libvlc_audio_set_callbacks() [IN/OUT]
594 * \param format 4 bytes sample format [IN/OUT]
595 * \param rate sample rate [IN/OUT]
596 * \param channels channels count [IN/OUT]
597 * \return 0 on success, anything else to skip audio playback
599 typedef int (*libvlc_audio_setup_cb)(void **data, char *format, unsigned *rate,
603 * Callback prototype for audio playback cleanup.
604 * This is called when the media player no longer needs an audio output.
605 * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
607 typedef void (*libvlc_audio_cleanup_cb)(void *data);
610 * Set decoded audio format. This only works in combination with
611 * libvlc_audio_set_callbacks().
613 * \param mp the media player
614 * \param setup callback to select the audio format (cannot be NULL)
615 * \param cleanup callback to release any allocated resources (or NULL)
616 * \version LibVLC 2.0.0 or later
619 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
620 libvlc_audio_setup_cb setup,
621 libvlc_audio_cleanup_cb cleanup );
624 * Set decoded audio format.
625 * This only works in combination with libvlc_audio_set_callbacks(),
626 * and is mutually exclusive with libvlc_audio_set_format_callbacks().
628 * \param mp the media player
629 * \param format a four-characters string identifying the sample format
630 * (e.g. "S16N" or "FL32")
631 * \param rate sample rate (expressed in Hz)
632 * \param channels channels count
633 * \version LibVLC 2.0.0 or later
636 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
637 unsigned rate, unsigned channels );
639 /** \bug This might go away ... to be replaced by a broader system */
642 * Get the current movie length (in ms).
644 * \param p_mi the Media Player
645 * \return the movie length (in ms), or -1 if there is no media.
647 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
650 * Get the current movie time (in ms).
652 * \param p_mi the Media Player
653 * \return the movie time (in ms), or -1 if there is no media.
655 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
658 * Set the movie time (in ms). This has no effect if no media is being played.
659 * Not all formats and protocols support this.
661 * \param p_mi the Media Player
662 * \param i_time the movie time (in ms).
664 LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
667 * Get movie position as percentage between 0.0 and 1.0.
669 * \param p_mi the Media Player
670 * \return movie position, or -1. in case of error
672 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
675 * Set movie position as percentage between 0.0 and 1.0.
676 * This has no effect if playback is not enabled.
677 * This might not work depending on the underlying input format and protocol.
679 * \param p_mi the Media Player
680 * \param f_pos the position
682 LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
685 * Set movie chapter (if applicable).
687 * \param p_mi the Media Player
688 * \param i_chapter chapter number to play
690 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
695 * \param p_mi the Media Player
696 * \return chapter number currently playing, or -1 if there is no media.
698 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
701 * Get movie chapter count
703 * \param p_mi the Media Player
704 * \return number of chapters in movie, or -1.
706 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
709 * Is the player able to play
711 * \param p_mi the Media Player
714 * \libvlc_return_bool
716 LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
719 * Get title chapter count
721 * \param p_mi the Media Player
722 * \param i_title title
723 * \return number of chapters in title, or -1
725 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
726 libvlc_media_player_t *p_mi, int i_title );
731 * \param p_mi the Media Player
732 * \param i_title title number to play
734 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
739 * \param p_mi the Media Player
740 * \return title number currently playing, or -1
742 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
745 * Get movie title count
747 * \param p_mi the Media Player
748 * \return title number count, or -1
750 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
753 * Set previous chapter (if applicable)
755 * \param p_mi the Media Player
757 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
760 * Set next chapter (if applicable)
762 * \param p_mi the Media Player
764 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
767 * Get the requested movie play rate.
768 * @warning Depending on the underlying media, the requested rate may be
769 * different from the real playback rate.
771 * \param p_mi the Media Player
772 * \return movie play rate
774 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
777 * Set movie play rate
779 * \param p_mi the Media Player
780 * \param rate movie play rate to set
781 * \return -1 if an error was detected, 0 otherwise (but even then, it might
782 * not actually work depending on the underlying media protocol)
784 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
787 * Get current movie state
789 * \param p_mi the Media Player
790 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
792 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
797 * \param p_mi the Media Player
798 * \return frames per second (fps) for this playing movie, or 0 if unspecified
800 LIBVLC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
805 * How many video outputs does this media player have?
807 * \param p_mi the media player
808 * \return the number of video outputs
810 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
813 * Is this media player seekable?
815 * \param p_mi the media player
816 * \return true if the media player can seek
818 * \libvlc_return_bool
820 LIBVLC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
823 * Can this media player be paused?
825 * \param p_mi the media player
826 * \return true if the media player can pause
828 * \libvlc_return_bool
830 LIBVLC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
833 * Check if the current program is scrambled
835 * \param p_mi the media player
836 * \return true if the current program is scrambled
838 * \libvlc_return_bool
839 * \version LibVLC 2.2.0 or later
841 LIBVLC_API int libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
844 * Display the next frame (if supported)
846 * \param p_mi the media player
848 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
851 * Navigate through DVD Menu
853 * \param p_mi the Media Player
854 * \param navigate the Navigation mode
855 * \version libVLC 2.0.0 or later
857 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
861 * Set if, and how, the video title will be shown when media is played.
863 * \param p_mi the media player
864 * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
865 * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
866 * \version libVLC 2.1.0 or later
868 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
871 * Release (free) libvlc_track_description_t
873 * \param p_track_description the structure to release
875 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
878 * \deprecated Use libvlc_track_description_list_release instead
880 LIBVLC_DEPRECATED LIBVLC_API
881 void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
883 /** \defgroup libvlc_video LibVLC video controls
888 * Toggle fullscreen status on non-embedded video outputs.
890 * @warning The same limitations applies to this function
891 * as to libvlc_set_fullscreen().
893 * \param p_mi the media player
895 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
898 * Enable or disable fullscreen.
900 * @warning With most window managers, only a top-level windows can be in
901 * full-screen mode. Hence, this function will not operate properly if
902 * libvlc_media_player_set_xwindow() was used to embed the video in a
903 * non-top-level window. In that case, the embedding window must be reparented
904 * to the root window <b>before</b> fullscreen mode is enabled. You will want
905 * to reparent it back to its normal parent when disabling fullscreen.
907 * \param p_mi the media player
908 * \param b_fullscreen boolean for fullscreen status
910 LIBVLC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
913 * Get current fullscreen status.
915 * \param p_mi the media player
916 * \return the fullscreen status (boolean)
918 * \libvlc_return_bool
920 LIBVLC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
923 * Enable or disable key press events handling, according to the LibVLC hotkeys
924 * configuration. By default and for historical reasons, keyboard events are
925 * handled by the LibVLC video widget.
927 * \note On X11, there can be only one subscriber for key press and mouse
928 * click events per window. If your application has subscribed to those events
929 * for the X window ID of the video widget, then LibVLC will not be able to
930 * handle key presses and mouse clicks in any case.
932 * \warning This function is only implemented for X11 and Win32 at the moment.
934 * \param p_mi the media player
935 * \param on true to handle key press events, false to ignore them.
938 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
941 * Enable or disable mouse click events handling. By default, those events are
942 * handled. This is needed for DVD menus to work, as well as a few video
943 * filters such as "puzzle".
945 * \see libvlc_video_set_key_input().
947 * \warning This function is only implemented for X11 and Win32 at the moment.
949 * \param p_mi the media player
950 * \param on true to handle mouse click events, false to ignore them.
953 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
956 * Get the pixel dimensions of a video.
958 * \param p_mi media player
959 * \param num number of the video (starting from, and most commonly 0)
960 * \param px pointer to get the pixel width [OUT]
961 * \param py pointer to get the pixel height [OUT]
962 * \return 0 on success, -1 if the specified video does not exist
965 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
966 unsigned *px, unsigned *py );
969 * Get current video height.
970 * \deprecated Use libvlc_video_get_size() instead.
972 * \param p_mi the media player
973 * \return the video pixel height or 0 if not applicable
975 LIBVLC_DEPRECATED LIBVLC_API
976 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
979 * Get current video width.
980 * \deprecated Use libvlc_video_get_size() instead.
982 * \param p_mi the media player
983 * \return the video pixel width or 0 if not applicable
985 LIBVLC_DEPRECATED LIBVLC_API
986 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
989 * Get the mouse pointer coordinates over a video.
990 * Coordinates are expressed in terms of the decoded video resolution,
991 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
992 * you can query your windowing system directly).
994 * Either of the coordinates may be negative or larger than the corresponding
995 * dimension of the video, if the cursor is outside the rendering area.
997 * @warning The coordinates may be out-of-date if the pointer is not located
998 * on the video rendering area. LibVLC does not track the pointer if it is
999 * outside of the video widget.
1001 * @note LibVLC does not support multiple pointers (it does of course support
1002 * multiple input devices sharing the same pointer) at the moment.
1004 * \param p_mi media player
1005 * \param num number of the video (starting from, and most commonly 0)
1006 * \param px pointer to get the abscissa [OUT]
1007 * \param py pointer to get the ordinate [OUT]
1008 * \return 0 on success, -1 if the specified video does not exist
1011 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1015 * Get the current video scaling factor.
1016 * See also libvlc_video_set_scale().
1018 * \param p_mi the media player
1019 * \return the currently configured zoom factor, or 0. if the video is set
1020 * to fit to the output window/drawable automatically.
1022 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1025 * Set the video scaling factor. That is the ratio of the number of pixels on
1026 * screen to the number of pixels in the original decoded video in each
1027 * dimension. Zero is a special value; it will adjust the video to the output
1028 * window/drawable (in windowed mode) or the entire screen.
1030 * Note that not all video outputs support scaling.
1032 * \param p_mi the media player
1033 * \param f_factor the scaling factor, or zero
1035 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1038 * Get current video aspect ratio.
1040 * \param p_mi the media player
1041 * \return the video aspect ratio or NULL if unspecified
1042 * (the result must be released with free() or libvlc_free()).
1044 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1047 * Set new video aspect ratio.
1049 * \param p_mi the media player
1050 * \param psz_aspect new video aspect-ratio or NULL to reset to default
1051 * \note Invalid aspect ratios are ignored.
1053 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1056 * Get current video subtitle.
1058 * \param p_mi the media player
1059 * \return the video subtitle selected, or -1 if none
1061 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1064 * Get the number of available video subtitles.
1066 * \param p_mi the media player
1067 * \return the number of available video subtitles
1069 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1072 * Get the description of available video subtitles.
1074 * \param p_mi the media player
1075 * \return list containing description of available video subtitles
1077 LIBVLC_API libvlc_track_description_t *
1078 libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1081 * Set new video subtitle.
1083 * \param p_mi the media player
1084 * \param i_spu video subtitle track to select (i_id from track description)
1085 * \return 0 on success, -1 if out of range
1087 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1090 * Set new video subtitle file.
1092 * \param p_mi the media player
1093 * \param psz_subtitle new video subtitle file
1094 * \return the success status (boolean)
1096 LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
1099 * Get the current subtitle delay. Positive values means subtitles are being
1100 * displayed later, negative values earlier.
1102 * \param p_mi media player
1103 * \return time (in microseconds) the display of subtitles is being delayed
1104 * \version LibVLC 2.0.0 or later
1106 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1109 * Set the subtitle delay. This affects the timing of when the subtitle will
1110 * be displayed. Positive values result in subtitles being displayed later,
1111 * while negative values will result in subtitles being displayed earlier.
1113 * The subtitle delay will be reset to zero each time the media changes.
1115 * \param p_mi media player
1116 * \param i_delay time (in microseconds) the display of subtitles should be delayed
1117 * \return 0 on success, -1 on error
1118 * \version LibVLC 2.0.0 or later
1120 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1123 * Get the description of available titles.
1125 * \param p_mi the media player
1126 * \return list containing description of available titles
1128 LIBVLC_API libvlc_track_description_t *
1129 libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
1132 * Get the description of available chapters for specific title.
1134 * \param p_mi the media player
1135 * \param i_title selected title
1136 * \return list containing description of available chapter for title i_title
1138 LIBVLC_API libvlc_track_description_t *
1139 libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
1142 * Get current crop filter geometry.
1144 * \param p_mi the media player
1145 * \return the crop filter geometry or NULL if unset
1147 LIBVLC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
1150 * Set new crop filter geometry.
1152 * \param p_mi the media player
1153 * \param psz_geometry new crop filter geometry (NULL to unset)
1156 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
1159 * Get current teletext page requested.
1161 * \param p_mi the media player
1162 * \return the current teletext page requested.
1164 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1167 * Set new teletext page to retrieve.
1169 * \param p_mi the media player
1170 * \param i_page teletex page number requested
1172 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1175 * Toggle teletext transparent status on video output.
1177 * \param p_mi the media player
1179 LIBVLC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
1182 * Get number of available video tracks.
1184 * \param p_mi media player
1185 * \return the number of available video tracks (int)
1187 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1190 * Get the description of available video tracks.
1192 * \param p_mi media player
1193 * \return list with description of available video tracks, or NULL on error
1195 LIBVLC_API libvlc_track_description_t *
1196 libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1199 * Get current video track.
1201 * \param p_mi media player
1202 * \return the video track ID (int) or -1 if no active input
1204 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1209 * \param p_mi media player
1210 * \param i_track the track ID (i_id field from track description)
1211 * \return 0 on success, -1 if out of range
1214 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1217 * Take a snapshot of the current video window.
1219 * If i_width AND i_height is 0, original size is used.
1220 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1222 * \param p_mi media player instance
1223 * \param num number of video output (typically 0 for the first/only one)
1224 * \param psz_filepath the path where to save the screenshot to
1225 * \param i_width the snapshot's width
1226 * \param i_height the snapshot's height
1227 * \return 0 on success, -1 if the video was not found
1230 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1231 const char *psz_filepath, unsigned int i_width,
1232 unsigned int i_height );
1235 * Enable or disable deinterlace filter
1237 * \param p_mi libvlc media player
1238 * \param psz_mode type of deinterlace filter, NULL to disable
1240 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1241 const char *psz_mode );
1244 * Get an integer marquee option value
1246 * \param p_mi libvlc media player
1247 * \param option marq option to get \see libvlc_video_marquee_int_option_t
1249 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1253 * Get a string marquee option value
1255 * \param p_mi libvlc media player
1256 * \param option marq option to get \see libvlc_video_marquee_string_option_t
1258 LIBVLC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1262 * Enable, disable or set an integer marquee option
1264 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1265 * or disabling (arg 0) the marq filter.
1267 * \param p_mi libvlc media player
1268 * \param option marq option to set \see libvlc_video_marquee_int_option_t
1269 * \param i_val marq option value
1271 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1272 unsigned option, int i_val );
1275 * Set a marquee string option
1277 * \param p_mi libvlc media player
1278 * \param option marq option to set \see libvlc_video_marquee_string_option_t
1279 * \param psz_text marq option value
1281 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1282 unsigned option, const char *psz_text );
1284 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1285 enum libvlc_video_logo_option_t {
1287 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
1292 libvlc_logo_opacity,
1293 libvlc_logo_position
1297 * Get integer logo option.
1299 * \param p_mi libvlc media player instance
1300 * \param option logo option to get, values of libvlc_video_logo_option_t
1302 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1306 * Set logo option as integer. Options that take a different type value
1308 * Passing libvlc_logo_enable as option value has the side effect of
1309 * starting (arg !0) or stopping (arg 0) the logo filter.
1311 * \param p_mi libvlc media player instance
1312 * \param option logo option to set, values of libvlc_video_logo_option_t
1313 * \param value logo option value
1315 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1316 unsigned option, int value );
1319 * Set logo option as string. Options that take a different type value
1322 * \param p_mi libvlc media player instance
1323 * \param option logo option to set, values of libvlc_video_logo_option_t
1324 * \param psz_value logo option value
1326 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1327 unsigned option, const char *psz_value );
1330 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1331 enum libvlc_video_adjust_option_t {
1332 libvlc_adjust_Enable = 0,
1333 libvlc_adjust_Contrast,
1334 libvlc_adjust_Brightness,
1336 libvlc_adjust_Saturation,
1341 * Get integer adjust option.
1343 * \param p_mi libvlc media player instance
1344 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1345 * \version LibVLC 1.1.1 and later.
1347 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1351 * Set adjust option as integer. Options that take a different type value
1353 * Passing libvlc_adjust_enable as option value has the side effect of
1354 * starting (arg !0) or stopping (arg 0) the adjust filter.
1356 * \param p_mi libvlc media player instance
1357 * \param option adust option to set, values of libvlc_video_adjust_option_t
1358 * \param value adjust option value
1359 * \version LibVLC 1.1.1 and later.
1361 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1362 unsigned option, int value );
1365 * Get float adjust option.
1367 * \param p_mi libvlc media player instance
1368 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1369 * \version LibVLC 1.1.1 and later.
1371 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1375 * Set adjust option as float. Options that take a different type value
1378 * \param p_mi libvlc media player instance
1379 * \param option adust option to set, values of libvlc_video_adjust_option_t
1380 * \param value adjust option value
1381 * \version LibVLC 1.1.1 and later.
1383 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1384 unsigned option, float value );
1388 /** \defgroup libvlc_audio LibVLC audio controls
1393 * Audio device types
1395 typedef enum libvlc_audio_output_device_types_t {
1396 libvlc_AudioOutputDevice_Error = -1,
1397 libvlc_AudioOutputDevice_Mono = 1,
1398 libvlc_AudioOutputDevice_Stereo = 2,
1399 libvlc_AudioOutputDevice_2F2R = 4,
1400 libvlc_AudioOutputDevice_3F2R = 5,
1401 libvlc_AudioOutputDevice_5_1 = 6,
1402 libvlc_AudioOutputDevice_6_1 = 7,
1403 libvlc_AudioOutputDevice_7_1 = 8,
1404 libvlc_AudioOutputDevice_SPDIF = 10
1405 } libvlc_audio_output_device_types_t;
1410 typedef enum libvlc_audio_output_channel_t {
1411 libvlc_AudioChannel_Error = -1,
1412 libvlc_AudioChannel_Stereo = 1,
1413 libvlc_AudioChannel_RStereo = 2,
1414 libvlc_AudioChannel_Left = 3,
1415 libvlc_AudioChannel_Right = 4,
1416 libvlc_AudioChannel_Dolbys = 5
1417 } libvlc_audio_output_channel_t;
1421 * Gets the list of available audio output modules.
1423 * \param p_instance libvlc instance
1424 * \return list of available audio outputs. It must be freed it with
1425 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1426 * In case of error, NULL is returned.
1428 LIBVLC_API libvlc_audio_output_t *
1429 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1432 * Frees the list of available audio output modules.
1434 * \param p_list list with audio outputs for release
1437 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1440 * Selects an audio output module.
1441 * \note Any change will take be effect only after playback is stopped and
1442 * restarted. Audio output cannot be changed while playing.
1444 * \param p_mi media player
1445 * \param psz_name name of audio output,
1446 * use psz_name of \see libvlc_audio_output_t
1447 * \return 0 if function succeded, -1 on error
1449 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1450 const char *psz_name );
1453 * Backward compatibility stub. Do not use in new code.
1454 * Use libvlc_audio_output_device_list_get() instead.
1457 LIBVLC_DEPRECATED LIBVLC_API
1458 int libvlc_audio_output_device_count( libvlc_instance_t *, const char * );
1461 * Backward compatibility stub. Do not use in new code.
1462 * Use libvlc_audio_output_device_list_get() instead.
1463 * \return always NULL.
1465 LIBVLC_DEPRECATED LIBVLC_API
1466 char *libvlc_audio_output_device_longname( libvlc_instance_t *, const char *,
1470 * Backward compatibility stub. Do not use in new code.
1471 * Use libvlc_audio_output_device_list_get() instead.
1472 * \return always NULL.
1474 LIBVLC_DEPRECATED LIBVLC_API
1475 char *libvlc_audio_output_device_id( libvlc_instance_t *, const char *, int );
1478 * Gets a list of potential audio output devices,
1479 * \see libvlc_audio_output_device_set().
1481 * \note Not all audio outputs support enumerating devices.
1482 * The audio output may be functional even if the list is empty (NULL).
1484 * \note The list may not be exhaustive.
1486 * \warning Some audio output devices in the list might not actually work in
1487 * some circumstances. By default, it is recommended to not specify any
1488 * explicit audio device.
1490 * \param mp media player
1491 * \return A NULL-terminated linked list of potential audio output devices.
1492 * It must be freed it with libvlc_audio_output_device_list_release()
1493 * \version LibVLC 2.2.0 or later.
1495 LIBVLC_API libvlc_audio_output_device_t *
1496 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
1499 * Gets a list of audio output devices for a given audio output module,
1500 * \see libvlc_audio_output_device_set().
1502 * \note Not all audio outputs support this. In particular, an empty (NULL)
1503 * list of devices does <b>not</b> imply that the specified audio output does
1506 * \note The list might not be exhaustive.
1508 * \warning Some audio output devices in the list might not actually work in
1509 * some circumstances. By default, it is recommended to not specify any
1510 * explicit audio device.
1512 * \param p_instance libvlc instance
1513 * \param psz_aout audio output name
1514 * (as returned by libvlc_audio_output_list_get())
1515 * \return A NULL-terminated linked list of potential audio output devices.
1516 * It must be freed it with libvlc_audio_output_device_list_release()
1517 * \version LibVLC 2.1.0 or later.
1519 LIBVLC_API libvlc_audio_output_device_t *
1520 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
1524 * Frees a list of available audio output devices.
1526 * \param p_list list with audio outputs for release
1527 * \version LibVLC 2.1.0 or later.
1529 LIBVLC_API void libvlc_audio_output_device_list_release(
1530 libvlc_audio_output_device_t *p_list );
1533 * Configures an explicit audio output device.
1535 * If the module paramater is NULL, audio output will be moved to the device
1536 * specified by the device identifier string immediately. This is the
1537 * recommended usage.
1539 * A list of adequate potential device strings can be obtained with
1540 * libvlc_audio_output_device_enum().
1542 * However passing NULL is supported in LibVLC version 2.2.0 and later only;
1543 * in earlier versions, this function would have no effects when the module
1544 * parameter was NULL.
1546 * If the module parameter is not NULL, the device parameter of the
1547 * corresponding audio output, if it exists, will be set to the specified
1548 * string. Note that some audio output modules do not have such a parameter
1549 * (notably MMDevice and PulseAudio).
1551 * A list of adequate potential device strings can be obtained with
1552 * libvlc_audio_output_device_list_get().
1554 * \note This function does not select the specified audio output plugin.
1555 * libvlc_audio_output_set() is used for that purpose.
1557 * \warning The syntax for the device parameter depends on the audio output.
1559 * Some audio output modules require further parameters (e.g. a channels map
1560 * in the case of ALSA).
1562 * \param mp media player
1563 * \param module If NULL, current audio output module.
1564 * if non-NULL, name of audio output module
1565 (\see libvlc_audio_output_t)
1566 * \param device_id device identifier string
1567 * \return Nothing. Errors are ignored (this is a design bug).
1569 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
1571 const char *device_id );
1574 * Get the current audio output device identifier.
1576 * This complements libvlc_audio_output_device_set().
1578 * \warning The initial value for the current audio output device identifier
1579 * may not be set or may be some unknown value. A LibVLC application should
1580 * compare this value against the known device identifiers (e.g. those that
1581 * were previously retrieved by a call to libvlc_audio_output_device_enum or
1582 * libvlc_audio_output_device_list_get) to find the current audio output device.
1584 * It is possible that the selected audio output device changes (an external
1585 * change) without a call to libvlc_audio_output_device_set. That may make this
1586 * method unsuitable to use if a LibVLC application is attempting to track
1587 * dynamic audio device changes as they happen.
1589 * \param mp media player
1590 * \return the current audio output device identifier
1591 * NULL if no device is selected or in case of error
1592 * (the result must be released with free() or libvlc_free()).
1593 * \version LibVLC 3.0.0 or later.
1595 LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
1598 * Stub for backward compatibility.
1599 * \return always -1.
1602 LIBVLC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1605 * Stub for backward compatibility.
1608 LIBVLC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *,
1613 * Toggle mute status.
1615 * \param p_mi media player
1616 * \warning Toggling mute atomically is not always possible: On some platforms,
1617 * other processes can mute the VLC audio playback stream asynchronously. Thus,
1618 * there is a small race condition where toggling will not work.
1619 * See also the limitations of libvlc_audio_set_mute().
1621 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1624 * Get current mute status.
1626 * \param p_mi media player
1627 * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
1629 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1634 * \param p_mi media player
1635 * \param status If status is true then mute, otherwise unmute
1636 * \warning This function does not always work. If there are no active audio
1637 * playback stream, the mute status might not be available. If digital
1638 * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
1639 * some audio output plugins do not support muting at all.
1640 * \note To force silent playback, disable all audio tracks. This is more
1641 * efficient and reliable than mute.
1643 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1646 * Get current software audio volume.
1648 * \param p_mi media player
1649 * \return the software volume in percents
1650 * (0 = mute, 100 = nominal / 0dB)
1652 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1655 * Set current software audio volume.
1657 * \param p_mi media player
1658 * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
1659 * \return 0 if the volume was set, -1 if it was out of range
1661 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1664 * Get number of available audio tracks.
1666 * \param p_mi media player
1667 * \return the number of available audio tracks (int), or -1 if unavailable
1669 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1672 * Get the description of available audio tracks.
1674 * \param p_mi media player
1675 * \return list with description of available audio tracks, or NULL
1677 LIBVLC_API libvlc_track_description_t *
1678 libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1681 * Get current audio track.
1683 * \param p_mi media player
1684 * \return the audio track ID or -1 if no active input.
1686 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1689 * Set current audio track.
1691 * \param p_mi media player
1692 * \param i_track the track ID (i_id field from track description)
1693 * \return 0 on success, -1 on error
1695 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1698 * Get current audio channel.
1700 * \param p_mi media player
1701 * \return the audio channel \see libvlc_audio_output_channel_t
1703 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1706 * Set current audio channel.
1708 * \param p_mi media player
1709 * \param channel the audio channel, \see libvlc_audio_output_channel_t
1710 * \return 0 on success, -1 on error
1712 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1715 * Get current audio delay.
1717 * \param p_mi media player
1718 * \return the audio delay (microseconds)
1719 * \version LibVLC 1.1.1 or later
1721 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1724 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1726 * \param p_mi media player
1727 * \param i_delay the audio delay (microseconds)
1728 * \return 0 on success, -1 on error
1729 * \version LibVLC 1.1.1 or later
1731 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1734 * Get the number of equalizer presets.
1736 * \return number of presets
1737 * \version LibVLC 2.2.0 or later
1739 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
1742 * Get the name of a particular equalizer preset.
1744 * This name can be used, for example, to prepare a preset label or menu in a user
1747 * \param u_index index of the preset, counting from zero
1748 * \return preset name, or NULL if there is no such preset
1749 * \version LibVLC 2.2.0 or later
1751 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
1754 * Get the number of distinct frequency bands for an equalizer.
1756 * \return number of frequency bands
1757 * \version LibVLC 2.2.0 or later
1759 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
1762 * Get a particular equalizer band frequency.
1764 * This value can be used, for example, to create a label for an equalizer band control
1765 * in a user interface.
1767 * \param u_index index of the band, counting from zero
1768 * \return equalizer band frequency (Hz), or -1 if there is no such band
1769 * \version LibVLC 2.2.0 or later
1771 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
1774 * Create a new default equalizer, with all frequency values zeroed.
1776 * The new equalizer can subsequently be applied to a media player by invoking
1777 * libvlc_media_player_set_equalizer().
1779 * The returned handle should be freed via libvlc_audio_equalizer_release() when
1780 * it is no longer needed.
1782 * \return opaque equalizer handle, or NULL on error
1783 * \version LibVLC 2.2.0 or later
1785 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
1788 * Create a new equalizer, with initial frequency values copied from an existing
1791 * The new equalizer can subsequently be applied to a media player by invoking
1792 * libvlc_media_player_set_equalizer().
1794 * The returned handle should be freed via libvlc_audio_equalizer_release() when
1795 * it is no longer needed.
1797 * \param u_index index of the preset, counting from zero
1798 * \return opaque equalizer handle, or NULL on error
1799 * \version LibVLC 2.2.0 or later
1801 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
1804 * Release a previously created equalizer instance.
1806 * The equalizer was previously created by using libvlc_audio_equalizer_new() or
1807 * libvlc_audio_equalizer_new_from_preset().
1809 * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
1811 * \param p_equalizer opaque equalizer handle, or NULL
1812 * \version LibVLC 2.2.0 or later
1814 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
1817 * Set a new pre-amplification value for an equalizer.
1819 * The new equalizer settings are subsequently applied to a media player by invoking
1820 * libvlc_media_player_set_equalizer().
1822 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1824 * \param p_equalizer valid equalizer handle, must not be NULL
1825 * \param f_preamp preamp value (-20.0 to 20.0 Hz)
1826 * \return zero on success, -1 on error
1827 * \version LibVLC 2.2.0 or later
1829 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
1832 * Get the current pre-amplification value from an equalizer.
1834 * \param p_equalizer valid equalizer handle, must not be NULL
1835 * \return preamp value (Hz)
1836 * \version LibVLC 2.2.0 or later
1838 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
1841 * Set a new amplification value for a particular equalizer frequency band.
1843 * The new equalizer settings are subsequently applied to a media player by invoking
1844 * libvlc_media_player_set_equalizer().
1846 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1848 * \param p_equalizer valid equalizer handle, must not be NULL
1849 * \param f_amp amplification value (-20.0 to 20.0 Hz)
1850 * \param u_band index, counting from zero, of the frequency band to set
1851 * \return zero on success, -1 on error
1852 * \version LibVLC 2.2.0 or later
1854 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
1857 * Get the amplification value for a particular equalizer frequency band.
1859 * \param p_equalizer valid equalizer handle, must not be NULL
1860 * \param u_band index, counting from zero, of the frequency band to get
1861 * \return amplification value (Hz); NaN if there is no such frequency band
1862 * \version LibVLC 2.2.0 or later
1864 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
1867 * Apply new equalizer settings to a media player.
1869 * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
1870 * libvlc_audio_equalizer_new_from_preset().
1872 * It is possible to apply new equalizer settings to a media player whether the media
1873 * player is currently playing media or not.
1875 * Invoking this method will immediately apply the new equalizer settings to the audio
1876 * output of the currently playing media if there is any.
1878 * If there is no currently playing media, the new equalizer settings will be applied
1879 * later if and when new media is played.
1881 * Equalizer settings will automatically be applied to subsequently played media.
1883 * To disable the equalizer for a media player invoke this method passing NULL for the
1884 * p_equalizer parameter.
1886 * The media player does not keep a reference to the supplied equalizer so it is safe
1887 * for an application to release the equalizer reference any time after this method
1890 * \param p_mi opaque media player handle
1891 * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
1892 * \return zero on success, -1 on error
1893 * \version LibVLC 2.2.0 or later
1895 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
1899 /** @} media_player */
1905 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */