mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
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
This commit is contained in:
parent
a5933dc002
commit
57645056ad
1 changed files with 23 additions and 0 deletions
|
@ -263,6 +263,28 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
|
||||||
window->video_rectangle = res;
|
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
|
void
|
||||||
gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
|
gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
|
||||||
const GstVideoInfo * info)
|
const GstVideoInfo * info)
|
||||||
|
@ -274,6 +296,7 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
|
||||||
|
|
||||||
wl_subsurface_set_sync (window->video_subsurface);
|
wl_subsurface_set_sync (window->video_subsurface);
|
||||||
gst_wl_window_resize_video_surface (window, FALSE);
|
gst_wl_window_resize_video_surface (window, FALSE);
|
||||||
|
gst_wl_window_set_opaque (window, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_LIKELY (buffer))
|
if (G_LIKELY (buffer))
|
||||||
|
|
Loading…
Reference in a new issue