glfilterapp: actually emit the client-draw signal

This commit is contained in:
Matthew Waters 2014-06-12 23:14:45 +10:00 committed by Tim-Philipp Müller
parent 2ddcde1acb
commit e7cc498fb6
2 changed files with 24 additions and 22 deletions

View file

@ -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 (filter, gst_gl_filter_app_signals[CLIENT_DRAW_SIGNAL], 0,
tex, width, height);
g_signal_emit (app_filter, gst_gl_filter_app_signals[CLIENT_DRAW_SIGNAL], 0,
tex, width, height, &drawn);
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);
}

View file

@ -38,8 +38,7 @@ struct _GstGLFilterApp
{
GstGLFilter filter;
GLCB clientDrawCallback;
gpointer client_data;
gboolean default_draw;
};
struct _GstGLFilterAppClass