Commit 7a378ba3 authored by Seungha Yang's avatar Seungha Yang Committed by Matthew Waters

glwindow: Introduce new vfunc for querying output surface availability

Only dummy window will return FALSE for now.
parent 0bfb8623
......@@ -85,6 +85,7 @@ static void gst_gl_window_default_send_message (GstGLWindow * window,
GstGLWindowCB callback, gpointer data);
static void gst_gl_window_default_send_message_async (GstGLWindow * window,
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
static gboolean gst_gl_window_default_has_output_surface (GstGLWindow * window);
struct _GstGLWindowPrivate
{
......@@ -192,6 +193,8 @@ gst_gl_window_class_init (GstGLWindowClass * klass)
klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message);
klass->send_message_async =
GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message_async);
klass->has_output_surface =
GST_DEBUG_FUNCPTR (gst_gl_window_default_has_output_surface);
G_OBJECT_CLASS (klass)->finalize = gst_gl_window_finalize;
......@@ -666,6 +669,36 @@ gst_gl_window_default_send_message_async (GstGLWindow * window,
message);
}
static gboolean
gst_gl_window_default_has_output_surface (GstGLWindow * window)
{
return TRUE;
}
/**
* gst_gl_window_has_output_surface:
* @window: a #GstGLWindow
*
* Query whether @window has output surface or not
*
* Returns: %TRUE if @window has useable output surface
*
* Since: 1.18
*/
gboolean
gst_gl_window_has_output_surface (GstGLWindow * window)
{
GstGLWindowClass *window_class;
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
window_class = GST_GL_WINDOW_GET_CLASS (window);
g_assert (window_class->has_output_surface);
return window_class->has_output_surface (window);
}
/**
* gst_gl_window_send_message_async:
* @window: a #GstGLWindow
......@@ -1020,6 +1053,12 @@ gst_gl_window_controls_viewport (GstGLWindow * window)
static GType gst_gl_dummy_window_get_type (void);
static gboolean
gst_gl_dummy_window_has_output_surface (GstGLWindow * window)
{
return FALSE;
}
G_DEFINE_TYPE (GstGLDummyWindow, gst_gl_dummy_window, GST_TYPE_GL_WINDOW);
static void
......@@ -1055,6 +1094,8 @@ gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_window_handle);
window_class->set_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_set_window_handle);
window_class->has_output_surface =
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_has_output_surface);
}
static void
......
......@@ -150,6 +150,7 @@ struct _GstGLWindow {
* @queue_resize: request a resize to occur when possible
* @controls_viewport: Whether the window takes care of glViewport setup.
* and the user does not need to deal with viewports
* @has_output_surface: Whether the window has output surface or not. (Since: 1.18)
*/
struct _GstGLWindowClass {
GstObjectClass parent_class;
......@@ -171,9 +172,10 @@ struct _GstGLWindowClass {
gboolean (*set_render_rectangle)(GstGLWindow *window, gint x, gint y, gint width, gint height);
void (*queue_resize) (GstGLWindow *window);
gboolean (*controls_viewport) (GstGLWindow *window);
gboolean (*has_output_surface) (GstGLWindow *window);
/*< private >*/
gpointer _reserved[GST_PADDING-1];
gpointer _reserved[GST_PADDING-2];
};
GST_GL_API
......@@ -265,6 +267,9 @@ GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
GST_GL_API
guintptr gst_gl_window_get_display (GstGLWindow *window);
GST_GL_API
gboolean gst_gl_window_has_output_surface (GstGLWindow *window);
G_END_DECLS
#endif /* __GST_GL_WINDOW_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment