]> git.sesse.net Git - vlc/commitdiff
android_window: fix subtitles placement
authorThomas Guillem <thomas@gllm.fr>
Thu, 19 Feb 2015 17:27:57 +0000 (18:27 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 20 Feb 2015 09:24:44 +0000 (10:24 +0100)
Use the biggest size available between display and video size.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_output/android/android_window.c

index a22eb4f29416849b8bee29c00511568870a211cb..95fcc7b7f8e321e34f9538051f4fdf0402254c4e 100644 (file)
@@ -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 =