void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, const GstVideoInfo * info) { if (G_UNLIKELY (info)) { window->video_width = gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d); window->video_height = info->height; 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)) gst_wl_buffer_attach (buffer, window->video_surface_wrapper); else wl_surface_attach (window->video_surface_wrapper, NULL, 0, 0); wl_surface_damage (window->video_surface_wrapper, 0, 0, window->video_rectangle.w, window->video_rectangle.h); wl_surface_commit (window->video_surface_wrapper); if (G_UNLIKELY (info)) { /* commit also the parent (area_surface) in order to change * the position of the video_subsurface */ wl_surface_damage (window->area_surface_wrapper, 0, 0, window->render_rectangle.w, window->render_rectangle.h); wl_surface_commit (window->area_surface_wrapper); wl_subsurface_set_desync (window->video_subsurface); } wl_display_flush (window->display->display); }
void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, gint w, gint h) { g_return_if_fail (window != NULL); window->render_rectangle.x = x; window->render_rectangle.y = y; window->render_rectangle.w = w; window->render_rectangle.h = h; /* position the area inside the parent - needs a parent commit to apply */ if (window->area_subsurface) wl_subsurface_set_position (window->area_subsurface, x, y); /* change the size of the area */ if (window->area_viewport) wp_viewport_set_destination (window->area_viewport, w, h); gst_wl_window_update_borders (window); if (window->video_width != 0) { wl_subsurface_set_sync (window->video_subsurface); gst_wl_window_resize_video_surface (window, TRUE); } wl_surface_damage (window->area_surface_wrapper, 0, 0, w, h); wl_surface_commit (window->area_surface_wrapper); if (window->video_width != 0) wl_subsurface_set_desync (window->video_subsurface); }
static void gst_wayland_sink_begin_geometry_change (GstWaylandVideo * video) { GstWaylandSink *sink = GST_WAYLAND_SINK (video); g_return_if_fail (sink != NULL); g_mutex_lock (&sink->render_lock); if (!sink->window || !sink->window->area_subsurface) { g_mutex_unlock (&sink->render_lock); GST_INFO_OBJECT (sink, "begin_geometry_change called without window, ignoring"); return; } wl_subsurface_set_sync (sink->window->area_subsurface); g_mutex_unlock (&sink->render_lock); }
static void _set_render_rectangle (gpointer data) { struct SetRenderRectangle *render = data; GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i", render->rect.x, render->rect.y, render->rect.w, render->rect.h); if (render->window_egl->window.subsurface) { wl_subsurface_set_sync (render->window_egl->window.subsurface); wl_subsurface_set_position (render->window_egl->window.subsurface, render->rect.x, render->rect.y); render->window_egl->window.window_x = render->rect.x; render->window_egl->window.window_y = render->rect.y; } window_resize (render->window_egl, render->rect.w, render->rect.h); }