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 assumption that might be made by various optimizations
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.
576 * Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
577 * to configure the decoded audio format.
579 * \param mp the media player
580 * \param set_volume callback to apply audio volume,
581 * or NULL to apply volume in software
582 * \version LibVLC 2.0.0 or later
585 void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
586 libvlc_audio_set_volume_cb set_volume );
589 * Callback prototype to setup the audio playback.
590 * This is called when the media player needs to create a new audio output.
591 * \param opaque pointer to the data pointer passed to
592 * libvlc_audio_set_callbacks() [IN/OUT]
593 * \param format 4 bytes sample format [IN/OUT]
594 * \param rate sample rate [IN/OUT]
595 * \param channels channels count [IN/OUT]
596 * \return 0 on success, anything else to skip audio playback
598 typedef int (*libvlc_audio_setup_cb)(void **data, char *format, unsigned *rate,
602 * Callback prototype for audio playback cleanup.
603 * This is called when the media player no longer needs an audio output.
604 * \param opaque data pointer as passed to libvlc_audio_set_callbacks() [IN]
606 typedef void (*libvlc_audio_cleanup_cb)(void *data);
609 * Set decoded audio format. This only works in combination with
610 * libvlc_audio_set_callbacks().
612 * \param mp the media player
613 * \param setup callback to select the audio format (cannot be NULL)
614 * \param cleanup callback to release any allocated resources (or NULL)
615 * \version LibVLC 2.0.0 or later
618 void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
619 libvlc_audio_setup_cb setup,
620 libvlc_audio_cleanup_cb cleanup );
623 * Set decoded audio format.
624 * This only works in combination with libvlc_audio_set_callbacks(),
625 * and is mutually exclusive with libvlc_audio_set_format_callbacks().
627 * \param mp the media player
628 * \param format a four-characters string identifying the sample format
629 * (e.g. "S16N" or "FL32")
630 * \param rate sample rate (expressed in Hz)
631 * \param channels channels count
632 * \version LibVLC 2.0.0 or later
635 void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
636 unsigned rate, unsigned channels );
638 /** \bug This might go away ... to be replaced by a broader system */
641 * Get the current movie length (in ms).
643 * \param p_mi the Media Player
644 * \return the movie length (in ms), or -1 if there is no media.
646 LIBVLC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
649 * Get the current movie time (in ms).
651 * \param p_mi the Media Player
652 * \return the movie time (in ms), or -1 if there is no media.
654 LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
657 * Set the movie time (in ms). This has no effect if no media is being played.
658 * Not all formats and protocols support this.
660 * \param p_mi the Media Player
661 * \param i_time the movie time (in ms).
663 LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
666 * Get movie position as percentage between 0.0 and 1.0.
668 * \param p_mi the Media Player
669 * \return movie position, or -1. in case of error
671 LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
674 * Set movie position as percentage between 0.0 and 1.0.
675 * This has no effect if playback is not enabled.
676 * This might not work depending on the underlying input format and protocol.
678 * \param p_mi the Media Player
679 * \param f_pos the position
681 LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
684 * Set movie chapter (if applicable).
686 * \param p_mi the Media Player
687 * \param i_chapter chapter number to play
689 LIBVLC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
694 * \param p_mi the Media Player
695 * \return chapter number currently playing, or -1 if there is no media.
697 LIBVLC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
700 * Get movie chapter count
702 * \param p_mi the Media Player
703 * \return number of chapters in movie, or -1.
705 LIBVLC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
708 * Is the player able to play
710 * \param p_mi the Media Player
713 * \libvlc_return_bool
715 LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
718 * Get title chapter count
720 * \param p_mi the Media Player
721 * \param i_title title
722 * \return number of chapters in title, or -1
724 LIBVLC_API int libvlc_media_player_get_chapter_count_for_title(
725 libvlc_media_player_t *p_mi, int i_title );
730 * \param p_mi the Media Player
731 * \param i_title title number to play
733 LIBVLC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
738 * \param p_mi the Media Player
739 * \return title number currently playing, or -1
741 LIBVLC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
744 * Get movie title count
746 * \param p_mi the Media Player
747 * \return title number count, or -1
749 LIBVLC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
752 * Set previous chapter (if applicable)
754 * \param p_mi the Media Player
756 LIBVLC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
759 * Set next chapter (if applicable)
761 * \param p_mi the Media Player
763 LIBVLC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
766 * Get the requested movie play rate.
767 * @warning Depending on the underlying media, the requested rate may be
768 * different from the real playback rate.
770 * \param p_mi the Media Player
771 * \return movie play rate
773 LIBVLC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
776 * Set movie play rate
778 * \param p_mi the Media Player
779 * \param rate movie play rate to set
780 * \return -1 if an error was detected, 0 otherwise (but even then, it might
781 * not actually work depending on the underlying media protocol)
783 LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
786 * Get current movie state
788 * \param p_mi the Media Player
789 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
791 LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
796 * \param p_mi the Media Player
797 * \return frames per second (fps) for this playing movie, or 0 if unspecified
799 LIBVLC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
804 * How many video outputs does this media player have?
806 * \param p_mi the media player
807 * \return the number of video outputs
809 LIBVLC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
812 * Is this media player seekable?
814 * \param p_mi the media player
815 * \return true if the media player can seek
817 * \libvlc_return_bool
819 LIBVLC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
822 * Can this media player be paused?
824 * \param p_mi the media player
825 * \return true if the media player can pause
827 * \libvlc_return_bool
829 LIBVLC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
832 * Check if the current program is scrambled
834 * \param p_mi the media player
835 * \return true if the current program is scrambled
837 * \libvlc_return_bool
838 * \version LibVLC 2.2.0 or later
840 LIBVLC_API int libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi );
843 * Display the next frame (if supported)
845 * \param p_mi the media player
847 LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
850 * Navigate through DVD Menu
852 * \param p_mi the Media Player
853 * \param navigate the Navigation mode
854 * \version libVLC 2.0.0 or later
856 LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
860 * Set if, and how, the video title will be shown when media is played.
862 * \param p_mi the media player
863 * \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
864 * \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
865 * \version libVLC 2.1.0 or later
867 LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
870 * Release (free) libvlc_track_description_t
872 * \param p_track_description the structure to release
874 LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
877 * \deprecated Use libvlc_track_description_list_release instead
879 LIBVLC_DEPRECATED LIBVLC_API
880 void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
882 /** \defgroup libvlc_video LibVLC video controls
887 * Toggle fullscreen status on non-embedded video outputs.
889 * @warning The same limitations applies to this function
890 * as to libvlc_set_fullscreen().
892 * \param p_mi the media player
894 LIBVLC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
897 * Enable or disable fullscreen.
899 * @warning With most window managers, only a top-level windows can be in
900 * full-screen mode. Hence, this function will not operate properly if
901 * libvlc_media_player_set_xwindow() was used to embed the video in a
902 * non-top-level window. In that case, the embedding window must be reparented
903 * to the root window <b>before</b> fullscreen mode is enabled. You will want
904 * to reparent it back to its normal parent when disabling fullscreen.
906 * \param p_mi the media player
907 * \param b_fullscreen boolean for fullscreen status
909 LIBVLC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
912 * Get current fullscreen status.
914 * \param p_mi the media player
915 * \return the fullscreen status (boolean)
917 * \libvlc_return_bool
919 LIBVLC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
922 * Enable or disable key press events handling, according to the LibVLC hotkeys
923 * configuration. By default and for historical reasons, keyboard events are
924 * handled by the LibVLC video widget.
926 * \note On X11, there can be only one subscriber for key press and mouse
927 * click events per window. If your application has subscribed to those events
928 * for the X window ID of the video widget, then LibVLC will not be able to
929 * handle key presses and mouse clicks in any case.
931 * \warning This function is only implemented for X11 and Win32 at the moment.
933 * \param p_mi the media player
934 * \param on true to handle key press events, false to ignore them.
937 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
940 * Enable or disable mouse click events handling. By default, those events are
941 * handled. This is needed for DVD menus to work, as well as a few video
942 * filters such as "puzzle".
944 * \see libvlc_video_set_key_input().
946 * \warning This function is only implemented for X11 and Win32 at the moment.
948 * \param p_mi the media player
949 * \param on true to handle mouse click events, false to ignore them.
952 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
955 * Get the pixel dimensions of a video.
957 * \param p_mi media player
958 * \param num number of the video (starting from, and most commonly 0)
959 * \param px pointer to get the pixel width [OUT]
960 * \param py pointer to get the pixel height [OUT]
961 * \return 0 on success, -1 if the specified video does not exist
964 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
965 unsigned *px, unsigned *py );
968 * Get current video height.
969 * \deprecated Use libvlc_video_get_size() instead.
971 * \param p_mi the media player
972 * \return the video pixel height or 0 if not applicable
974 LIBVLC_DEPRECATED LIBVLC_API
975 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
978 * Get current video width.
979 * \deprecated Use libvlc_video_get_size() instead.
981 * \param p_mi the media player
982 * \return the video pixel width or 0 if not applicable
984 LIBVLC_DEPRECATED LIBVLC_API
985 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
988 * Get the mouse pointer coordinates over a video.
989 * Coordinates are expressed in terms of the decoded video resolution,
990 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
991 * you can query your windowing system directly).
993 * Either of the coordinates may be negative or larger than the corresponding
994 * dimension of the video, if the cursor is outside the rendering area.
996 * @warning The coordinates may be out-of-date if the pointer is not located
997 * on the video rendering area. LibVLC does not track the pointer if it is
998 * outside of the video widget.
1000 * @note LibVLC does not support multiple pointers (it does of course support
1001 * multiple input devices sharing the same pointer) at the moment.
1003 * \param p_mi media player
1004 * \param num number of the video (starting from, and most commonly 0)
1005 * \param px pointer to get the abscissa [OUT]
1006 * \param py pointer to get the ordinate [OUT]
1007 * \return 0 on success, -1 if the specified video does not exist
1010 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
1014 * Get the current video scaling factor.
1015 * See also libvlc_video_set_scale().
1017 * \param p_mi the media player
1018 * \return the currently configured zoom factor, or 0. if the video is set
1019 * to fit to the output window/drawable automatically.
1021 LIBVLC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
1024 * Set the video scaling factor. That is the ratio of the number of pixels on
1025 * screen to the number of pixels in the original decoded video in each
1026 * dimension. Zero is a special value; it will adjust the video to the output
1027 * window/drawable (in windowed mode) or the entire screen.
1029 * Note that not all video outputs support scaling.
1031 * \param p_mi the media player
1032 * \param f_factor the scaling factor, or zero
1034 LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
1037 * Get current video aspect ratio.
1039 * \param p_mi the media player
1040 * \return the video aspect ratio or NULL if unspecified
1041 * (the result must be released with free() or libvlc_free()).
1043 LIBVLC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
1046 * Set new video aspect ratio.
1048 * \param p_mi the media player
1049 * \param psz_aspect new video aspect-ratio or NULL to reset to default
1050 * \note Invalid aspect ratios are ignored.
1052 LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
1055 * Get current video subtitle.
1057 * \param p_mi the media player
1058 * \return the video subtitle selected, or -1 if none
1060 LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
1063 * Get the number of available video subtitles.
1065 * \param p_mi the media player
1066 * \return the number of available video subtitles
1068 LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
1071 * Get the description of available video subtitles.
1073 * \param p_mi the media player
1074 * \return list containing description of available video subtitles
1076 LIBVLC_API libvlc_track_description_t *
1077 libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
1080 * Set new video subtitle.
1082 * \param p_mi the media player
1083 * \param i_spu video subtitle track to select (i_id from track description)
1084 * \return 0 on success, -1 if out of range
1086 LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
1089 * Set new video subtitle file.
1091 * \param p_mi the media player
1092 * \param psz_subtitle new video subtitle file
1093 * \return the success status (boolean)
1095 LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
1098 * Get the current subtitle delay. Positive values means subtitles are being
1099 * displayed later, negative values earlier.
1101 * \param p_mi media player
1102 * \return time (in microseconds) the display of subtitles is being delayed
1103 * \version LibVLC 2.0.0 or later
1105 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
1108 * Set the subtitle delay. This affects the timing of when the subtitle will
1109 * be displayed. Positive values result in subtitles being displayed later,
1110 * while negative values will result in subtitles being displayed earlier.
1112 * The subtitle delay will be reset to zero each time the media changes.
1114 * \param p_mi media player
1115 * \param i_delay time (in microseconds) the display of subtitles should be delayed
1116 * \return 0 on success, -1 on error
1117 * \version LibVLC 2.0.0 or later
1119 LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1122 * Get the description of available titles.
1124 * \param p_mi the media player
1125 * \return list containing description of available titles
1127 LIBVLC_API libvlc_track_description_t *
1128 libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
1131 * Get the description of available chapters for specific title.
1133 * \param p_mi the media player
1134 * \param i_title selected title
1135 * \return list containing description of available chapter for title i_title
1137 LIBVLC_API libvlc_track_description_t *
1138 libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
1141 * Get current crop filter geometry.
1143 * \param p_mi the media player
1144 * \return the crop filter geometry or NULL if unset
1146 LIBVLC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
1149 * Set new crop filter geometry.
1151 * \param p_mi the media player
1152 * \param psz_geometry new crop filter geometry (NULL to unset)
1155 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
1158 * Get current teletext page requested.
1160 * \param p_mi the media player
1161 * \return the current teletext page requested.
1163 LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
1166 * Set new teletext page to retrieve.
1168 * \param p_mi the media player
1169 * \param i_page teletex page number requested
1171 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
1174 * Toggle teletext transparent status on video output.
1176 * \param p_mi the media player
1178 LIBVLC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
1181 * Get number of available video tracks.
1183 * \param p_mi media player
1184 * \return the number of available video tracks (int)
1186 LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
1189 * Get the description of available video tracks.
1191 * \param p_mi media player
1192 * \return list with description of available video tracks, or NULL on error
1194 LIBVLC_API libvlc_track_description_t *
1195 libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
1198 * Get current video track.
1200 * \param p_mi media player
1201 * \return the video track ID (int) or -1 if no active input
1203 LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
1208 * \param p_mi media player
1209 * \param i_track the track ID (i_id field from track description)
1210 * \return 0 on success, -1 if out of range
1213 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
1216 * Take a snapshot of the current video window.
1218 * If i_width AND i_height is 0, original size is used.
1219 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
1221 * \param p_mi media player instance
1222 * \param num number of video output (typically 0 for the first/only one)
1223 * \param psz_filepath the path where to save the screenshot to
1224 * \param i_width the snapshot's width
1225 * \param i_height the snapshot's height
1226 * \return 0 on success, -1 if the video was not found
1229 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
1230 const char *psz_filepath, unsigned int i_width,
1231 unsigned int i_height );
1234 * Enable or disable deinterlace filter
1236 * \param p_mi libvlc media player
1237 * \param psz_mode type of deinterlace filter, NULL to disable
1239 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1240 const char *psz_mode );
1243 * Get an integer marquee option value
1245 * \param p_mi libvlc media player
1246 * \param option marq option to get \see libvlc_video_marquee_int_option_t
1248 LIBVLC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1252 * Get a string marquee option value
1254 * \param p_mi libvlc media player
1255 * \param option marq option to get \see libvlc_video_marquee_string_option_t
1257 LIBVLC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1261 * Enable, disable or set an integer marquee option
1263 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1264 * or disabling (arg 0) the marq filter.
1266 * \param p_mi libvlc media player
1267 * \param option marq option to set \see libvlc_video_marquee_int_option_t
1268 * \param i_val marq option value
1270 LIBVLC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1271 unsigned option, int i_val );
1274 * Set a marquee string option
1276 * \param p_mi libvlc media player
1277 * \param option marq option to set \see libvlc_video_marquee_string_option_t
1278 * \param psz_text marq option value
1280 LIBVLC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1281 unsigned option, const char *psz_text );
1283 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1284 enum libvlc_video_logo_option_t {
1286 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
1291 libvlc_logo_opacity,
1292 libvlc_logo_position
1296 * Get integer logo option.
1298 * \param p_mi libvlc media player instance
1299 * \param option logo option to get, values of libvlc_video_logo_option_t
1301 LIBVLC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1305 * Set logo option as integer. Options that take a different type value
1307 * Passing libvlc_logo_enable as option value has the side effect of
1308 * starting (arg !0) or stopping (arg 0) the logo filter.
1310 * \param p_mi libvlc media player instance
1311 * \param option logo option to set, values of libvlc_video_logo_option_t
1312 * \param value logo option value
1314 LIBVLC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1315 unsigned option, int value );
1318 * Set logo option as string. Options that take a different type value
1321 * \param p_mi libvlc media player instance
1322 * \param option logo option to set, values of libvlc_video_logo_option_t
1323 * \param psz_value logo option value
1325 LIBVLC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1326 unsigned option, const char *psz_value );
1329 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1330 enum libvlc_video_adjust_option_t {
1331 libvlc_adjust_Enable = 0,
1332 libvlc_adjust_Contrast,
1333 libvlc_adjust_Brightness,
1335 libvlc_adjust_Saturation,
1340 * Get integer adjust option.
1342 * \param p_mi libvlc media player instance
1343 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1344 * \version LibVLC 1.1.1 and later.
1346 LIBVLC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1350 * Set adjust option as integer. Options that take a different type value
1352 * Passing libvlc_adjust_enable as option value has the side effect of
1353 * starting (arg !0) or stopping (arg 0) the adjust filter.
1355 * \param p_mi libvlc media player instance
1356 * \param option adust option to set, values of libvlc_video_adjust_option_t
1357 * \param value adjust option value
1358 * \version LibVLC 1.1.1 and later.
1360 LIBVLC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1361 unsigned option, int value );
1364 * Get float adjust option.
1366 * \param p_mi libvlc media player instance
1367 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1368 * \version LibVLC 1.1.1 and later.
1370 LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1374 * Set adjust option as float. Options that take a different type value
1377 * \param p_mi libvlc media player instance
1378 * \param option adust option to set, values of libvlc_video_adjust_option_t
1379 * \param value adjust option value
1380 * \version LibVLC 1.1.1 and later.
1382 LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1383 unsigned option, float value );
1387 /** \defgroup libvlc_audio LibVLC audio controls
1392 * Audio device types
1394 typedef enum libvlc_audio_output_device_types_t {
1395 libvlc_AudioOutputDevice_Error = -1,
1396 libvlc_AudioOutputDevice_Mono = 1,
1397 libvlc_AudioOutputDevice_Stereo = 2,
1398 libvlc_AudioOutputDevice_2F2R = 4,
1399 libvlc_AudioOutputDevice_3F2R = 5,
1400 libvlc_AudioOutputDevice_5_1 = 6,
1401 libvlc_AudioOutputDevice_6_1 = 7,
1402 libvlc_AudioOutputDevice_7_1 = 8,
1403 libvlc_AudioOutputDevice_SPDIF = 10
1404 } libvlc_audio_output_device_types_t;
1409 typedef enum libvlc_audio_output_channel_t {
1410 libvlc_AudioChannel_Error = -1,
1411 libvlc_AudioChannel_Stereo = 1,
1412 libvlc_AudioChannel_RStereo = 2,
1413 libvlc_AudioChannel_Left = 3,
1414 libvlc_AudioChannel_Right = 4,
1415 libvlc_AudioChannel_Dolbys = 5
1416 } libvlc_audio_output_channel_t;
1420 * Gets the list of available audio output modules.
1422 * \param p_instance libvlc instance
1423 * \return list of available audio outputs. It must be freed it with
1424 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1425 * In case of error, NULL is returned.
1427 LIBVLC_API libvlc_audio_output_t *
1428 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1431 * Frees the list of available audio output modules.
1433 * \param p_list list with audio outputs for release
1436 void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1439 * Selects an audio output module.
1440 * \note Any change will take be effect only after playback is stopped and
1441 * restarted. Audio output cannot be changed while playing.
1443 * \param p_mi media player
1444 * \param psz_name name of audio output,
1445 * use psz_name of \see libvlc_audio_output_t
1446 * \return 0 if function succeded, -1 on error
1448 LIBVLC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1449 const char *psz_name );
1452 * Backward compatibility stub. Do not use in new code.
1453 * Use libvlc_audio_output_device_list_get() instead.
1456 LIBVLC_DEPRECATED LIBVLC_API
1457 int libvlc_audio_output_device_count( libvlc_instance_t *, const char * );
1460 * Backward compatibility stub. Do not use in new code.
1461 * Use libvlc_audio_output_device_list_get() instead.
1462 * \return always NULL.
1464 LIBVLC_DEPRECATED LIBVLC_API
1465 char *libvlc_audio_output_device_longname( libvlc_instance_t *, const char *,
1469 * Backward compatibility stub. Do not use in new code.
1470 * Use libvlc_audio_output_device_list_get() instead.
1471 * \return always NULL.
1473 LIBVLC_DEPRECATED LIBVLC_API
1474 char *libvlc_audio_output_device_id( libvlc_instance_t *, const char *, int );
1477 * Gets a list of potential audio output devices,
1478 * \see libvlc_audio_output_device_set().
1480 * \note Not all audio outputs support enumerating devices.
1481 * The audio output may be functional even if the list is empty (NULL).
1483 * \note The list may not be exhaustive.
1485 * \warning Some audio output devices in the list might not actually work in
1486 * some circumstances. By default, it is recommended to not specify any
1487 * explicit audio device.
1489 * \param mp media player
1490 * \return A NULL-terminated linked list of potential audio output devices.
1491 * It must be freed it with libvlc_audio_output_device_list_release()
1492 * \version LibVLC 2.2.0 or later.
1494 LIBVLC_API libvlc_audio_output_device_t *
1495 libvlc_audio_output_device_enum( libvlc_media_player_t *mp );
1498 * Gets a list of audio output devices for a given audio output module,
1499 * \see libvlc_audio_output_device_set().
1501 * \note Not all audio outputs support this. In particular, an empty (NULL)
1502 * list of devices does <b>not</b> imply that the specified audio output does
1505 * \note The list might not be exhaustive.
1507 * \warning Some audio output devices in the list might not actually work in
1508 * some circumstances. By default, it is recommended to not specify any
1509 * explicit audio device.
1511 * \param p_instance libvlc instance
1512 * \param psz_aout audio output name
1513 * (as returned by libvlc_audio_output_list_get())
1514 * \return A NULL-terminated linked list of potential audio output devices.
1515 * It must be freed it with libvlc_audio_output_device_list_release()
1516 * \version LibVLC 2.1.0 or later.
1518 LIBVLC_API libvlc_audio_output_device_t *
1519 libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
1523 * Frees a list of available audio output devices.
1525 * \param p_list list with audio outputs for release
1526 * \version LibVLC 2.1.0 or later.
1528 LIBVLC_API void libvlc_audio_output_device_list_release(
1529 libvlc_audio_output_device_t *p_list );
1532 * Configures an explicit audio output device.
1534 * If the module paramater is NULL, audio output will be moved to the device
1535 * specified by the device identifier string immediately. This is the
1536 * recommended usage.
1538 * A list of adequate potential device strings can be obtained with
1539 * libvlc_audio_output_device_enum().
1541 * However passing NULL is supported in LibVLC version 2.2.0 and later only;
1542 * in earlier versions, this function would have no effects when the module
1543 * parameter was NULL.
1545 * If the module parameter is not NULL, the device parameter of the
1546 * corresponding audio output, if it exists, will be set to the specified
1547 * string. Note that some audio output modules do not have such a parameter
1548 * (notably MMDevice and PulseAudio).
1550 * A list of adequate potential device strings can be obtained with
1551 * libvlc_audio_output_device_list_get().
1553 * \note This function does not select the specified audio output plugin.
1554 * libvlc_audio_output_set() is used for that purpose.
1556 * \warning The syntax for the device parameter depends on the audio output.
1558 * Some audio output modules require further parameters (e.g. a channels map
1559 * in the case of ALSA).
1561 * \param mp media player
1562 * \param module If NULL, current audio output module.
1563 * if non-NULL, name of audio output module
1564 (\see libvlc_audio_output_t)
1565 * \param device_id device identifier string
1566 * \return Nothing. Errors are ignored (this is a design bug).
1568 LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
1570 const char *device_id );
1573 * Stub for backward compatibility.
1574 * \return always -1.
1577 LIBVLC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1580 * Stub for backward compatibility.
1583 LIBVLC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *,
1588 * Toggle mute status.
1590 * \param p_mi media player
1591 * \warning Toggling mute atomically is not always possible: On some platforms,
1592 * other processes can mute the VLC audio playback stream asynchronously. Thus,
1593 * there is a small race condition where toggling will not work.
1594 * See also the limitations of libvlc_audio_set_mute().
1596 LIBVLC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1599 * Get current mute status.
1601 * \param p_mi media player
1602 * \return the mute status (boolean) if defined, -1 if undefined/unapplicable
1604 LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1609 * \param p_mi media player
1610 * \param status If status is true then mute, otherwise unmute
1611 * \warning This function does not always work. If there are no active audio
1612 * playback stream, the mute status might not be available. If digital
1613 * pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also
1614 * some audio output plugins do not support muting at all.
1615 * \note To force silent playback, disable all audio tracks. This is more
1616 * efficient and reliable than mute.
1618 LIBVLC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1621 * Get current software audio volume.
1623 * \param p_mi media player
1624 * \return the software volume in percents
1625 * (0 = mute, 100 = nominal / 0dB)
1627 LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1630 * Set current software audio volume.
1632 * \param p_mi media player
1633 * \param i_volume the volume in percents (0 = mute, 100 = 0dB)
1634 * \return 0 if the volume was set, -1 if it was out of range
1636 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1639 * Get number of available audio tracks.
1641 * \param p_mi media player
1642 * \return the number of available audio tracks (int), or -1 if unavailable
1644 LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1647 * Get the description of available audio tracks.
1649 * \param p_mi media player
1650 * \return list with description of available audio tracks, or NULL
1652 LIBVLC_API libvlc_track_description_t *
1653 libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1656 * Get current audio track.
1658 * \param p_mi media player
1659 * \return the audio track ID or -1 if no active input.
1661 LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1664 * Set current audio track.
1666 * \param p_mi media player
1667 * \param i_track the track ID (i_id field from track description)
1668 * \return 0 on success, -1 on error
1670 LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1673 * Get current audio channel.
1675 * \param p_mi media player
1676 * \return the audio channel \see libvlc_audio_output_channel_t
1678 LIBVLC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1681 * Set current audio channel.
1683 * \param p_mi media player
1684 * \param channel the audio channel, \see libvlc_audio_output_channel_t
1685 * \return 0 on success, -1 on error
1687 LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1690 * Get current audio delay.
1692 * \param p_mi media player
1693 * \return the audio delay (microseconds)
1694 * \version LibVLC 1.1.1 or later
1696 LIBVLC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1699 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1701 * \param p_mi media player
1702 * \param i_delay the audio delay (microseconds)
1703 * \return 0 on success, -1 on error
1704 * \version LibVLC 1.1.1 or later
1706 LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1709 * Get the number of equalizer presets.
1711 * \return number of presets
1712 * \version LibVLC 2.2.0 or later
1714 LIBVLC_API unsigned libvlc_audio_equalizer_get_preset_count( void );
1717 * Get the name of a particular equalizer preset.
1719 * This name can be used, for example, to prepare a preset label or menu in a user
1722 * \param u_index index of the preset, counting from zero
1723 * \return preset name, or NULL if there is no such preset
1724 * \version LibVLC 2.2.0 or later
1726 LIBVLC_API const char *libvlc_audio_equalizer_get_preset_name( unsigned u_index );
1729 * Get the number of distinct frequency bands for an equalizer.
1731 * \return number of frequency bands
1732 * \version LibVLC 2.2.0 or later
1734 LIBVLC_API unsigned libvlc_audio_equalizer_get_band_count( void );
1737 * Get a particular equalizer band frequency.
1739 * This value can be used, for example, to create a label for an equalizer band control
1740 * in a user interface.
1742 * \param u_index index of the band, counting from zero
1743 * \return equalizer band frequency (Hz), or -1 if there is no such band
1744 * \version LibVLC 2.2.0 or later
1746 LIBVLC_API float libvlc_audio_equalizer_get_band_frequency( unsigned u_index );
1749 * Create a new default equalizer, with all frequency values zeroed.
1751 * The new equalizer can subsequently be applied to a media player by invoking
1752 * libvlc_media_player_set_equalizer().
1754 * The returned handle should be freed via libvlc_audio_equalizer_release() when
1755 * it is no longer needed.
1757 * \return opaque equalizer handle, or NULL on error
1758 * \version LibVLC 2.2.0 or later
1760 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new( void );
1763 * Create a new equalizer, with initial frequency values copied from an existing
1766 * The new equalizer can subsequently be applied to a media player by invoking
1767 * libvlc_media_player_set_equalizer().
1769 * The returned handle should be freed via libvlc_audio_equalizer_release() when
1770 * it is no longer needed.
1772 * \param u_index index of the preset, counting from zero
1773 * \return opaque equalizer handle, or NULL on error
1774 * \version LibVLC 2.2.0 or later
1776 LIBVLC_API libvlc_equalizer_t *libvlc_audio_equalizer_new_from_preset( unsigned u_index );
1779 * Release a previously created equalizer instance.
1781 * The equalizer was previously created by using libvlc_audio_equalizer_new() or
1782 * libvlc_audio_equalizer_new_from_preset().
1784 * It is safe to invoke this method with a NULL p_equalizer parameter for no effect.
1786 * \param p_equalizer opaque equalizer handle, or NULL
1787 * \version LibVLC 2.2.0 or later
1789 LIBVLC_API void libvlc_audio_equalizer_release( libvlc_equalizer_t *p_equalizer );
1792 * Set a new pre-amplification value for an equalizer.
1794 * The new equalizer settings are subsequently applied to a media player by invoking
1795 * libvlc_media_player_set_equalizer().
1797 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1799 * \param p_equalizer valid equalizer handle, must not be NULL
1800 * \param f_preamp preamp value (-20.0 to 20.0 Hz)
1801 * \return zero on success, -1 on error
1802 * \version LibVLC 2.2.0 or later
1804 LIBVLC_API int libvlc_audio_equalizer_set_preamp( libvlc_equalizer_t *p_equalizer, float f_preamp );
1807 * Get the current pre-amplification value from an equalizer.
1809 * \param p_equalizer valid equalizer handle, must not be NULL
1810 * \return preamp value (Hz)
1811 * \version LibVLC 2.2.0 or later
1813 LIBVLC_API float libvlc_audio_equalizer_get_preamp( libvlc_equalizer_t *p_equalizer );
1816 * Set a new amplification value for a particular equalizer frequency band.
1818 * The new equalizer settings are subsequently applied to a media player by invoking
1819 * libvlc_media_player_set_equalizer().
1821 * The supplied amplification value will be clamped to the -20.0 to +20.0 range.
1823 * \param p_equalizer valid equalizer handle, must not be NULL
1824 * \param f_amp amplification value (-20.0 to 20.0 Hz)
1825 * \param u_band index, counting from zero, of the frequency band to set
1826 * \return zero on success, -1 on error
1827 * \version LibVLC 2.2.0 or later
1829 LIBVLC_API int libvlc_audio_equalizer_set_amp_at_index( libvlc_equalizer_t *p_equalizer, float f_amp, unsigned u_band );
1832 * Get the amplification value for a particular equalizer frequency band.
1834 * \param p_equalizer valid equalizer handle, must not be NULL
1835 * \param u_band index, counting from zero, of the frequency band to get
1836 * \return amplification value (Hz); NaN if there is no such frequency band
1837 * \version LibVLC 2.2.0 or later
1839 LIBVLC_API float libvlc_audio_equalizer_get_amp_at_index( libvlc_equalizer_t *p_equalizer, unsigned u_band );
1842 * Apply new equalizer settings to a media player.
1844 * The equalizer is first created by invoking libvlc_audio_equalizer_new() or
1845 * libvlc_audio_equalizer_new_from_preset().
1847 * It is possible to apply new equalizer settings to a media player whether the media
1848 * player is currently playing media or not.
1850 * Invoking this method will immediately apply the new equalizer settings to the audio
1851 * output of the currently playing media if there is any.
1853 * If there is no currently playing media, the new equalizer settings will be applied
1854 * later if and when new media is played.
1856 * Equalizer settings will automatically be applied to subsequently played media.
1858 * To disable the equalizer for a media player invoke this method passing NULL for the
1859 * p_equalizer parameter.
1861 * The media player does not keep a reference to the supplied equalizer so it is safe
1862 * for an application to release the equalizer reference any time after this method
1865 * \param p_mi opaque media player handle
1866 * \param p_equalizer opaque equalizer handle, or NULL to disable the equalizer for this media player
1867 * \return zero on success, -1 on error
1868 * \version LibVLC 2.2.0 or later
1870 LIBVLC_API int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer );
1874 /** @} media_player */
1880 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */