mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
glcolorscale: support gl3
This commit is contained in:
parent
8e98591153
commit
7ffe6fa93e
2 changed files with 4 additions and 20 deletions
|
@ -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,
|
static void gst_gl_colorscale_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec);
|
GValue * value, GParamSpec * pspec);
|
||||||
|
|
||||||
#if GST_GL_HAVE_GLES2
|
|
||||||
static gboolean gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter);
|
static gboolean gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter);
|
||||||
static void gst_gl_colorscale_del_gl_resources (GstGLFilter * filter);
|
static void gst_gl_colorscale_del_gl_resources (GstGLFilter * filter);
|
||||||
#endif
|
|
||||||
|
|
||||||
static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter,
|
static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter,
|
||||||
guint in_tex, guint out_tex);
|
guint in_tex, guint out_tex);
|
||||||
#if GST_GL_HAVE_OPENGL
|
|
||||||
static void gst_gl_colorscale_callback (gint width, gint height,
|
static void gst_gl_colorscale_callback (gint width, gint height,
|
||||||
guint texture, gpointer stuff);
|
guint texture, gpointer stuff);
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
|
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",
|
"Filter/Effect/Video", "Colorspace converter and video scaler",
|
||||||
"Julien Isorce <julien.isorce@gmail.com>");
|
"Julien Isorce <julien.isorce@gmail.com>");
|
||||||
|
|
||||||
#if GST_GL_HAVE_GLES2
|
|
||||||
filter_class->onInitFBO =
|
filter_class->onInitFBO =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_colorscale_gen_gl_resources);
|
GST_DEBUG_FUNCPTR (gst_gl_colorscale_gen_gl_resources);
|
||||||
filter_class->onStop = GST_DEBUG_FUNCPTR (gst_gl_colorscale_del_gl_resources);
|
filter_class->onStop = GST_DEBUG_FUNCPTR (gst_gl_colorscale_del_gl_resources);
|
||||||
#endif
|
|
||||||
|
|
||||||
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
|
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
|
||||||
|
|
||||||
|
@ -115,9 +109,7 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_gl_colorscale_init (GstGLColorscale * colorscale)
|
gst_gl_colorscale_init (GstGLColorscale * colorscale)
|
||||||
{
|
{
|
||||||
#if GST_GL_HAVE_GLES2
|
|
||||||
colorscale->shader = NULL;
|
colorscale->shader = NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -142,7 +134,6 @@ gst_gl_colorscale_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_GL_HAVE_GLES2
|
|
||||||
static void
|
static void
|
||||||
_compile_identity_shader (GstGLContext * context, GstGLColorscale * colorscale)
|
_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);
|
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,
|
gst_gl_context_thread_add (filter->context,
|
||||||
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
|
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
|
||||||
|
|
||||||
|
@ -189,7 +181,6 @@ gst_gl_colorscale_del_gl_resources (GstGLFilter * filter)
|
||||||
colorscale->shader = NULL;
|
colorscale->shader = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
|
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);
|
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,
|
gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
|
||||||
colorscale->shader);
|
colorscale->shader);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_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_filter_render_to_target (filter, TRUE, in_tex, out_tex,
|
||||||
gst_gl_colorscale_callback, colorscale);
|
gst_gl_colorscale_callback, colorscale);
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
|
||||||
static void
|
static void
|
||||||
gst_gl_colorscale_callback (gint width, gint height, guint texture,
|
gst_gl_colorscale_callback (gint width, gint height, guint texture,
|
||||||
gpointer stuff)
|
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);
|
gst_gl_filter_draw_texture (filter, texture, width, height);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -43,9 +43,7 @@ struct _GstGLColorscale
|
||||||
{
|
{
|
||||||
GstGLFilter filter;
|
GstGLFilter filter;
|
||||||
|
|
||||||
#if GST_GL_HAVE_GLES2
|
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstGLColorscaleClass
|
struct _GstGLColorscaleClass
|
||||||
|
|
Loading…
Reference in a new issue