From 34663eccd93d1910243e53abbe41ed34cfdfa771 Mon Sep 17 00:00:00 2001 From: Filippo Argiolas Date: Sat, 20 Sep 2008 14:12:49 +0200 Subject: [PATCH] [228/906] output shaders info log only if GST_GL_SHADER_DEBUG env variable is set. Should fix TODO task 18 --- gst-libs/gst/gl/gstglshader.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c index fee9dc7d4a..57cd1e616a 100644 --- a/gst-libs/gst/gl/gstglshader.c +++ b/gst-libs/gst/gl/gstglshader.c @@ -51,6 +51,11 @@ struct _GstGLShaderPrivate G_DEFINE_TYPE (GstGLShader, gst_gl_shader, G_TYPE_OBJECT); +#undef G_LOG_DOMAIN +#define G_LOG_DOMAIN "GstGLShader" + +gboolean _gst_gl_shader_debug = FALSE; + static void gst_gl_shader_finalize (GObject * object) { @@ -126,6 +131,15 @@ gst_gl_shader_get_property (GObject * object, } +static void +gst_gl_shader_log_handler (const gchar *domain, GLogLevelFlags flags, + const gchar *message, gpointer user_data) +{ + if (_gst_gl_shader_debug) { + g_log_default_handler (domain, flags, message, user_data); + } +} + static void gst_gl_shader_class_init (GstGLShaderClass * klass) { @@ -230,6 +244,12 @@ gst_gl_shader_init (GstGLShader * self) priv->compiled = FALSE; priv->active = FALSE; // unused at the moment + + if (g_getenv ("GST_GL_SHADER_DEBUG")) + _gst_gl_shader_debug = TRUE; + + g_log_set_handler ("GstGLShader", G_LOG_LEVEL_DEBUG, + gst_gl_shader_log_handler, NULL); } GstGLShader *