/*****************************************************************************
* Media Player
*****************************************************************************/
-/** \defgroup libvlc_media_player libvlc_media_player
+/** \defgroup libvlc_media_player LibVLC media player
* \ingroup libvlc
- * LibVLC Media Player, object that let you play a media
- * in a custom drawable
+ * A LibVLC media player plays one media (usually in a custom drawable).
* @{
*/
libvlc_marquee_Y
} libvlc_video_marquee_option_t;
+/**
+ * Navigation mode
+ */
+typedef enum libvlc_navigate_mode_t
+{
+ libvlc_navigate_activate = 0,
+ libvlc_navigate_up,
+ libvlc_navigate_down,
+ libvlc_navigate_left,
+ libvlc_navigate_right
+} libvlc_navigate_mode_t;
+
/**
* Create an empty Media Player object
*
*/
VLC_PUBLIC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
+/**
+ * Pause or resume (no effect if there is no media)
+ *
+ * \param mp the Media Player
+ * \param do_pause play/resume if zero, pause if non-zero
+ * \version LibVLC 1.1.1 or later
+ */
+VLC_PUBLIC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
+ int do_pause );
+
/**
* Toggle pause (no effect if there is no media)
*
*/
VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
+/**
+ * Callback prototype to allocate and lock a picture buffer.
+ *
+ * Whenever a new video frame needs to be decoded, the lock callback is
+ * invoked. Depending on the video chroma, one or three pixel planes of
+ * adequate dimensions must be returned via the second parameter. Those
+ * planes must be aligned on 32-bytes boundaries.
+ *
+ * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
+ * \param planes start address of the pixel planes (LibVLC allocates the array
+ * of void pointers, this callback must initialize the array) [OUT]
+ * \return a private pointer for the display and unlock callbacks to identify
+ * the picture buffers
+ */
+typedef void *(*libvlc_video_lock_cb)(void *opaque, void **planes);
+
+/**
+ * Callback prototype to unlock a picture buffer.
+ *
+ * When the video frame decoding is complete, the unlock callback is invoked.
+ * This callback might not be needed at all. It is only an indication that the
+ * application can now read the pixel values if it needs to.
+ *
+ * \warning A picture buffer is unlocked after the picture is decoded,
+ * but before the picture is displayed.
+ *
+ * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
+ * \param picture private pointer returned from the @ref libvlc_video_lock_cb
+ * callback [IN]
+ * \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
+ * callback (this parameter is only for convenience) [IN]
+ */
+typedef void (*libvlc_video_unlock_cb)(void *opaque, void *picture,
+ void *const *planes);
+
+/**
+ * Callback prototype to display a picture.
+ *
+ * When the video frame needs to be shown, as determined by the media playback
+ * clock, the display callback is invoked.
+ *
+ * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
+ * \param picture private pointer returned from the @ref libvlc_video_lock_cb
+ * callback [IN]
+ */
+typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
+
+/**
+ * Callback prototype to configure picture buffers format.
+ * This callback gets the format of the video as output by the video decoder
+ * and the chain of video filters (if any). It can opt to change any parameter
+ * as it needs. In that case, LibVLC will attempt to convert the video format
+ * (rescaling and chroma conversion) but these operations can be CPU intensive.
+ *
+ * \param opaque pointer to the private pointer passed to
+ * libvlc_video_set_callbacks() [IN/OUT]
+ * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
+ * \param width pointer to the pixel width [IN/OUT]
+ * \param height pointer to the pixel height [IN/OUT]
+ * \param pitches table of scanline pitches in bytes for each pixel plane
+ * (the table is allocated by LibVLC) [OUT]
+ * \param lines table of scanlines count for each plane [OUT]
+ * \return the number of picture buffers allocated, 0 indicates failure
+ *
+ * \note
+ * For each pixels plane, the scanline pitch must be bigger than or equal to
+ * the number of bytes per pixel multiplied by the pixel width.
+ * Similarly, the number of scanlines must be bigger than of equal to
+ * the pixel height.
+ * Furthermore, we recommend that pitches and lines be multiple of 32
+ * to not break assumption that might be made by various optimizations
+ * in the video decoders, video filters and/or video converters.
+ */
+typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
+ unsigned *width, unsigned *height,
+ unsigned *pitches,
+ unsigned *lines);
+
+/**
+ * Callback prototype to configure picture buffers format.
+ *
+ * \param opaque private pointer as passed to libvlc_video_set_callbacks()
+ * (and possibly modified by @ref libvlc_video_format_cb) [IN]
+ */
+typedef void (*libvlc_video_cleanup_cb)(void *opaque);
+
+
+/**
+ * Set callbacks and private data to render decoded video to a custom area
+ * in memory.
+ * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
+ * to configure the decoded format.
+ *
+ * \param mp the media player
+ * \param lock callback to lock video memory (must not be NULL)
+ * \param unlock callback to unlock video memory (or NULL if not needed)
+ * \param display callback to display video (or NULL if not needed)
+ * \param opaque private pointer for the three callbacks (as first parameter)
+ * \version LibVLC 1.1.1 or later
+ */
+VLC_PUBLIC_API
+void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
+ libvlc_video_lock_cb lock,
+ libvlc_video_unlock_cb unlock,
+ libvlc_video_display_cb display,
+ void *opaque );
+
+/**
+ * Set decoded video chroma and dimensions.
+ * This only works in combination with libvlc_video_set_callbacks(),
+ * and is mutually exclusive with libvlc_video_set_format_callbacks().
+ *
+ * \param mp the media player
+ * \param chroma a four-characters string identifying the chroma
+ * (e.g. "RV32" or "YUYV")
+ * \param width pixel width
+ * \param height pixel height
+ * \param pitch line pitch (in bytes)
+ * \version LibVLC 1.1.1 or later
+ * \bug All pixel planes are expected to have the same pitch.
+ * To use the YCbCr color space with chrominance subsampling,
+ * consider using libvlc_video_set_format_callbacks() instead.
+ */
+VLC_PUBLIC_API
+void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
+ unsigned width, unsigned height,
+ unsigned pitch );
+
+/**
+ * Set decoded video chroma and dimensions. This only works in combination with
+ * libvlc_video_set_callbacks().
+ *
+ * \param mp the media player
+ * \param setup callback to select the video format (cannot be NULL)
+ * \param cleanup callback to release any allocated resources (or NULL)
+ * \version LibVLC 1.2.0 or later
+ */
+VLC_PUBLIC_API
+void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
+ libvlc_video_format_cb setup,
+ libvlc_video_cleanup_cb cleanup );
+
/**
* Set the NSView handler where the media player should render its video output.
*
- * The object minimal_macosx expects is of kind NSObject and should
- * respect the protocol:
+ * Use the vout called "macosx".
+ *
+ * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
+ * protocol:
*
- * @protocol VLCOpenGLVideoViewEmbedding <NSObject>
+ * @begincode
+ * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
* - (void)addVoutSubview:(NSView *)view;
* - (void)removeVoutSubview:(NSView *)view;
- * @end
+ * \@end
+ * @endcode
+ *
+ * Or it can be an NSView object.
+ *
+ * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
+ * the following code should work:
+ * @begincode
+ * {
+ * NSView *video = [[NSView alloc] init];
+ * QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
+ * libvlc_media_player_set_nsobject(mp, video);
+ * [video release];
+ * }
+ * @endcode
*
* You can find a live example in VLCVideoView in VLCKit.framework.
*
* \param p_mi the Media Player
- * \param drawable the NSView handler
+ * \param drawable the drawable that is either an NSView or an object following
+ * the VLCOpenGLVideoViewEmbedding protocol.
*/
VLC_PUBLIC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
* The specified identifier must correspond to an existing Input/Output class
* X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
* the X11 server is the same as the one the VLC instance has been configured
- * with.
- * If XVideo is <b>not</b> used, it is assumed that the drawable has the
- * following properties in common with the default X11 screen: depth, scan line
- * pad, black pixel. This is a bug.
+ * with. This function must be called before video playback is started;
+ * otherwise it will only take effect after playback stop and restart.
*
* \param p_mi the Media Player
* \param drawable the ID of the X window
VLC_PUBLIC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
/**
- * Get movie play rate
+ * Get the requested movie play rate.
+ * @warning Depending on the underlying media, the requested rate may be
+ * different from the real playback rate.
*
* \param p_mi the Media Player
- * \return movie play rate, or zero in case of error
+ * \return movie play rate
*/
VLC_PUBLIC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
* Get current movie state
*
* \param p_mi the Media Player
+ * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
*/
VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
* Is this media player seekable?
*
* \param p_mi the media player
+ * \return true if the media player can seek
*/
VLC_PUBLIC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
* Can this media player be paused?
*
* \param p_mi the media player
+ * \return true if the media player can pause
*/
VLC_PUBLIC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
*/
VLC_PUBLIC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
-
+/**
+ * Navigate through DVD Menu
+ *
+ * \param p_mi the Media Player
+ * \param navigate the Navigation mode
+ * \version libVLC 1.2.0 or later
+ */
+VLC_PUBLIC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
+ unsigned navigate );
/**
* Release (free) libvlc_track_description_t
*/
VLC_PUBLIC_API void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
-/** \defgroup libvlc_video libvlc_video
- * \ingroup libvlc_media_player
- * LibVLC Video handling
+/** \defgroup libvlc_video LibVLC video controls
* @{
*/
VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
/**
- * Enable or disable fullscreen on non-embedded video outputs.
+ * Enable or disable fullscreen.
*
- * @warning With most window managers, only a top-level windows can switch to
+ * @warning With most window managers, only a top-level windows can be in
* full-screen mode. Hence, this function will not operate properly if
- * libvlc_media_player_set_xid() or libvlc_media_player_set_hwnd() was
- * used to embed the video in a non-LibVLC widget. If you want to to render an
- * embedded LibVLC video full-screen, the parent embedding widget must expanded
- * to full screen (LibVLC cannot take care of that).
- * LibVLC will then automatically resize the video as appropriate.
+ * libvlc_media_player_set_xwindow() was used to embed the video in a
+ * non-top-level window. In that case, the embedding window must be reparented
+ * to the root window <b>before</b> fullscreen mode is enabled. You will want
+ * to reparent it back to its normal parent when disabling fullscreen.
*
* \param p_mi the media player
* \param b_fullscreen boolean for fullscreen status
* for the X window ID of the video widget, then LibVLC will not be able to
* handle key presses and mouse clicks in any case.
*
- * \warning This function is only implemented for X11 at the moment.
+ * \warning This function is only implemented for X11 and Win32 at the moment.
*
* \param p_mi the media player
* \param on true to handle key press events, false to ignore them.
*
* \note See also libvlc_video_set_key_input().
*
- * \warning This function is only implemented for X11 at the moment.
+ * \warning This function is only implemented for X11 and Win32 at the moment.
*
* \param p_mi the media player
* \param on true to handle mouse click events, false to ignore them.
/**
* Get current video height.
- * You should use libvlc_video_get_size() instead.
+ * \deprecated Use libvlc_video_get_size() instead.
*
* \param p_mi the media player
* \return the video pixel height or 0 if not applicable
/**
* Get current video width.
- * You should use libvlc_video_get_size() instead.
+ * \deprecated Use libvlc_video_get_size() instead.
*
* \param p_mi the media player
* \return the video pixel width or 0 if not applicable
libvlc_logo_delay,
libvlc_logo_repeat,
libvlc_logo_opacity,
- libvlc_logo_position,
+ libvlc_logo_position
};
/**
unsigned option, const char *psz_value );
+/** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
+enum libvlc_video_adjust_option_t {
+ libvlc_adjust_Enable = 0,
+ libvlc_adjust_Contrast,
+ libvlc_adjust_Brightness,
+ libvlc_adjust_Hue,
+ libvlc_adjust_Saturation,
+ libvlc_adjust_Gamma
+};
+
+/**
+ * Get integer adjust option.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option adjust option to get, values of libvlc_video_adjust_option_t
+ * \version LibVLC 1.1.1 and later.
+ */
+VLC_PUBLIC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
+ unsigned option );
+
+/**
+ * Set adjust option as integer. Options that take a different type value
+ * are ignored.
+ * Passing libvlc_adjust_enable as option value has the side effect of
+ * starting (arg !0) or stopping (arg 0) the adjust filter.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option adust option to set, values of libvlc_video_adjust_option_t
+ * \param value adjust option value
+ * \version LibVLC 1.1.1 and later.
+ */
+VLC_PUBLIC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
+ unsigned option, int value );
+
+/**
+ * Get float adjust option.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option adjust option to get, values of libvlc_video_adjust_option_t
+ * \version LibVLC 1.1.1 and later.
+ */
+VLC_PUBLIC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
+ unsigned option );
+
+/**
+ * Set adjust option as float. Options that take a different type value
+ * are ignored.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option adust option to set, values of libvlc_video_adjust_option_t
+ * \param value adjust option value
+ * \version LibVLC 1.1.1 and later.
+ */
+VLC_PUBLIC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
+ unsigned option, float value );
+
/** @} video */
-/** \defgroup libvlc_audio libvlc_audio
- * \ingroup libvlc_media_player
- * LibVLC Audio handling
+/** \defgroup libvlc_audio LibVLC audio controls
* @{
*/
*/
VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
+/**
+ * Get current audio delay.
+ *
+ * \param p_mi media player
+ * \return the audio delay (microseconds)
+ * \version LibVLC 1.1.1 or later
+ */
+VLC_PUBLIC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
+
+/**
+ * Set current audio delay. The audio delay will be reset to zero each time the media changes.
+ *
+ * \param p_mi media player
+ * \param i_delay the audio delay (microseconds)
+ * \return 0 on success, -1 on error
+ * \version LibVLC 1.1.1 or later
+ */
+VLC_PUBLIC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
+
/** @} audio */
/** @} media_player */