From: Matthew Waters Date: Thu, 12 Jun 2014 13:14:45 +0000 (+1000) Subject: glfilterapp: actually emit the client-draw signal X-Git-Tag: 1.16.2~955^2~1405 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7cc498fb6a044005ca736fc431628a2d721847c;p=platform%2Fupstream%2Fgst-plugins-base.git glfilterapp: actually emit the client-draw signal --- diff --git a/ext/gl/gstglfilterapp.c b/ext/gl/gstglfilterapp.c index 89b8841..d7dbd88 100644 --- a/ext/gl/gstglfilterapp.c +++ b/ext/gl/gstglfilterapp.c @@ -98,11 +98,14 @@ gst_gl_filter_app_class_init (GstGLFilterAppClass * klass) * * 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", @@ -149,10 +152,13 @@ gst_gl_filter_app_set_caps (GstGLFilter * filter, GstCaps * incaps, 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 @@ -161,22 +167,19 @@ gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex, { 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); } diff --git a/ext/gl/gstglfilterapp.h b/ext/gl/gstglfilterapp.h index 2d423c5..a8978c5 100644 --- a/ext/gl/gstglfilterapp.h +++ b/ext/gl/gstglfilterapp.h @@ -38,8 +38,7 @@ struct _GstGLFilterApp { GstGLFilter filter; - GLCB clientDrawCallback; - gpointer client_data; + gboolean default_draw; }; struct _GstGLFilterAppClass