1From fb2c268edceeac0abfffd5f3441b5f3fd899f2f0 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Thu, 21 Jul 2022 12:29:27 +0800
4Subject: [PATCH 36/41] HACK: waylandsink: Set size in
5 wl_subsurface_set_position() when no viewport
6
7Tested with hacked enlightenment.
8
9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
10---
11 gst-libs/gst/wayland/gstwlwindow.c | 12 +++++++++++-
12 1 file changed, 11 insertions(+), 1 deletion(-)
13
14diff --git a/gst-libs/gst/wayland/gstwlwindow.c b/gst-libs/gst/wayland/gstwlwindow.c
15index f94976f..21cd476 100644
16--- a/gst-libs/gst/wayland/gstwlwindow.c
17+++ b/gst-libs/gst/wayland/gstwlwindow.c
18@@ -604,7 +604,17 @@ gst_wl_window_resize_video_surface (GstWlWindow * self, gboolean commit)
19         wl_fixed_from_int (src.x), wl_fixed_from_int (src.y),
20         wl_fixed_from_int (src.w), wl_fixed_from_int (src.h));
21   } else {
22-    gst_video_center_rect (&src, &dst, &res, FALSE);
23+    if (priv->fill_mode == GST_WL_WINDOW_STRETCH) {
24+      res = dst;
25+    } else {
26+      if (priv->fill_mode == GST_WL_WINDOW_CROP)
27+        GST_WARNING ("The compositor doesn't support crop mode (no viewport)!");
28+
29+      gst_video_sink_center_rect (src, dst, &res, TRUE);
30+    }
31+
32+    wl_subsurface_set_position (priv->video_subsurface,
33+        res.w << 16 | res.x, res.h << 16 | res.y);
34   }
35
36   wl_subsurface_set_position (priv->video_subsurface, res.x, res.y);
37--
382.20.1
39
40