[vlc-commits] wayland:shm: fix aspect ratio/crop positioning

Steve Lhomme git at videolan.org
Sun Sep 3 10:54:23 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Fri Aug 11 08:53:13 2017 +0200| [02b4341479a9da67990896283c846bb6707529d7] | committer: Rémi Denis-Courmont

wayland:shm: fix aspect ratio/crop positioning

We need to keep track of the previous position of the picture when the display
area changes.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/video_output/wayland/shm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index e1eedb6a2f..08ad5022f9 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -57,6 +57,8 @@ struct vout_display_sys_t
     int x;
     int y;
     bool use_buffer_transform;
+
+    video_format_t curr_aspect;
 };
 
 static void PictureDestroy(picture_t *pic)
@@ -280,6 +282,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             vd->fmt.i_y_offset = src.i_y_offset * place.height
                                                 / src.i_visible_height;
             ResetPictures(vd);
+            sys->curr_aspect = vd->source;
             break;
         }
 
@@ -303,7 +306,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
 
             vout_display_place_t place;
 
-            vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
+            vout_display_PlacePicture(&place, &sys->curr_aspect, vd->cfg, false);
             sys->x += place.width / 2;
             sys->y += place.height / 2;
 
@@ -326,6 +329,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             }
             else
                 vout_display_SendEventPicturesInvalid(vd);
+            sys->curr_aspect = vd->source;
             break;
         }
         default:
@@ -460,6 +464,8 @@ static int Open(vlc_object_t *obj)
         video_format_ApplyRotation(&vd->fmt, &fmt);
     }
 
+    sys->curr_aspect = vd->source;
+
     vd->fmt.i_chroma = VLC_CODEC_RGB32;
 
     vd->info.has_pictures_invalid = sys->viewport == NULL;



More information about the vlc-commits mailing list