vlc | branch: master | Mark Lee <mark....@capricasoftware.co.uk> | Sat May 24 
07:41:47 2014 +0100| [dadda2294144efcc26e6c0b9877e477416402f79] | committer: 
Rémi Denis-Courmont

lib: map the position enum to the correct subpicture alignment bitmasks

libvlc_media_player_set_video_title_display() was wrongly using the
enum value directly, leading to the video title appearing in the wrong
position for some values

Signed-off-by: Rémi Denis-Courmont <r...@remlab.net>

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

 lib/media_player.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index 5e8f6b2..e244bc0 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1446,12 +1446,30 @@ void libvlc_media_player_next_frame( 
libvlc_media_player_t *p_mi )
     }
 }
 
+/**
+ * Private lookup table to get subpicture alignment flag values corresponding
+ * to a libvlc_position_t enumerated value.
+ */
+static const int position_subpicture_alignment[] = {
+    0,
+    SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_TOP,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_BOTTOM,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT
+};
+
 void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, 
libvlc_position_t position, unsigned timeout )
 {
+    assert( position >= libvlc_position_disable && position <= 
libvlc_position_bottom_right );
+
     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-position", 
position_subpicture_alignment[position] );
         var_SetInteger( p_mi, "video-title-timeout", timeout );
     }
     else

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to