summaryrefslogtreecommitdiff
path: root/ext/wayland
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2017-02-02 16:47:52 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-02-02 13:14:01 -0500
commit57645056ad906a6d997abe6f5134f9b4c595bdf8 (patch)
tree21c4007003c5c2717aa282eb0537859b71719a11 /ext/wayland
parenta5933dc002beaa33a55a0201ccba7e76bd58de25 (diff)
downloadgstreamer-plugins-bad-57645056ad906a6d997abe6f5134f9b4c595bdf8.tar.gz
waylandsink: set video surface opaque
Unless the video format has an alpha component (ARGB, ...), set the video_surface opaque. In the usual case where the black area_surface has the same size as the video_surface (eg: run gst-play-1.0 video.mp4), this makes the black surface totally occluded which makes weston compositor's life easier since it can ignore that surface. Also unconditionally set the black area_surface opaque. https://bugzilla.gnome.org/show_bug.cgi?id=778078
Diffstat (limited to 'ext/wayland')
-rw-r--r--ext/wayland/wlwindow.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
index b60f35116..d08ed87c2 100644
--- a/ext/wayland/wlwindow.c
+++ b/ext/wayland/wlwindow.c
@@ -263,6 +263,28 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
window->video_rectangle = res;
}
+static void
+gst_wl_window_set_opaque (GstWlWindow * window, const GstVideoInfo * info)
+{
+ struct wl_region *region;
+
+ /* Set area opaque */
+ region = wl_compositor_create_region (window->display->compositor);
+ wl_region_add (region, 0, 0, window->render_rectangle.w,
+ window->render_rectangle.h);
+ wl_surface_set_opaque_region (window->area_surface, region);
+ wl_region_destroy (region);
+
+ if (!GST_VIDEO_INFO_HAS_ALPHA (info)) {
+ /* Set video opaque */
+ region = wl_compositor_create_region (window->display->compositor);
+ wl_region_add (region, 0, 0, window->render_rectangle.w,
+ window->render_rectangle.h);
+ wl_surface_set_opaque_region (window->video_surface, region);
+ wl_region_destroy (region);
+ }
+}
+
void
gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
const GstVideoInfo * info)
@@ -274,6 +296,7 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
wl_subsurface_set_sync (window->video_subsurface);
gst_wl_window_resize_video_surface (window, FALSE);
+ gst_wl_window_set_opaque (window, info);
}
if (G_LIKELY (buffer))