GstWlWindow * gst_wl_window_new_toplevel (GstWlDisplay * display, GstVideoInfo * video_info) { GstWlWindow *window; window = gst_wl_window_new_internal (display, wl_compositor_create_surface (display->compositor)); gst_wl_window_set_video_info (window, video_info); gst_wl_window_set_render_rectangle (window, 0, 0, window->video_width, window->video_height); window->shell_surface = wl_shell_get_shell_surface (display->shell, window->surface); if (window->shell_surface) { wl_shell_surface_add_listener (window->shell_surface, &shell_surface_listener, window); wl_shell_surface_set_toplevel (window->shell_surface); } else { GST_ERROR ("Unable to get wl_shell_surface"); g_object_unref (window); return NULL; } return window; }
GstWlWindow * gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info) { GstWlWindow *window; gint width; window = gst_wl_window_new_internal (display); /* go toplevel */ window->shell_surface = wl_shell_get_shell_surface (display->shell, window->area_surface); if (window->shell_surface) { wl_shell_surface_add_listener (window->shell_surface, &shell_surface_listener, window); wl_shell_surface_set_toplevel (window->shell_surface); } else { GST_ERROR ("Unable to get wl_shell_surface"); g_object_unref (window); return NULL; } /* set the initial size to be the same as the reported video size */ width = gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d); gst_wl_window_set_render_rectangle (window, 0, 0, width, info->height); return window; }
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); }
GstWlWindow * gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock) { GstWlWindow *window; gint width; window = gst_wl_window_new_internal (display, render_lock); if (display->shell) { /* go toplevel */ window->shell_surface = wl_shell_get_shell_surface (display->shell, window->area_surface); if (window->shell_surface) { wl_shell_surface_add_listener (window->shell_surface, &shell_surface_listener, window); gst_wl_window_ensure_fullscreen (window, fullscreen); } else { GST_ERROR ("Unable to get wl_shell_surface"); g_object_unref (window); return NULL; } } else if (display->fullscreen_shell) { zwp_fullscreen_shell_v1_present_surface (display->fullscreen_shell, window->area_surface, ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM, NULL); } else { GST_ERROR ("Unable to use wl_shell or zwp_fullscreen_shell."); g_object_unref (window); return NULL; } /* set the initial size to be the same as the reported video size */ width = gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d); gst_wl_window_set_render_rectangle (window, 0, 0, width, info->height); return window; }
static void gst_wayland_sink_set_render_rectangle (GstVideoOverlay * overlay, gint x, gint y, gint w, gint h) { GstWaylandSink *sink = GST_WAYLAND_SINK (overlay); g_return_if_fail (sink != NULL); g_mutex_lock (&sink->render_lock); if (!sink->window) { g_mutex_unlock (&sink->render_lock); GST_WARNING_OBJECT (sink, "set_render_rectangle called without window, ignoring"); return; } GST_DEBUG_OBJECT (sink, "window geometry changed to (%d, %d) %d x %d", x, y, w, h); gst_wl_window_set_render_rectangle (sink->window, x, y, w, h); g_mutex_unlock (&sink->render_lock); }