Skip to content

Commit

Permalink
libvlc: add API to control display of the video title
Browse files Browse the repository at this point in the history
  • Loading branch information
caprica authored and Rémi Denis-Courmont committed Jul 6, 2013
1 parent 3e454fd commit b64f5e0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
26 changes: 26 additions & 0 deletions include/vlc/libvlc_media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,22 @@ typedef enum libvlc_navigate_mode_t
libvlc_navigate_right
} libvlc_navigate_mode_t;

/**
* Enumeration of values used to set position (e.g. of video title).
*/
typedef enum libvlc_position_t {
libvlc_position_disable=-1,
libvlc_position_center,
libvlc_position_left,
libvlc_position_right,
libvlc_position_top,
libvlc_position_top_left,
libvlc_position_top_right,
libvlc_position_bottom,
libvlc_position_bottom_left,
libvlc_position_bottom_right
} libvlc_position_t;

/**
* Create an empty Media Player object
*
Expand Down Expand Up @@ -823,6 +839,16 @@ LIBVLC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
unsigned navigate );

/**
* Set if, and how, the video title will be shown when media is played.
*
* \param p_mi the media player
* \param position position at which to display the title, or libvlc_position_disable to prevent the title from being displayed
* \param timeout title display timeout in milliseconds (ignored if libvlc_position_disable)
* \version libVLC 2.1.0 or later
*/
LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );

/**
* Release (free) libvlc_track_description_t
*
Expand Down
1 change: 1 addition & 0 deletions lib/libvlc.sym
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ libvlc_media_player_set_xwindow
libvlc_media_player_stop
libvlc_media_player_will_play
libvlc_media_player_navigate
libvlc_media_player_set_video_title_display
libvlc_media_release
libvlc_media_retain
libvlc_media_save_meta
Expand Down
19 changes: 19 additions & 0 deletions lib/media_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "amem-rate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
var_Create (mp, "amem-channels", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);

/* Video Title */
var_Create (mp, "video-title-show", VLC_VAR_BOOL);
var_Create (mp, "video-title-position", VLC_VAR_INTEGER);
var_Create (mp, "video-title-timeout", VLC_VAR_INTEGER);

mp->p_md = NULL;
mp->state = libvlc_NothingSpecial;
mp->p_libvlc_instance = instance;
Expand Down Expand Up @@ -1385,3 +1390,17 @@ void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
vlc_object_release( p_input_thread );
}
}

void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned timeout )
{
if ( position != libvlc_position_disable )
{
var_SetBool( p_mi, "video-title-show", true );
var_SetInteger( p_mi, "video-title-position", position );
var_SetInteger( p_mi, "video-title-timeout", timeout );
}
else
{
var_SetBool( p_mi, "video-title-show", false );
}
}

0 comments on commit b64f5e0

Please sign in to comment.