/* WaylandVideo interface */
static void gst_wayland_sink_waylandvideo_init (GstWaylandVideoInterface *
iface);
-static void gst_wayland_sink_pause_rendering (GstWaylandVideo * video);
-static void gst_wayland_sink_resume_rendering (GstWaylandVideo * video);
+static void gst_wayland_sink_begin_geometry_change (GstWaylandVideo * video);
+static void gst_wayland_sink_end_geometry_change (GstWaylandVideo * video);
#define gst_wayland_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstWaylandSink, gst_wayland_sink, GST_TYPE_VIDEO_SINK,
static void
gst_wayland_sink_waylandvideo_init (GstWaylandVideoInterface * iface)
{
- iface->pause_rendering = gst_wayland_sink_pause_rendering;
- iface->resume_rendering = gst_wayland_sink_resume_rendering;
+ iface->begin_geometry_change = gst_wayland_sink_begin_geometry_change;
+ iface->end_geometry_change = gst_wayland_sink_end_geometry_change;
}
static void
-gst_wayland_sink_pause_rendering (GstWaylandVideo * video)
+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->subsurface) {
g_mutex_unlock (&sink->render_lock);
- GST_INFO_OBJECT (sink, "pause_rendering called without window, ignoring");
+ GST_INFO_OBJECT (sink,
+ "begin_geometry_change called without window, ignoring");
return;
}
}
static void
-gst_wayland_sink_resume_rendering (GstWaylandVideo * video)
+gst_wayland_sink_end_geometry_change (GstWaylandVideo * video)
{
GstWaylandSink *sink = GST_WAYLAND_SINK (video);
g_return_if_fail (sink != NULL);
- GST_DEBUG_OBJECT (sink, "resuming rendering");
-
g_mutex_lock (&sink->render_lock);
if (!sink->window || !sink->window->subsurface) {
g_mutex_unlock (&sink->render_lock);
- GST_INFO_OBJECT (sink, "resume_rendering called without window, ignoring");
+ GST_INFO_OBJECT (sink,
+ "end_geometry_change called without window, ignoring");
return;
}
}
/**
- * gst_wayland_video_pause_rendering:
+ * gst_wayland_video_begin_geometry_change:
*
- * This tells the video sink to stop rendering on the surface,
- * dropping frames in the meanwhile. This should be called
- * before resizing a stack of subsurfaces, one of which is
- * the surface of the video sink.
+ * Notifies the video sink that we are about to change its
+ * geometry (probably using set_render_rectangle()). This is useful
+ * in order to allow the sink to synchronize resizing/moving of the
+ * video area with the parent surface and avoid glitches, in cases
+ * where the video area is being painted asynchronously from another
+ * thread, like in waylandsink.
+ *
+ * Please note that any calls to this method MUST be matched by
+ * calls to end_geometry_change() and AFTER the parent surface has
+ * commited its geometry changes.
*/
void
-gst_wayland_video_pause_rendering (GstWaylandVideo * video)
+gst_wayland_video_begin_geometry_change (GstWaylandVideo * video)
{
GstWaylandVideoInterface *iface;
iface = GST_WAYLAND_VIDEO_GET_INTERFACE (video);
- if (iface->pause_rendering) {
- iface->pause_rendering (video);
+ if (iface->begin_geometry_change) {
+ iface->begin_geometry_change (video);
}
}
/**
- * gst_wayland_video_resume_rendering:
+ * gst_wayland_video_end_geometry_change:
+ *
+ * Notifies the video sink that we just finished changing the
+ * geometry of both itself and its parent surface. This should
+ * have been earlier preceeded by a call to begin_geometry_change()
+ * which notified the sink before any of these changes had happened.
*
- * Resumes surface rendering that was previously paused
- * with gst_wayland_video_pause_rendering. This function will
- * block until there is a new wl_buffer commited on the surface
- * inside the element, either with a new frame (if the element
- * is PLAYING) or with an old frame (if the element is PAUSED).
+ * It is important to call this method only AFTER the parent surface
+ * has commited its geometry changes, otherwise no synchronization
+ * is actually achieved.
*/
void
-gst_wayland_video_resume_rendering (GstWaylandVideo * video)
+gst_wayland_video_end_geometry_change (GstWaylandVideo * video)
{
GstWaylandVideoInterface *iface;
iface = GST_WAYLAND_VIDEO_GET_INTERFACE (video);
- if (iface->resume_rendering) {
- iface->resume_rendering (video);
+ if (iface->end_geometry_change) {
+ iface->end_geometry_change (video);
}
}
GTypeInterface iface;
/* virtual functions */
- void (*pause_rendering) (GstWaylandVideo *video);
- void (*resume_rendering) (GstWaylandVideo *video);
+ void (*begin_geometry_change) (GstWaylandVideo *video);
+ void (*end_geometry_change) (GstWaylandVideo *video);
};
GType gst_wayland_video_get_type (void);
/* virtual function wrappers */
-void gst_wayland_video_pause_rendering (GstWaylandVideo * video);
-void gst_wayland_video_resume_rendering (GstWaylandVideo * video);
+void gst_wayland_video_begin_geometry_change (GstWaylandVideo * video);
+void gst_wayland_video_end_geometry_change (GstWaylandVideo * video);
G_END_DECLS