1 /*****************************************************************************
2 * libvlc_media_player.h: libvlc_media_player external API
3 *****************************************************************************
4 * Copyright (C) 1998-2010 the VideoLAN team
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
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 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 General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, 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
38 /*****************************************************************************
40 *****************************************************************************/
41 /** \defgroup libvlc_media_player LibVLC media player
43 * A LibVLC media player plays one media (usually in a custom drawable).
47 typedef struct libvlc_media_player_t libvlc_media_player_t;
50 * Description for video, audio tracks and subtitles. It contains
51 * id, name (description string) and pointer to next record.
53 typedef struct libvlc_track_description_t
57 struct libvlc_track_description_t *p_next;
59 } libvlc_track_description_t;
62 * Description for audio output. It contains
63 * name, description and pointer to next record.
65 typedef struct libvlc_audio_output_t
68 char *psz_description;
69 struct libvlc_audio_output_t *p_next;
71 } libvlc_audio_output_t;
74 * Rectangle type for video geometry
76 typedef struct libvlc_rectangle_t
83 * Marq options definition
85 typedef enum libvlc_video_marquee_option_t {
86 libvlc_marquee_Enable = 0,
87 libvlc_marquee_Text, /** string argument */
89 libvlc_marquee_Opacity,
90 libvlc_marquee_Position,
91 libvlc_marquee_Refresh,
93 libvlc_marquee_Timeout,
96 } libvlc_video_marquee_option_t;
101 typedef enum libvlc_navigate_mode_t
103 libvlc_navigate_activate = 0,
105 libvlc_navigate_down,
106 libvlc_navigate_left,
107 libvlc_navigate_right
108 } libvlc_navigate_mode_t;
111 * Create an empty Media Player object
113 * \param p_libvlc_instance the libvlc instance in which the Media Player
115 * \return a new media player object, or NULL on error.
117 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
120 * Create a Media Player object from a Media
122 * \param p_md the media. Afterwards the p_md can be safely
124 * \return a new media player object, or NULL on error.
126 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
129 * Release a media_player after use
130 * Decrement the reference count of a media player object. If the
131 * reference count is 0, then libvlc_media_player_release() will
132 * release the media player object. If the media player object
133 * has been released, then it should not be used again.
135 * \param p_mi the Media Player to free
137 VLC_PUBLIC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
140 * Retain a reference to a media player object. Use
141 * libvlc_media_player_release() to decrement reference count.
143 * \param p_mi media player object
145 VLC_PUBLIC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
148 * Set the media that will be used by the media_player. If any,
149 * previous md will be released.
151 * \param p_mi the Media Player
152 * \param p_md the Media. Afterwards the p_md can be safely
155 VLC_PUBLIC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
156 libvlc_media_t *p_md );
159 * Get the media used by the media_player.
161 * \param p_mi the Media Player
162 * \return the media associated with p_mi, or NULL if no
163 * media is associated
165 VLC_PUBLIC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
168 * Get the Event Manager from which the media player send event.
170 * \param p_mi the Media Player
171 * \return the event manager associated with p_mi
173 VLC_PUBLIC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
178 * \param p_mi the Media Player
179 * \return 1 if the media player is playing, 0 otherwise
181 VLC_PUBLIC_API int libvlc_media_player_is_playing ( libvlc_media_player_t *p_mi );
186 * \param p_mi the Media Player
187 * \return 0 if playback started (and was already started), or -1 on error.
189 VLC_PUBLIC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
192 * Pause or resume (no effect if there is no media)
194 * \param mp the Media Player
195 * \param do_pause play/resume if zero, pause if non-zero
196 * \version LibVLC 1.1.1 or later
198 VLC_PUBLIC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
202 * Toggle pause (no effect if there is no media)
204 * \param p_mi the Media Player
206 VLC_PUBLIC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
209 * Stop (no effect if there is no media)
211 * \param p_mi the Media Player
213 VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
216 * Callback prototype to allocate and lock a picture buffer.
218 * Whenever a new video frame needs to be decoded, the lock callback is
219 * invoked. Depending on the video chroma, one or three pixel planes of
220 * adequate dimensions must be returned via the second parameter. Those
221 * planes must be aligned on 32-bytes boundaries.
223 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
224 * \param planes start address of the pixel planes (LibVLC allocates the array
225 * of void pointers, this callback must initialize the array) [OUT]
226 * \return a private pointer for the display and unlock callbacks to identify
227 * the picture buffers
229 typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
232 * Callback prototype to unlock a picture buffer.
234 * When the video frame decoding is complete, the unlock callback is invoked.
235 * This callback might not be needed at all. It is only an indication that the
236 * application can now read the pixel values if it needs to.
238 * \warning A picture buffer is unlocked after the picture is decoded,
239 * but before the picture is displayed.
241 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
242 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
244 * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
245 * callback (this parameter is only for convenience) [IN]
247 typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
248 void *const *planes);
251 * Callback prototype to display a picture.
253 * When the video frame needs to be shown, as determined by the media playback
254 * clock, the display callback is invoked.
256 * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
257 * \param picture private pointer returned from the @ref libvlc_video_lock_cb
260 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
263 * Callback prototype to configure picture buffers format.
264 * This callback gets the format of the video as output by the video decoder
265 * and the chain of video filters (if any). It can opt to change any parameter
266 * as it needs. In that case, LibVLC will attempt to convert the video format
267 * (rescaling and chroma conversion) but these operations can be CPU intensive.
269 * \param opaque pointer to the private pointer passed to
270 * libvlc_video_set_callbacks() [IN/OUT]
271 * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
272 * \param width pointer to the pixel width [IN/OUT]
273 * \param height pointer to the pixel height [IN/OUT]
274 * \param pitches table of scanline pitches in bytes for each pixel plane
275 * (the table is allocated by LibVLC) [OUT]
276 * \param lines table of scanlines count for each plane [OUT]
277 * \return the number of picture buffers allocated, 0 indicates failure
280 * For each pixels plane, the scanline pitch must be bigger than or equal to
281 * the number of bytes per pixel multiplied by the pixel width.
282 * Similarly, the number of scanlines must be bigger than of equal to
284 * Furthermore, we recommend that pitches and lines be multiple of 32
285 * to not break assumption that might be made by various optimizations
286 * in the video decoders, video filters and/or video converters.
288 typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
289 unsigned *width, unsigned *height,
294 * Callback prototype to configure picture buffers format.
296 * \param opaque private pointer as passed to libvlc_video_set_callbacks()
297 * (and possibly modified by @ref libvlc_video_format_cb) [IN]
299 typedef void (*libvlc_video_cleanup_cb)(void *opaque);
303 * Set callbacks and private data to render decoded video to a custom area
305 * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
306 * to configure the decoded format.
308 * \param mp the media player
309 * \param lock callback to lock video memory (must not be NULL)
310 * \param unlock callback to unlock video memory (or NULL if not needed)
311 * \param display callback to display video (or NULL if not needed)
312 * \param opaque private pointer for the three callbacks (as first parameter)
313 * \version LibVLC 1.1.1 or later
316 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
317 libvlc_video_lock_cb lock,
318 libvlc_video_unlock_cb unlock,
319 libvlc_video_display_cb display,
323 * Set decoded video chroma and dimensions.
324 * This only works in combination with libvlc_video_set_callbacks(),
325 * and is mutually exclusive with libvlc_video_set_format_callbacks().
327 * \param mp the media player
328 * \param chroma a four-characters string identifying the chroma
329 * (e.g. "RV32" or "YUYV")
330 * \param width pixel width
331 * \param height pixel height
332 * \param pitch line pitch (in bytes)
333 * \version LibVLC 1.1.1 or later
334 * \bug All pixel planes are expected to have the same pitch.
335 * To use the YCbCr color space with chrominance subsampling,
336 * consider using libvlc_video_set_format_callbacks() instead.
339 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
340 unsigned width, unsigned height,
344 * Set decoded video chroma and dimensions. This only works in combination with
345 * libvlc_video_set_callbacks().
347 * \param mp the media player
348 * \param setup callback to select the video format (cannot be NULL)
349 * \param cleanup callback to release any allocated resources (or NULL)
350 * \version LibVLC 1.2.0 or later
353 void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
354 libvlc_video_format_cb setup,
355 libvlc_video_cleanup_cb cleanup );
358 * Set the NSView handler where the media player should render its video output.
360 * Use the vout called "macosx".
362 * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
366 * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
367 * - (void)addVoutSubview:(NSView *)view;
368 * - (void)removeVoutSubview:(NSView *)view;
372 * Or it can be an NSView object.
374 * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
375 * the following code should work:
378 * NSView *video = [[NSView alloc] init];
379 * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
380 * libvlc_media_player_set_nsobject(mp, video);
385 * You can find a live example in VLCVideoView in VLCKit.framework.
387 * \param p_mi the Media Player
388 * \param drawable the drawable that is either an NSView or an object following
389 * the VLCOpenGLVideoViewEmbedding protocol.
391 VLC_PUBLIC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
394 * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
396 * \param p_mi the Media Player
397 * \return the NSView handler or 0 if none where set
399 VLC_PUBLIC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
402 * Set the agl handler where the media player should render its video output.
404 * \param p_mi the Media Player
405 * \param drawable the agl handler
407 VLC_PUBLIC_API void libvlc_media_player_set_agl ( libvlc_media_player_t *p_mi, uint32_t drawable );
410 * Get the agl handler previously set with libvlc_media_player_set_agl().
412 * \param p_mi the Media Player
413 * \return the agl handler or 0 if none where set
415 VLC_PUBLIC_API uint32_t libvlc_media_player_get_agl ( libvlc_media_player_t *p_mi );
418 * Set an X Window System drawable where the media player should render its
419 * video output. If LibVLC was built without X11 output support, then this has
422 * The specified identifier must correspond to an existing Input/Output class
423 * X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
424 * the X11 server is the same as the one the VLC instance has been configured
425 * with. This function must be called before video playback is started;
426 * otherwise it will only take effect after playback stop and restart.
428 * \param p_mi the Media Player
429 * \param drawable the ID of the X window
431 VLC_PUBLIC_API void libvlc_media_player_set_xwindow ( libvlc_media_player_t *p_mi, uint32_t drawable );
434 * Get the X Window System window identifier previously set with
435 * libvlc_media_player_set_xwindow(). Note that this will return the identifier
436 * even if VLC is not currently using it (for instance if it is playing an
439 * \param p_mi the Media Player
440 * \return an X window ID, or 0 if none where set.
442 VLC_PUBLIC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
445 * Set a Win32/Win64 API window handle (HWND) where the media player should
446 * render its video output. If LibVLC was built without Win32/Win64 API output
447 * support, then this has no effects.
449 * \param p_mi the Media Player
450 * \param drawable windows handle of the drawable
452 VLC_PUBLIC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
455 * Get the Windows API window handle (HWND) previously set with
456 * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
457 * is not currently outputting any video to it.
459 * \param p_mi the Media Player
460 * \return a window handle or NULL if there are none.
462 VLC_PUBLIC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
466 /** \bug This might go away ... to be replaced by a broader system */
469 * Get the current movie length (in ms).
471 * \param p_mi the Media Player
472 * \return the movie length (in ms), or -1 if there is no media.
474 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
477 * Get the current movie time (in ms).
479 * \param p_mi the Media Player
480 * \return the movie time (in ms), or -1 if there is no media.
482 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
485 * Set the movie time (in ms). This has no effect if no media is being played.
486 * Not all formats and protocols support this.
488 * \param p_mi the Media Player
489 * \param i_time the movie time (in ms).
491 VLC_PUBLIC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
494 * Get movie position.
496 * \param p_mi the Media Player
497 * \return movie position, or -1. in case of error
499 VLC_PUBLIC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
502 * Set movie position. This has no effect if playback is not enabled.
503 * This might not work depending on the underlying input format and protocol.
505 * \param p_mi the Media Player
506 * \param f_pos the position
508 VLC_PUBLIC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
511 * Set movie chapter (if applicable).
513 * \param p_mi the Media Player
514 * \param i_chapter chapter number to play
516 VLC_PUBLIC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
521 * \param p_mi the Media Player
522 * \return chapter number currently playing, or -1 if there is no media.
524 VLC_PUBLIC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
527 * Get movie chapter count
529 * \param p_mi the Media Player
530 * \return number of chapters in movie, or -1.
532 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
535 * Is the player able to play
537 * \param p_mi the Media Player
540 VLC_PUBLIC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
543 * Get title chapter count
545 * \param p_mi the Media Player
546 * \param i_title title
547 * \return number of chapters in title, or -1
549 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count_for_title(
550 libvlc_media_player_t *p_mi, int i_title );
555 * \param p_mi the Media Player
556 * \param i_title title number to play
558 VLC_PUBLIC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
563 * \param p_mi the Media Player
564 * \return title number currently playing, or -1
566 VLC_PUBLIC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
569 * Get movie title count
571 * \param p_mi the Media Player
572 * \return title number count, or -1
574 VLC_PUBLIC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
577 * Set previous chapter (if applicable)
579 * \param p_mi the Media Player
581 VLC_PUBLIC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
584 * Set next chapter (if applicable)
586 * \param p_mi the Media Player
588 VLC_PUBLIC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
591 * Get the requested movie play rate.
592 * @warning Depending on the underlying media, the requested rate may be
593 * different from the real playback rate.
595 * \param p_mi the Media Player
596 * \return movie play rate
598 VLC_PUBLIC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
601 * Set movie play rate
603 * \param p_mi the Media Player
604 * \param rate movie play rate to set
605 * \return -1 if an error was detected, 0 otherwise (but even then, it might
606 * not actually work depending on the underlying media protocol)
608 VLC_PUBLIC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
611 * Get current movie state
613 * \param p_mi the Media Player
614 * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
616 VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
621 * \param p_mi the Media Player
622 * \return frames per second (fps) for this playing movie, or 0 if unspecified
624 VLC_PUBLIC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
629 * How many video outputs does this media player have?
631 * \param p_mi the media player
632 * \return the number of video outputs
634 VLC_PUBLIC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
637 * Is this media player seekable?
639 * \param p_mi the media player
640 * \return true if the media player can seek
642 VLC_PUBLIC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
645 * Can this media player be paused?
647 * \param p_mi the media player
648 * \return true if the media player can pause
650 VLC_PUBLIC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
654 * Display the next frame (if supported)
656 * \param p_mi the media player
658 VLC_PUBLIC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
661 * Navigate through DVD Menu
663 * \param p_mi the Media Player
664 * \param navigate the Navigation mode
665 * \version libVLC 1.2.0 or later
667 VLC_PUBLIC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
671 * Release (free) libvlc_track_description_t
673 * \param p_track_description the structure to release
675 VLC_PUBLIC_API void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
677 /** \defgroup libvlc_video LibVLC video controls
682 * Toggle fullscreen status on non-embedded video outputs.
684 * @warning The same limitations applies to this function
685 * as to libvlc_set_fullscreen().
687 * \param p_mi the media player
689 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
692 * Enable or disable fullscreen.
694 * @warning With most window managers, only a top-level windows can be in
695 * full-screen mode. Hence, this function will not operate properly if
696 * libvlc_media_player_set_xwindow() was used to embed the video in a
697 * non-top-level window. In that case, the embedding window must be reparented
698 * to the root window <b>before</b> fullscreen mode is enabled. You will want
699 * to reparent it back to its normal parent when disabling fullscreen.
701 * \param p_mi the media player
702 * \param b_fullscreen boolean for fullscreen status
704 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
707 * Get current fullscreen status.
709 * \param p_mi the media player
710 * \return the fullscreen status (boolean)
712 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
715 * Enable or disable key press events handling, according to the LibVLC hotkeys
716 * configuration. By default and for historical reasons, keyboard events are
717 * handled by the LibVLC video widget.
719 * \note On X11, there can be only one subscriber for key press and mouse
720 * click events per window. If your application has subscribed to those events
721 * for the X window ID of the video widget, then LibVLC will not be able to
722 * handle key presses and mouse clicks in any case.
724 * \warning This function is only implemented for X11 and Win32 at the moment.
726 * \param p_mi the media player
727 * \param on true to handle key press events, false to ignore them.
730 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
733 * Enable or disable mouse click events handling. By default, those events are
734 * handled. This is needed for DVD menus to work, as well as a few video
735 * filters such as "puzzle".
737 * \note See also libvlc_video_set_key_input().
739 * \warning This function is only implemented for X11 and Win32 at the moment.
741 * \param p_mi the media player
742 * \param on true to handle mouse click events, false to ignore them.
745 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
748 * Get the pixel dimensions of a video.
750 * \param p_mi media player
751 * \param num number of the video (starting from, and most commonly 0)
752 * \param px pointer to get the pixel width [OUT]
753 * \param py pointer to get the pixel height [OUT]
754 * \return 0 on success, -1 if the specified video does not exist
757 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
758 unsigned *px, unsigned *py );
761 * Get current video height.
762 * \deprecated Use libvlc_video_get_size() instead.
764 * \param p_mi the media player
765 * \return the video pixel height or 0 if not applicable
768 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
771 * Get current video width.
772 * \deprecated Use libvlc_video_get_size() instead.
774 * \param p_mi the media player
775 * \return the video pixel width or 0 if not applicable
778 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
781 * Get the mouse pointer coordinates over a video.
782 * Coordinates are expressed in terms of the decoded video resolution,
783 * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
784 * you can query your windowing system directly).
786 * Either of the coordinates may be negative or larger than the corresponding
787 * dimension of the video, if the cursor is outside the rendering area.
789 * @warning The coordinates may be out-of-date if the pointer is not located
790 * on the video rendering area. LibVLC does not track the pointer if it is
791 * outside of the video widget.
793 * @note LibVLC does not support multiple pointers (it does of course support
794 * multiple input devices sharing the same pointer) at the moment.
796 * \param p_mi media player
797 * \param num number of the video (starting from, and most commonly 0)
798 * \param px pointer to get the abscissa [OUT]
799 * \param py pointer to get the ordinate [OUT]
800 * \return 0 on success, -1 if the specified video does not exist
803 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
807 * Get the current video scaling factor.
808 * See also libvlc_video_set_scale().
810 * \param p_mi the media player
811 * \return the currently configured zoom factor, or 0. if the video is set
812 * to fit to the output window/drawable automatically.
814 VLC_PUBLIC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
817 * Set the video scaling factor. That is the ratio of the number of pixels on
818 * screen to the number of pixels in the original decoded video in each
819 * dimension. Zero is a special value; it will adjust the video to the output
820 * window/drawable (in windowed mode) or the entire screen.
822 * Note that not all video outputs support scaling.
824 * \param p_mi the media player
825 * \param f_factor the scaling factor, or zero
827 VLC_PUBLIC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
830 * Get current video aspect ratio.
832 * \param p_mi the media player
833 * \return the video aspect ratio or NULL if unspecified
834 * (the result must be released with free() or libvlc_free()).
836 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
839 * Set new video aspect ratio.
841 * \param p_mi the media player
842 * \param psz_aspect new video aspect-ratio or NULL to reset to default
843 * \note Invalid aspect ratios are ignored.
845 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
848 * Get current video subtitle.
850 * \param p_mi the media player
851 * \return the video subtitle selected, or -1 if none
853 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
856 * Get the number of available video subtitles.
858 * \param p_mi the media player
859 * \return the number of available video subtitles
861 VLC_PUBLIC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
864 * Get the description of available video subtitles.
866 * \param p_mi the media player
867 * \return list containing description of available video subtitles
869 VLC_PUBLIC_API libvlc_track_description_t *
870 libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
873 * Set new video subtitle.
875 * \param p_mi the media player
876 * \param i_spu new video subtitle to select
877 * \return 0 on success, -1 if out of range
879 VLC_PUBLIC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, unsigned i_spu );
882 * Set new video subtitle file.
884 * \param p_mi the media player
885 * \param psz_subtitle new video subtitle file
886 * \return the success status (boolean)
888 VLC_PUBLIC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
891 * Get the description of available titles.
893 * \param p_mi the media player
894 * \return list containing description of available titles
896 VLC_PUBLIC_API libvlc_track_description_t *
897 libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
900 * Get the description of available chapters for specific title.
902 * \param p_mi the media player
903 * \param i_title selected title
904 * \return list containing description of available chapter for title i_title
906 VLC_PUBLIC_API libvlc_track_description_t *
907 libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
910 * Get current crop filter geometry.
912 * \param p_mi the media player
913 * \return the crop filter geometry or NULL if unset
915 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
918 * Set new crop filter geometry.
920 * \param p_mi the media player
921 * \param psz_geometry new crop filter geometry (NULL to unset)
924 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
927 * Get current teletext page requested.
929 * \param p_mi the media player
930 * \return the current teletext page requested.
932 VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
935 * Set new teletext page to retrieve.
937 * \param p_mi the media player
938 * \param i_page teletex page number requested
940 VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
943 * Toggle teletext transparent status on video output.
945 * \param p_mi the media player
947 VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
950 * Get number of available video tracks.
952 * \param p_mi media player
953 * \return the number of available video tracks (int)
955 VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
958 * Get the description of available video tracks.
960 * \param p_mi media player
961 * \return list with description of available video tracks, or NULL on error
963 VLC_PUBLIC_API libvlc_track_description_t *
964 libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
967 * Get current video track.
969 * \param p_mi media player
970 * \return the video track (int) or -1 if none
972 VLC_PUBLIC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
977 * \param p_mi media player
978 * \param i_track the track (int)
979 * \return 0 on success, -1 if out of range
982 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
985 * Take a snapshot of the current video window.
987 * If i_width AND i_height is 0, original size is used.
988 * If i_width XOR i_height is 0, original aspect-ratio is preserved.
990 * \param p_mi media player instance
991 * \param num number of video output (typically 0 for the first/only one)
992 * \param psz_filepath the path where to save the screenshot to
993 * \param i_width the snapshot's width
994 * \param i_height the snapshot's height
995 * \return 0 on success, -1 if the video was not found
998 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
999 const char *psz_filepath, unsigned int i_width,
1000 unsigned int i_height );
1003 * Enable or disable deinterlace filter
1005 * \param p_mi libvlc media player
1006 * \param psz_mode type of deinterlace filter, NULL to disable
1008 VLC_PUBLIC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
1009 const char *psz_mode );
1012 * Get an integer marquee option value
1014 * \param p_mi libvlc media player
1015 * \param option marq option to get \see libvlc_video_marquee_int_option_t
1017 VLC_PUBLIC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
1021 * Get a string marquee option value
1023 * \param p_mi libvlc media player
1024 * \param option marq option to get \see libvlc_video_marquee_string_option_t
1026 VLC_PUBLIC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
1030 * Enable, disable or set an integer marquee option
1032 * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
1033 * or disabling (arg 0) the marq filter.
1035 * \param p_mi libvlc media player
1036 * \param option marq option to set \see libvlc_video_marquee_int_option_t
1037 * \param i_val marq option value
1039 VLC_PUBLIC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
1040 unsigned option, int i_val );
1043 * Set a marquee string option
1045 * \param p_mi libvlc media player
1046 * \param option marq option to set \see libvlc_video_marquee_string_option_t
1047 * \param psz_text marq option value
1049 VLC_PUBLIC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
1050 unsigned option, const char *psz_text );
1052 /** option values for libvlc_video_{get,set}_logo_{int,string} */
1053 enum libvlc_video_logo_option_t {
1055 libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
1060 libvlc_logo_opacity,
1061 libvlc_logo_position
1065 * Get integer logo option.
1067 * \param p_mi libvlc media player instance
1068 * \param option logo option to get, values of libvlc_video_logo_option_t
1070 VLC_PUBLIC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
1074 * Set logo option as integer. Options that take a different type value
1076 * Passing libvlc_logo_enable as option value has the side effect of
1077 * starting (arg !0) or stopping (arg 0) the logo filter.
1079 * \param p_mi libvlc media player instance
1080 * \param option logo option to set, values of libvlc_video_logo_option_t
1081 * \param value logo option value
1083 VLC_PUBLIC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
1084 unsigned option, int value );
1087 * Set logo option as string. Options that take a different type value
1090 * \param p_mi libvlc media player instance
1091 * \param option logo option to set, values of libvlc_video_logo_option_t
1092 * \param psz_value logo option value
1094 VLC_PUBLIC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
1095 unsigned option, const char *psz_value );
1098 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
1099 enum libvlc_video_adjust_option_t {
1100 libvlc_adjust_Enable = 0,
1101 libvlc_adjust_Contrast,
1102 libvlc_adjust_Brightness,
1104 libvlc_adjust_Saturation,
1109 * Get integer adjust option.
1111 * \param p_mi libvlc media player instance
1112 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1113 * \version LibVLC 1.1.1 and later.
1115 VLC_PUBLIC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
1119 * Set adjust option as integer. Options that take a different type value
1121 * Passing libvlc_adjust_enable as option value has the side effect of
1122 * starting (arg !0) or stopping (arg 0) the adjust filter.
1124 * \param p_mi libvlc media player instance
1125 * \param option adust option to set, values of libvlc_video_adjust_option_t
1126 * \param value adjust option value
1127 * \version LibVLC 1.1.1 and later.
1129 VLC_PUBLIC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
1130 unsigned option, int value );
1133 * Get float adjust option.
1135 * \param p_mi libvlc media player instance
1136 * \param option adjust option to get, values of libvlc_video_adjust_option_t
1137 * \version LibVLC 1.1.1 and later.
1139 VLC_PUBLIC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
1143 * Set adjust option as float. Options that take a different type value
1146 * \param p_mi libvlc media player instance
1147 * \param option adust option to set, values of libvlc_video_adjust_option_t
1148 * \param value adjust option value
1149 * \version LibVLC 1.1.1 and later.
1151 VLC_PUBLIC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
1152 unsigned option, float value );
1156 /** \defgroup libvlc_audio LibVLC audio controls
1161 * Audio device types
1163 typedef enum libvlc_audio_output_device_types_t {
1164 libvlc_AudioOutputDevice_Error = -1,
1165 libvlc_AudioOutputDevice_Mono = 1,
1166 libvlc_AudioOutputDevice_Stereo = 2,
1167 libvlc_AudioOutputDevice_2F2R = 4,
1168 libvlc_AudioOutputDevice_3F2R = 5,
1169 libvlc_AudioOutputDevice_5_1 = 6,
1170 libvlc_AudioOutputDevice_6_1 = 7,
1171 libvlc_AudioOutputDevice_7_1 = 8,
1172 libvlc_AudioOutputDevice_SPDIF = 10
1173 } libvlc_audio_output_device_types_t;
1178 typedef enum libvlc_audio_output_channel_t {
1179 libvlc_AudioChannel_Error = -1,
1180 libvlc_AudioChannel_Stereo = 1,
1181 libvlc_AudioChannel_RStereo = 2,
1182 libvlc_AudioChannel_Left = 3,
1183 libvlc_AudioChannel_Right = 4,
1184 libvlc_AudioChannel_Dolbys = 5
1185 } libvlc_audio_output_channel_t;
1189 * Get the list of available audio outputs
1191 * \param p_instance libvlc instance
1192 * \return list of available audio outputs. It must be freed it with
1193 * \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1194 * In case of error, NULL is returned.
1196 VLC_PUBLIC_API libvlc_audio_output_t *
1197 libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1200 * Free the list of available audio outputs
1202 * \param p_list list with audio outputs for release
1204 VLC_PUBLIC_API void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1207 * Set the audio output.
1208 * Change will be applied after stop and play.
1210 * \param p_mi media player
1211 * \param psz_name name of audio output,
1212 * use psz_name of \see libvlc_audio_output_t
1213 * \return true if function succeded
1215 VLC_PUBLIC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1216 const char *psz_name );
1219 * Get count of devices for audio output, these devices are hardware oriented
1220 * like analor or digital output of sound card
1222 * \param p_instance libvlc instance
1223 * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1224 * \return number of devices
1226 VLC_PUBLIC_API int libvlc_audio_output_device_count( libvlc_instance_t *p_instance,
1227 const char *psz_audio_output );
1230 * Get long name of device, if not available short name given
1232 * \param p_instance libvlc instance
1233 * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1234 * \param i_device device index
1235 * \return long name of device
1237 VLC_PUBLIC_API char * libvlc_audio_output_device_longname( libvlc_instance_t *p_instance,
1238 const char *psz_audio_output,
1242 * Get id name of device
1244 * \param p_instance libvlc instance
1245 * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1246 * \param i_device device index
1247 * \return id name of device, use for setting device, need to be free after use
1249 VLC_PUBLIC_API char * libvlc_audio_output_device_id( libvlc_instance_t *p_instance,
1250 const char *psz_audio_output,
1254 * Set audio output device. Changes are only effective after stop and play.
1256 * \param p_mi media player
1257 * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1258 * \param psz_device_id device
1260 VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_media_player_t *p_mi,
1261 const char *psz_audio_output,
1262 const char *psz_device_id );
1265 * Get current audio device type. Device type describes something like
1266 * character of output sound - stereo sound, 2.1, 5.1 etc
1268 * \param p_mi media player
1269 * \return the audio devices type \see libvlc_audio_output_device_types_t
1271 VLC_PUBLIC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1274 * Set current audio device type.
1276 * \param p_mi vlc instance
1277 * \param device_type the audio device type,
1278 according to \see libvlc_audio_output_device_types_t
1280 VLC_PUBLIC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *p_mi,
1285 * Toggle mute status.
1287 * \param p_mi media player
1289 VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1292 * Get current mute status.
1294 * \param p_mi media player
1295 * \return the mute status (boolean)
1297 VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1302 * \param p_mi media player
1303 * \param status If status is true then mute, otherwise unmute
1305 VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1308 * Get current audio level.
1310 * \param p_mi media player
1311 * \return the audio level (int)
1313 VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1316 * Set current audio level.
1318 * \param p_mi media player
1319 * \param i_volume the volume (int)
1320 * \return 0 if the volume was set, -1 if it was out of range
1322 VLC_PUBLIC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1325 * Get number of available audio tracks.
1327 * \param p_mi media player
1328 * \return the number of available audio tracks (int), or -1 if unavailable
1330 VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1333 * Get the description of available audio tracks.
1335 * \param p_mi media player
1336 * \return list with description of available audio tracks, or NULL
1338 VLC_PUBLIC_API libvlc_track_description_t *
1339 libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1342 * Get current audio track.
1344 * \param p_mi media player
1345 * \return the audio track (int), or -1 if none.
1347 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1350 * Set current audio track.
1352 * \param p_mi media player
1353 * \param i_track the track (int)
1354 * \return 0 on success, -1 on error
1356 VLC_PUBLIC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1359 * Get current audio channel.
1361 * \param p_mi media player
1362 * \return the audio channel \see libvlc_audio_output_channel_t
1364 VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1367 * Set current audio channel.
1369 * \param p_mi media player
1370 * \param channel the audio channel, \see libvlc_audio_output_channel_t
1371 * \return 0 on success, -1 on error
1373 VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1376 * Get current audio delay.
1378 * \param p_mi media player
1379 * \return the audio delay (microseconds)
1380 * \version LibVLC 1.1.1 or later
1382 VLC_PUBLIC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
1385 * Set current audio delay. The audio delay will be reset to zero each time the media changes.
1387 * \param p_mi media player
1388 * \param i_delay the audio delay (microseconds)
1389 * \return 0 on success, -1 on error
1390 * \version LibVLC 1.1.1 or later
1392 VLC_PUBLIC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
1396 /** @} media_player */
1402 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */