2 * GStreamer Wayland Library
3 * Copyright (C) 2014 Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
25 #include <gst/wayland/wayland.h>
26 #include <gst/video/videooverlay.h>
28 G_DEFINE_INTERFACE (GstWaylandVideo, gst_wayland_video, GST_TYPE_VIDEO_OVERLAY);
31 gst_wayland_video_default_init (GstWaylandVideoInterface * klass)
37 * gst_wayland_video_set_surface_size:
39 * This tells the video sink to change the size of its drawing
40 * surface. The caller must call gst_wayland_video_pause_rendering
41 * before calling this method and gst_wayland_video_resume_rendering
42 * later, on the next redraw request.
45 gst_wayland_video_set_surface_size (GstWaylandVideo * video, gint w, gint h)
47 GstWaylandVideoInterface *iface;
49 g_return_if_fail (video != NULL);
50 g_return_if_fail (GST_IS_WAYLAND_VIDEO (video));
52 iface = GST_WAYLAND_VIDEO_GET_INTERFACE (video);
54 if (iface->set_surface_size) {
55 iface->set_surface_size (video, w, h);
60 * gst_wayland_video_pause_rendering:
62 * This tells the video sink to stop rendering on the surface,
63 * dropping frames in the meanwhile. This should be called
64 * before resizing a stack of subsurfaces, one of which is
65 * the surface of the video sink.
68 gst_wayland_video_pause_rendering (GstWaylandVideo * video)
70 GstWaylandVideoInterface *iface;
72 g_return_if_fail (video != NULL);
73 g_return_if_fail (GST_IS_WAYLAND_VIDEO (video));
75 iface = GST_WAYLAND_VIDEO_GET_INTERFACE (video);
77 if (iface->pause_rendering) {
78 iface->pause_rendering (video);
83 * gst_wayland_video_resume_rendering:
85 * Resumes surface rendering that was previously paused
86 * with gst_wayland_video_pause_rendering. This function will
87 * block until there is a new wl_buffer commited on the surface
88 * inside the element, either with a new frame (if the element
89 * is PLAYING) or with an old frame (if the element is PAUSED).
92 gst_wayland_video_resume_rendering (GstWaylandVideo * video)
94 GstWaylandVideoInterface *iface;
96 g_return_if_fail (video != NULL);
97 g_return_if_fail (GST_IS_WAYLAND_VIDEO (video));
99 iface = GST_WAYLAND_VIDEO_GET_INTERFACE (video);
101 if (iface->resume_rendering) {
102 iface->resume_rendering (video);