glcolorscale: support gl3

This commit is contained in:
Matthew Waters 2014-11-12 23:47:13 +11:00 committed by Tim-Philipp Müller
parent 8e98591153
commit 7ffe6fa93e
2 changed files with 4 additions and 20 deletions

View file

@ -70,17 +70,13 @@ static void gst_gl_colorscale_set_property (GObject * object, guint prop_id,
static void gst_gl_colorscale_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
#if GST_GL_HAVE_GLES2
static gboolean gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter);
static void gst_gl_colorscale_del_gl_resources (GstGLFilter * filter);
#endif
static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter,
guint in_tex, guint out_tex);
#if GST_GL_HAVE_OPENGL
static void gst_gl_colorscale_callback (gint width, gint height,
guint texture, gpointer stuff);
#endif
static void
gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
@ -101,11 +97,9 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
"Filter/Effect/Video", "Colorspace converter and video scaler",
"Julien Isorce <julien.isorce@gmail.com>");
#if GST_GL_HAVE_GLES2
filter_class->onInitFBO =
GST_DEBUG_FUNCPTR (gst_gl_colorscale_gen_gl_resources);
filter_class->onStop = GST_DEBUG_FUNCPTR (gst_gl_colorscale_del_gl_resources);
#endif
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
@ -115,9 +109,7 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
static void
gst_gl_colorscale_init (GstGLColorscale * colorscale)
{
#if GST_GL_HAVE_GLES2
colorscale->shader = NULL;
#endif
}
static void
@ -142,7 +134,6 @@ gst_gl_colorscale_get_property (GObject * object, guint prop_id,
}
}
#if GST_GL_HAVE_GLES2
static void
_compile_identity_shader (GstGLContext * context, GstGLColorscale * colorscale)
{
@ -163,7 +154,8 @@ gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter)
{
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2) {
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
GST_GL_API_OPENGL3)) {
gst_gl_context_thread_add (filter->context,
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
@ -189,7 +181,6 @@ gst_gl_colorscale_del_gl_resources (GstGLFilter * filter)
colorscale->shader = NULL;
}
}
#endif
static gboolean
gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
@ -199,22 +190,18 @@ gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
colorscale = GST_GL_COLORSCALE (filter);
#if GST_GL_HAVE_GLES2
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2)
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
GST_GL_API_OPENGL3))
gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
colorscale->shader);
#endif
#if GST_GL_HAVE_OPENGL
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL)
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
gst_gl_colorscale_callback, colorscale);
#endif
return TRUE;
}
#if GST_GL_HAVE_OPENGL
static void
gst_gl_colorscale_callback (gint width, gint height, guint texture,
gpointer stuff)
@ -230,4 +217,3 @@ gst_gl_colorscale_callback (gint width, gint height, guint texture,
gst_gl_filter_draw_texture (filter, texture, width, height);
}
#endif

View file

@ -43,9 +43,7 @@ struct _GstGLColorscale
{
GstGLFilter filter;
#if GST_GL_HAVE_GLES2
GstGLShader *shader;
#endif
};
struct _GstGLColorscaleClass