*
* Will be emitted before to draw the texture. The client should
* redraw the surface/contents with the @texture, @width and @height.
+ *
+ * Returns: whether the texture was redrawn by the signal. If not, a
+ * default redraw will occur.
*/
gst_gl_filter_app_signals[CLIENT_DRAW_SIGNAL] =
g_signal_new ("client-draw", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
- G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
+ G_TYPE_BOOLEAN, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
gst_element_class_set_metadata (element_class,
"OpenGL application filter", "Filter/Effect",
static void
_emit_draw_signal (guint tex, gint width, gint height, gpointer data)
{
- GstGLFilter *filter = data;
+ GstGLFilterApp *app_filter = GST_GL_FILTER_APP (data);
+ gboolean drawn;
+
+ g_signal_emit (app_filter, gst_gl_filter_app_signals[CLIENT_DRAW_SIGNAL], 0,
+ tex, width, height, &drawn);
- g_signal_emit (filter, gst_gl_filter_app_signals[CLIENT_DRAW_SIGNAL], 0,
- tex, width, height);
+ app_filter->default_draw = !drawn;
}
static gboolean
{
GstGLFilterApp *app_filter = GST_GL_FILTER_APP (filter);
- if (app_filter->clientDrawCallback) {
- //blocking call, use a FBO
- gst_gl_context_use_fbo (filter->context,
- GST_VIDEO_INFO_WIDTH (&filter->out_info),
- GST_VIDEO_INFO_HEIGHT (&filter->out_info),
- filter->fbo, filter->depthbuffer, out_tex, (GLCB) _emit_draw_signal,
- GST_VIDEO_INFO_WIDTH (&filter->in_info),
- GST_VIDEO_INFO_HEIGHT (&filter->in_info),
- in_tex, 45,
- (gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
- (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info),
- 0.1, 100, GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, filter);
- }
- //default
- else {
- //blocking call, use a FBO
+ //blocking call, use a FBO
+ gst_gl_context_use_fbo (filter->context,
+ GST_VIDEO_INFO_WIDTH (&filter->out_info),
+ GST_VIDEO_INFO_HEIGHT (&filter->out_info),
+ filter->fbo, filter->depthbuffer, out_tex, (GLCB) _emit_draw_signal,
+ GST_VIDEO_INFO_WIDTH (&filter->in_info),
+ GST_VIDEO_INFO_HEIGHT (&filter->in_info),
+ in_tex, 45,
+ (gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
+ (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info),
+ 0.1, 100, GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, filter);
+
+ if (app_filter->default_draw) {
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
gst_gl_filter_app_callback, filter);
}