<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hello,<br></div><div class="gmail_quote"><br>On 23 May 2014 03:02, Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:remi@remlab.net" target="_blank">remi@remlab.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 2014-05-23 01:23, Mark Lee a écrit :<div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
libvlc_media_player_set_video_<u></u>title_display() was wrongly using the<br>
enum value directly, leading to the video title appearing in the wrong<br>
position for some values<br>
---<br>
 lib/media_player.c | 36 ++++++++++++++++++++++++++++++<u></u>+++++-<br>
 1 file changed, 35 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/lib/media_player.c b/lib/media_player.c<br>
index 67bbde7..fb7d758 100644<br>
--- a/lib/media_player.c<br>
+++ b/lib/media_player.c<br>
@@ -1449,8 +1449,42 @@ void<br>
libvlc_media_player_set_video_<u></u>title_display( libvlc_media_player_t<br>
*p_mi, l<br>
 {<br>
     if ( position != libvlc_position_disable )<br>
     {<br>
+        int64_t pos;<br>
+        switch (position) {<br>
+            case libvlc_position_center:<br>
+                pos = 0;<br>
+                break;<br>
+            case libvlc_position_left:<br>
+                pos = SUBPICTURE_ALIGN_LEFT;<br>
+                break;<br>
+            case libvlc_position_right:<br>
+                pos = SUBPICTURE_ALIGN_RIGHT;<br>
+                break;<br>
+            case libvlc_position_top:<br>
+                pos = SUBPICTURE_ALIGN_TOP;<br>
+                break;<br>
+            case libvlc_position_top_left:<br>
+                pos = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;<br>
+                break;<br>
+            case libvlc_position_top_right:<br>
+                pos = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT;<br>
+                break;<br>
+            case libvlc_position_bottom:<br>
+                pos = SUBPICTURE_ALIGN_BOTTOM;<br>
+                break;<br>
+            case libvlc_position_bottom_left:<br>
+                pos = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT;<br>
+                break;<br>
+            case libvlc_position_bottom_right:<br>
+                pos = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT;<br>
+                break;<br>
+            default:<br>
+                pos = 0;<br>
+                break;<br>
</blockquote>
<br></div></div>
I think a lookup table (preceded by a boundary check) makes more sense than a switch here. Also there should be no need for int64. Otherwise OK.</blockquote><div><br></div><div>If the boundary check fails should an error code be returned? Currently the method has a void return type - is it OK to change the return type void -> int in the public API in this case?<br>
</div><div><br></div><div>Or should I implement it so if the boundary check fails it is effectively the same as disabling the video title, and keep the return type as void?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+        }<br>
+<br>
         var_SetBool( p_mi, "video-title-show", true );<br>
-        var_SetInteger( p_mi, "video-title-position", position );<br>
+        var_SetInteger( p_mi, "video-title-position", pos );<br>
         var_SetInteger( p_mi, "video-title-timeout", timeout );<br>
     }<br>
     else<br>
</blockquote>
<br>
-- <br></div></div><span class="HOEnZb"><font color="#888888">
Rémi Denis-Courmont<br>
______________________________<u></u>_________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/<u></u>listinfo/vlc-devel</a><br>
</font></span></blockquote></div><br><br><a href="http://apricasoftware.co.uk" target="_blank"></a>
</div></div>