[vlc-devel] [PATCH] android_window: fix subtitles placement

Thomas Guillem thomas at gllm.fr
Thu Feb 19 18:27:57 CET 2015


Use the biggest size available between display and video size.
---
 modules/video_output/android/android_window.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index a22eb4f..95fcc7b 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -195,34 +195,35 @@ static void FixSubtitleFormat(vout_display_sys_t *sys)
     video_format_t *p_subfmt = &sys->p_sub_window->fmt;
     video_format_t fmt;
     int i_width, i_height;
+    int i_video_width, i_video_height;
     int i_display_width, i_display_height;
     double aspect;
 
     video_format_ApplyRotation(&fmt, &sys->p_window->fmt);
 
     if (fmt.i_visible_width == 0 || fmt.i_visible_height == 0) {
-        i_width = fmt.i_width;
-        i_height = fmt.i_height;
+        i_video_width = fmt.i_width;
+        i_video_height = fmt.i_height;
     } else {
-        i_width = fmt.i_visible_width;
-        i_height = fmt.i_visible_height;
+        i_video_width = fmt.i_visible_width;
+        i_video_height = fmt.i_visible_height;
     }
 
     if (fmt.i_sar_num > 0 && fmt.i_sar_den > 0) {
         if (fmt.i_sar_num >= fmt.i_sar_den)
-            i_width = i_width * fmt.i_sar_num / fmt.i_sar_den;
+            i_video_width = i_video_width * fmt.i_sar_num / fmt.i_sar_den;
         else
-            i_height = i_height * fmt.i_sar_den / fmt.i_sar_num;
+            i_display_height = i_display_height * fmt.i_sar_den / fmt.i_sar_num;
     }
 
     if (sys->p_window->i_angle == 90 || sys->p_window->i_angle == 180) {
         i_display_width = sys->i_display_height;
         i_display_height = sys->i_display_width;
-        aspect = i_height / (double) i_width;
+        aspect = i_video_height / (double) i_video_width;
     } else {
         i_display_width = sys->i_display_width;
         i_display_height = sys->i_display_height;
-        aspect = i_width / (double) i_height;
+        aspect = i_video_width / (double) i_video_height;
     }
 
     if (i_display_width / aspect < i_display_height) {
@@ -233,6 +234,12 @@ static void FixSubtitleFormat(vout_display_sys_t *sys)
         i_height = i_display_height;
     }
 
+    // Use the biggest size available
+    if (i_width * i_height < i_video_width * i_video_height) {
+        i_width = i_video_width;
+        i_height = i_video_height;
+    }
+
     p_subfmt->i_width =
     p_subfmt->i_visible_width = i_width;
     p_subfmt->i_height =
-- 
2.1.3




More information about the vlc-devel mailing list