Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
efc78314 by Steve Lhomme at 2026-02-24T11:51:15+01:00
android/display: group the subpicture VOUT_DISPLAY_CHANGE_SOURCE_CROP/PLACE

VOUT_DISPLAY_CHANGE_SOURCE_PLACE is called when:
- crop changes
- aspect-ratio changes
- video area changes after a window size changes
- zoom changes
- the fitting of the video changes inside the window

We may force a place_changed when it actually didn't change.
But it only calls sub->api.vt.Viewport() which is cheap.

- - - - -
107a2379 by Steve Lhomme at 2026-02-24T11:51:15+01:00
android/display: tell libvlcjni where we want the video to be in the window

Requires https://code.videolan.org/robUx4/libvlcjni/-/commits/core-video-place

- - - - -


3 changed files:

- modules/video_output/android/display.c
- modules/video_output/android/utils.c
- modules/video_output/android/utils.h


Changes:

=====================================
modules/video_output/android/display.c
=====================================
@@ -543,12 +543,8 @@ static void SetVideoLayout(vout_display_t *vd)
     if (!sys->can_set_video_layout)
         return;
 
-    video_format_t rot_fmt;
-    video_format_ApplyRotation(&rot_fmt, vd->source);
-    AWindowHandler_setVideoLayout(sys->awh, rot_fmt.i_width, rot_fmt.i_height,
-                                  rot_fmt.i_visible_width,
-                                  rot_fmt.i_visible_height,
-                                  rot_fmt.i_sar_num, rot_fmt.i_sar_den);
+    AWindowHandler_setVideoLayout(sys->awh, vd->cfg->display.width, 
vd->cfg->display.height,
+                                  vd->place);
 }
 
 static void UpdateASCGeometry(vout_display_t *vd)
@@ -602,26 +598,25 @@ static int Control(vout_display_t *vd, int query)
     switch (query) {
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
+    case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
     {
-        msg_Dbg(vd, "change source crop: %ux%u @ %ux%u aspect: %u/%u",
-                vd->source->i_x_offset, vd->source->i_y_offset,
-                vd->source->i_visible_width,
-                vd->source->i_visible_height,
-                vd->source->i_sar_num,
-                vd->source->i_sar_den);
+        if (query == VOUT_DISPLAY_CHANGE_SOURCE_PLACE)
+            msg_Dbg(vd, "change source place: %dx%d @ %ux%u",
+                    vd->place->x, vd->place->y,
+                    vd->place->width, vd->place->height);
+        else
+            msg_Dbg(vd, "change source crop: %ux%u @ %ux%u aspect: %u/%u",
+                    vd->source->i_x_offset, vd->source->i_y_offset,
+                    vd->source->i_visible_width,
+                    vd->source->i_visible_height,
+                    vd->source->i_sar_num,
+                    vd->source->i_sar_den);
         if (sys->asc.sc != NULL)
             UpdateASCGeometry(vd);
         else
             SetVideoLayout(vd);
         return VLC_SUCCESS;
     }
-    case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
-        msg_Dbg(vd, "change source place: %dx%d @ %ux%u",
-                vd->place->x, vd->place->y,
-                vd->place->width, vd->place->height);
-        if (sys->asc.sc != NULL)
-            UpdateASCGeometry(vd);
-        return VLC_SUCCESS;
     default:
         msg_Warn(vd, "Unknown request in android-display: %d", query);
         return VLC_EGENERIC;
@@ -633,7 +628,7 @@ static void Close(vout_display_t *vd)
     struct sys *sys = vd->sys;
 
     if (sys->can_set_video_layout)
-        AWindowHandler_setVideoLayout(sys->awh, 0, 0, 0, 0, 0, 0);
+        AWindowHandler_setVideoLayout(sys->awh, 0, 0, vd->place);
 
     if (sys->asc.sc != NULL)
     {


=====================================
modules/video_output/android/utils.c
=====================================
@@ -1168,17 +1168,20 @@ AWindowHandler_getCapabilities(AWindowHandler *p_awh)
 
 int
 AWindowHandler_setVideoLayout(AWindowHandler *p_awh,
-                              int i_width, int i_height,
-                              int i_visible_width, int i_visible_height,
-                              int i_sar_num, int i_sar_den)
+                              int i_display_width, int i_display_height,
+                              const vout_display_place_t *place)
 {
     assert(p_awh->capabilities & AWH_CAPS_SET_VIDEO_LAYOUT);
     JNIEnv *p_env = AWindowHandler_getEnv(p_awh);
     if (!p_env)
         return VLC_EGENERIC;
 
-    JNI_ANWCALL(CallVoidMethod, setVideoLayout, i_width, i_height,
-                i_visible_width,i_visible_height, i_sar_num, i_sar_den);
+    vout_display_place_t zero = {0};
+    if (place == NULL)
+        place = &zero;
+
+    JNI_ANWCALL(CallVoidMethod, setVideoLayout, i_display_width, 
i_display_height,
+                (int)place->width, (int)place->height, place->x, place->y);
     return VLC_SUCCESS;
 }
 


=====================================
modules/video_output/android/utils.h
=====================================
@@ -331,9 +331,8 @@ int AWindowHandler_getCapabilities(AWindowHandler *p_awh);
  * Should be called only if AWindowHandler_getCapabilities() has 
AWH_CAPS_SET_VIDEO_LAYOUT
  */
 int AWindowHandler_setVideoLayout(AWindowHandler *p_awh,
-                                  int i_width, int i_height,
-                                  int i_visible_width, int i_visible_height,
-                                  int i_sar_num, int i_sar_den);
+                                  int i_display_width, int i_display_height,
+                                  const vout_display_place_t *);
 
 /**
  * Attach a SurfaceTexture to the OpenGL ES context that is current on the



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/c8a5818cfd8b1b277ec87d710cb39cb90560fea1...107a23796383345ca12b1728a0893e62fa3ffb7b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/c8a5818cfd8b1b277ec87d710cb39cb90560fea1...107a23796383345ca12b1728a0893e62fa3ffb7b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to