mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
waylandsink: rename pause/resume_rendering to begin/end_geometry_change and update their documentation
This commit is contained in:
parent
06639dd727
commit
86930cab13
3 changed files with 40 additions and 31 deletions
|
@ -107,8 +107,8 @@ static void gst_wayland_sink_expose (GstVideoOverlay * overlay);
|
|||
/* 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,
|
||||
|
@ -830,12 +830,12 @@ gst_wayland_sink_expose (GstVideoOverlay * overlay)
|
|||
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);
|
||||
|
@ -843,7 +843,8 @@ gst_wayland_sink_pause_rendering (GstWaylandVideo * video)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -852,17 +853,16 @@ gst_wayland_sink_pause_rendering (GstWaylandVideo * video)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,15 +73,21 @@ gst_wayland_video_default_init (GstWaylandVideoInterface * klass)
|
|||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -90,22 +96,25 @@ gst_wayland_video_pause_rendering (GstWaylandVideo * video)
|
|||
|
||||
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:
|
||||
*
|
||||
* 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).
|
||||
* 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.
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
@ -114,7 +123,7 @@ gst_wayland_video_resume_rendering (GstWaylandVideo * video)
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,15 +65,15 @@ struct _GstWaylandVideoInterface {
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue