From: Matthew Waters Date: Thu, 13 Jun 2013 06:55:37 +0000 (+1000) Subject: [707/906] display: move error_message to utils X-Git-Tag: 1.19.3~511^2~1989^2~1833 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdf5b5be0fafbd57b164da7b110803e113d9ed36;p=platform%2Fupstream%2Fgstreamer.git [707/906] display: move error_message to utils --- diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 2158e2c..1442853 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; @@ -126,21 +121,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) { GST_TRACE ("running function:%p data:%p", diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 1a1f184..dc513db 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 102795f..0d2070c 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 bebb941..512ba1e 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 4ec717a..4e8cc42 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 6a735ba..aba5001 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__ */