From bdf5b5be0fafbd57b164da7b110803e113d9ed36 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 13 Jun 2013 16:55:37 +1000 Subject: [PATCH] [707/906] display: move error_message to utils --- gst-libs/gst/gl/gstgldisplay.c | 20 -------------------- gst-libs/gst/gl/gstgldisplay.h | 7 ------- gst-libs/gst/gl/gstglfilter.c | 2 +- gst-libs/gst/gl/gstglmixer.c | 2 +- gst-libs/gst/gl/gstglutils.c | 22 ++++++++++++++++++++++ gst-libs/gst/gl/gstglutils.h | 3 +++ 6 files changed, 27 insertions(+), 29 deletions(-) diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 2158e2c7c6..1442853e31 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -101,11 +101,6 @@ gst_gl_display_finalize (GObject * object) g_mutex_clear (&display->mutex); - if (display->error_message) { - g_free (display->error_message); - display->error_message = NULL; - } - if (display->gl_vtable) { g_slice_free (GstGLFuncs, display->gl_vtable); display->gl_vtable = NULL; @@ -125,21 +120,6 @@ gst_gl_display_finalize (GObject * object) /* Called in the gl thread */ -void -gst_gl_display_set_error (GstGLDisplay * display, const char *format, ...) -{ - va_list args; - - if (display->error_message) - g_free (display->error_message); - - va_start (args, format); - display->error_message = g_strdup_vprintf (format, args); - va_end (args); - - GST_WARNING ("%s", display->error_message); -} - void gst_gl_display_thread_run_generic (GstGLDisplay * display) { diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 1a1f184701..dc513db6bc 100644 --- a/gst-libs/gst/gl/gstgldisplay.h +++ b/gst-libs/gst/gl/gstgldisplay.h @@ -75,8 +75,6 @@ typedef enum */ typedef void (*GstGLDisplayThreadFunc) (GstGLDisplay * display, gpointer data); -#define GST_GL_DISPLAY_ERR_MSG(obj) ("%s", GST_GL_DISPLAY_CAST(obj)->error_message) - /** * GstGLDisplay: * @@ -95,8 +93,6 @@ struct _GstGLDisplay /* foreign gl context */ gulong external_gl_context; - gchar *error_message; - GstGLFuncs *gl_vtable; GstGLDisplayPrivate *priv; @@ -115,9 +111,6 @@ void gst_gl_display_thread_add (GstGLDisplay * display, gulong gst_gl_display_get_internal_gl_context (GstGLDisplay * display); -/* Must be called inside a lock/unlock on display, or within the glthread */ -void gst_gl_display_set_error (GstGLDisplay * display, const char * format, ...); - void gst_gl_display_lock (GstGLDisplay * display); void gst_gl_display_unlock (GstGLDisplay * display); GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display); diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 102795fa03..0d2070c5ba 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -764,7 +764,7 @@ wrong_caps: display_error: { GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND, - GST_GL_DISPLAY_ERR_MSG (filter->display), (NULL)); + ("%s", gst_gl_display_get_error ()), (NULL)); return FALSE; } diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c index bebb941154..512ba1ef78 100644 --- a/gst-libs/gst/gl/gstglmixer.c +++ b/gst-libs/gst/gl/gstglmixer.c @@ -1154,7 +1154,7 @@ done: display_error: { GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, - GST_GL_DISPLAY_ERR_MSG (mix->display), (NULL)); + ("%s", gst_gl_display_get_error ()), (NULL)); return FALSE; } } diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c index 4ec717a95e..4e8cc4203f 100644 --- a/gst-libs/gst/gl/gstglutils.c +++ b/gst-libs/gst/gl/gstglutils.c @@ -95,6 +95,8 @@ static void _del_fbo (GstGLDisplay * display); static void _gen_shader (GstGLDisplay * display); static void _del_shader (GstGLDisplay * display); +static gchar *error_message; + static void gst_gl_display_gen_texture_window_cb (GstGLDisplay * display) { @@ -452,6 +454,26 @@ gst_gl_display_gen_shader (GstGLDisplay * display, return alive; } +void +gst_gl_display_set_error (GstGLDisplay * display, const char *format, ...) +{ + va_list args; + + if (error_message) + g_free (error_message); + + va_start (args, format); + error_message = g_strdup_vprintf (format, args); + va_end (args); + + GST_WARNING ("%s", error_message); +} + +gchar * +gst_gl_display_get_error (void) +{ + return error_message; +} /* Called by glfilter */ void diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h index 6a735bafa0..aba5001426 100644 --- a/gst-libs/gst/gl/gstglutils.h +++ b/gst-libs/gst/gl/gstglutils.h @@ -102,4 +102,7 @@ void gst_gl_display_del_shader (GstGLDisplay * display, GstGLShader * shader); gboolean gst_gl_display_check_framebuffer_status (GstGLDisplay * display); void gst_gl_display_activate_gl_context (GstGLDisplay * display, gboolean activate); +void gst_gl_display_set_error (GstGLDisplay * display, const char * format, ...); +gchar *gst_gl_display_get_error (void); + #endif /* __GST_GL_UTILS_H__ */