[vlc-commits] libvlc: add API to control display of the video title

Mark Lee git at videolan.org
Sun Jul 7 11:16:24 CEST 2013


vlc/vlc-2.1 | branch: master | Mark Lee <mark.lee at capricasoftware.co.uk> | Wed Jul  3 17:24:57 2013 +0100| [c346d28f01d2f6f7783f0fe8ef54a1895a85c58e] | committer: Rémi Denis-Courmont

libvlc: add API to control display of the video title

(cherry picked from commit b64f5e0bad8265c5a06fde35e640356be4e6d602)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=c346d28f01d2f6f7783f0fe8ef54a1895a85c58e
---

 include/vlc/libvlc_media_player.h |   26 ++++++++++++++++++++++++++
 lib/libvlc.sym                    |    1 +
 lib/media_player.c                |   19 +++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index bd93201..82c7ac2 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -121,6 +121,22 @@ typedef enum libvlc_navigate_mode_t
 } 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
  *
  * \param p_libvlc_instance the libvlc instance in which the Media Player
@@ -824,6 +840,16 @@ 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
  *
  * \param p_track_description the structure to release
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index c19628a..6a430df 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -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
diff --git a/lib/media_player.c b/lib/media_player.c
index c48daa4..376159f 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -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;
@@ -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 );
+    }
+}



More information about the vlc-commits mailing list