summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--TODO2
-rw-r--r--gst-libs/gst/gl/gstgldisplay.c51
-rw-r--r--gst/gl/gstgleffects.c11
4 files changed, 47 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 12d041a..2b60c62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-14 Julien Isorce <julien.isorce@gmail.com>
+
+ * TODO
+ * gst-libs/gst/gl/gstgldisplay.c
+ * gst/gl/gstgleffects.c
+ Finish TODO task 17
+
2008-09-13 Julien Isorce <julien.isorce@gmail.com>
* TODO
diff --git a/TODO b/TODO
index b583ea3..623049d 100644
--- a/TODO
+++ b/TODO
@@ -68,7 +68,7 @@
(And so have some more cool stuffs work on Intel card for example)
cg can convert GLSL code to ARB_fp/ARB_vp.
-- 17: add a generic way to check that a given extension is available. (and set isAlive to false..)
+(DONE) - 17: add a generic way to check that a given extension is available. (and set isAlive to false..)
(for examples gleffects does not check you have shaders available so it can cause segfault.)
(whereas using "gst_gl_display_gen_shader", the check is done)
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index c4e83b6..78cd1ea 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -1624,32 +1624,36 @@ gst_gl_display_thread_gen_shader (GstGLDisplay* display)
glutSetWindow (display->glutWinId);
if (GLEW_ARB_fragment_shader)
{
- gboolean isAlive = TRUE;
- GError *error = NULL;
-
- display->gen_shader = gst_gl_shader_new ();
+ if (display->gen_shader_vertex_source ||
+ display->gen_shader_fragment_source)
+ {
+ gboolean isAlive = TRUE;
+ GError *error = NULL;
+
+ display->gen_shader = gst_gl_shader_new ();
- if (display->gen_shader_vertex_source)
- gst_gl_shader_set_vertex_source(display->gen_shader, display->gen_shader_vertex_source);
+ if (display->gen_shader_vertex_source)
+ gst_gl_shader_set_vertex_source(display->gen_shader, display->gen_shader_vertex_source);
- if (display->gen_shader_fragment_source)
- gst_gl_shader_set_fragment_source(display->gen_shader, display->gen_shader_fragment_source);
+ if (display->gen_shader_fragment_source)
+ gst_gl_shader_set_fragment_source(display->gen_shader, display->gen_shader_fragment_source);
- gst_gl_shader_compile (display->gen_shader, &error);
- if (error)
- {
- GST_CAT_ERROR (GST_CAT_DEFAULT, "%s", error->message);
- g_error_free (error);
- error = NULL;
- gst_gl_shader_use (NULL);
- isAlive = FALSE;
- }
+ gst_gl_shader_compile (display->gen_shader, &error);
+ if (error)
+ {
+ GST_CAT_ERROR (GST_CAT_DEFAULT, "%s", error->message);
+ g_error_free (error);
+ error = NULL;
+ gst_gl_shader_use (NULL);
+ isAlive = FALSE;
+ }
- if (!isAlive)
- {
- display->isAlive = FALSE;
- g_object_unref (G_OBJECT (display->gen_shader));
- display->gen_shader = NULL;
+ if (!isAlive)
+ {
+ display->isAlive = FALSE;
+ g_object_unref (G_OBJECT (display->gen_shader));
+ display->gen_shader = NULL;
+ }
}
}
else
@@ -2297,7 +2301,8 @@ gst_gl_display_gen_shader (GstGLDisplay* display,
display->gen_shader_fragment_source = shader_fragment_source;
gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_GEN_SHADER, display);
g_cond_wait (display->cond_gen_shader, display->mutex);
- *shader = display->gen_shader;
+ if (shader)
+ *shader = display->gen_shader;
display->gen_shader = NULL;
display->gen_shader_vertex_source = NULL;
display->gen_shader_fragment_source = NULL;
diff --git a/gst/gl/gstgleffects.c b/gst/gl/gstgleffects.c
index 398c8ea..248d35d 100644
--- a/gst/gl/gstgleffects.c
+++ b/gst/gl/gstgleffects.c
@@ -44,6 +44,8 @@ static void gst_gl_effects_get_property (GObject * object, guint prop_id,
static void gst_gl_effects_init_resources (GstGLFilter* filter);
static void gst_gl_effects_reset_resources (GstGLFilter* filter);
+static void gst_gl_effects_on_init_gl_context (GstGLFilter* filter);
+
static void gst_gl_effects_ghash_func_clean (gpointer key, gpointer value, gpointer data);
static gboolean gst_gl_effects_filter (GstGLFilter * filter,
@@ -219,6 +221,7 @@ gst_gl_effects_class_init (GstGLEffectsClass * klass)
GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_effects_reset_gl_resources;
GST_GL_FILTER_CLASS (klass)->onStart = gst_gl_effects_init_resources;
GST_GL_FILTER_CLASS (klass)->onStop = gst_gl_effects_reset_resources;
+ GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_effects_on_init_gl_context;
g_object_class_install_property (
gobject_class,
@@ -371,6 +374,14 @@ gst_gl_effects_init_resources (GstGLFilter* filter)
}
}
+static void
+gst_gl_effects_on_init_gl_context (GstGLFilter* filter)
+{
+ //check that your hardware supports shader
+ //if not the pipeline correctly shut down
+ gst_gl_display_gen_shader (filter->display, 0, 0, NULL);
+}
+
static gboolean
gst_gl_effects_filter (GstGLFilter* filter, GstGLBuffer* inbuf,
GstGLBuffer* outbuf)