summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2016-09-22 18:55:23 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-09-22 19:12:22 -0400
commitf6b270d8eb0583940b59af35ea8552876234d335 (patch)
treebb8ff78c625754a5ad876315886f0c45ca83b30a
parentfdea1e114461b992ae5279776adb3d96bd4c14d9 (diff)
downloadgstreamer-plugins-bad-f6b270d8eb0583940b59af35ea8552876234d335.tar.gz
waylandsink: Update our window size on configure event
This is specific to when the waylandsink is not being embedded. In this patch we pass the render lock to the window so it can safely call gst_wl_window_set_render_rectangle() with the new size. https://bugzilla.gnome.org/show_bug.cgi?id=722343
-rw-r--r--ext/wayland/gstwaylandsink.c7
-rw-r--r--ext/wayland/wlwindow.c22
-rw-r--r--ext/wayland/wlwindow.h7
3 files changed, 26 insertions, 10 deletions
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 1349c6bf1..bc32e1c7d 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -600,8 +600,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
if (!sink->window) {
/* if we were not provided a window, create one ourselves */
- sink->window =
- gst_wl_window_new_toplevel (sink->display, &sink->video_info);
+ sink->window = gst_wl_window_new_toplevel (sink->display,
+ &sink->video_info, &sink->render_lock);
}
}
@@ -806,7 +806,8 @@ gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
"an externally-supplied display handle. Consider providing a "
"display handle from your application with GstContext"));
} else {
- sink->window = gst_wl_window_new_in_surface (sink->display, surface);
+ sink->window = gst_wl_window_new_in_surface (sink->display, surface,
+ &sink->render_lock);
}
} else {
GST_ERROR_OBJECT (sink, "Failed to find display handle, "
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
index febf55247..b60f35116 100644
--- a/ext/wayland/wlwindow.c
+++ b/ext/wayland/wlwindow.c
@@ -46,11 +46,21 @@ static void
handle_configure (void *data, struct wl_shell_surface *shell_surface,
uint32_t edges, int32_t width, int32_t height)
{
+ GstWlWindow *window = data;
+
+ GST_DEBUG ("Windows configure: edges %x, width = %i, height %i", edges,
+ width, height);
+
+ if (width == 0 || height == 0)
+ return;
+
+ gst_wl_window_set_render_rectangle (window, 0, 0, width, height);
}
static void
handle_popup_done (void *data, struct wl_shell_surface *shell_surface)
{
+ GST_DEBUG ("Window popup done.");
}
static const struct wl_shell_surface_listener shell_surface_listener = {
@@ -99,13 +109,14 @@ gst_wl_window_finalize (GObject * gobject)
}
static GstWlWindow *
-gst_wl_window_new_internal (GstWlDisplay * display)
+gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
{
GstWlWindow *window;
struct wl_region *region;
window = g_object_new (GST_TYPE_WL_WINDOW, NULL);
window->display = g_object_ref (display);
+ window->render_lock = render_lock;
window->area_surface = wl_compositor_create_surface (display->compositor);
window->video_surface = wl_compositor_create_surface (display->compositor);
@@ -140,12 +151,13 @@ gst_wl_window_new_internal (GstWlDisplay * display)
}
GstWlWindow *
-gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info)
+gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
+ GMutex * render_lock)
{
GstWlWindow *window;
gint width;
- window = gst_wl_window_new_internal (display);
+ window = gst_wl_window_new_internal (display, render_lock);
/* go toplevel */
window->shell_surface = wl_shell_get_shell_surface (display->shell,
@@ -172,10 +184,10 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info)
GstWlWindow *
gst_wl_window_new_in_surface (GstWlDisplay * display,
- struct wl_surface * parent)
+ struct wl_surface * parent, GMutex * render_lock)
{
GstWlWindow *window;
- window = gst_wl_window_new_internal (display);
+ window = gst_wl_window_new_internal (display, render_lock);
/* embed in parent */
window->area_subsurface =
diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h
index 9b2d6483f..e247b4e23 100644
--- a/ext/wayland/wlwindow.h
+++ b/ext/wayland/wlwindow.h
@@ -41,6 +41,8 @@ struct _GstWlWindow
{
GObject parent_instance;
+ GMutex *render_lock;
+
GstWlDisplay *display;
struct wl_surface *area_surface;
struct wl_subsurface *area_subsurface;
@@ -62,6 +64,7 @@ struct _GstWlWindow
/* this will be set when viewporter is available and black background has
* already been set on the area_subsurface */
gboolean no_border_update;
+
};
struct _GstWlWindowClass
@@ -72,9 +75,9 @@ struct _GstWlWindowClass
GType gst_wl_window_get_type (void);
GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
- const GstVideoInfo * info);
+ const GstVideoInfo * info, GMutex * render_lock);
GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
- struct wl_surface * parent);
+ struct wl_surface * parent, GMutex * render_lock);
GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);