[707/906] display: move error_message to utils

This commit is contained in:
Matthew Waters 2013-06-13 16:55:37 +10:00 committed by Tim-Philipp Müller
parent 5bc069a5d5
commit bdf5b5be0f
6 changed files with 27 additions and 29 deletions

View file

@ -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)
{

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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

View file

@ -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__ */