mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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
This commit is contained in:
parent
fdea1e1144
commit
f6b270d8eb
3 changed files with 26 additions and 10 deletions
|
@ -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, "
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue