mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 10:04:23 +00:00
[707/906] display: move error_message to utils
This commit is contained in:
parent
393b483743
commit
c799696b48
22 changed files with 58 additions and 64 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_bulge_callback (gint width, gint height, guint texture,
|
|||
bulge_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize bulge shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_fisheye_callback (gint width, gint height, guint texture,
|
|||
fisheye_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize fisheye shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ gst_gl_effects_glow_step_one (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize luma threshold shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ gst_gl_effects_glow_step_two (gint width, gint height, guint texture,
|
|||
hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize hconv7 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ gst_gl_effects_glow_step_three (gint width, gint height, guint texture,
|
|||
vconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize vcon7 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ gst_gl_effects_glow_step_four (gint width, gint height, guint texture,
|
|||
sum_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize sum shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ gst_gl_effects_luma_to_curve (GstGLEffects * effects,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize luma to curve shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ gst_gl_effects_mirror_callback (gint width, gint height, guint texture,
|
|||
error = NULL;
|
||||
gst_gl_shader_use (NULL);
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
} else {
|
||||
effects->draw_attr_position_loc =
|
||||
gst_gl_shader_get_attribute_location (shader, "a_position");
|
||||
|
@ -75,7 +75,7 @@ gst_gl_effects_mirror_callback (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize mirror shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ gst_gl_effects_rgb_to_curve (GstGLEffects * effects,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize rgb to curve shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_sin_callback (gint width, gint height, guint texture,
|
|||
sin_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize sin shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_square_callback (gint width, gint height, guint texture,
|
|||
square_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize square shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ gst_gl_effects_squeeze_callback (gint width, gint height, guint texture,
|
|||
error = NULL;
|
||||
gst_gl_shader_use (NULL);
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
} else {
|
||||
effects->draw_attr_position_loc =
|
||||
gst_gl_shader_get_attribute_location (shader, "a_position");
|
||||
|
@ -75,7 +75,7 @@ gst_gl_effects_squeeze_callback (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize squeeze shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_stretch_callback (gint width, gint height, guint texture,
|
|||
stretch_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize stretch shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_tunnel_callback (gint width, gint height, guint texture,
|
|||
tunnel_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize tunnel shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_gl_effects_twirl_callback (gint width, gint height, guint texture,
|
|||
twirl_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize twirl shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ gst_gl_effects_xray_step_two (gint width, gint height, guint texture,
|
|||
hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize hconv7 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ gst_gl_effects_xray_step_three (gint width, gint height, guint texture,
|
|||
vconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize vconv7 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ gst_gl_effects_xray_desaturate (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize desaturate shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ gst_gl_effects_xray_sobel_hconv (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize sobel hvonc3 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ gst_gl_effects_xray_sobel_vconv (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize sobel vconv3 shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ gst_gl_effects_xray_sobel_length (gint width, gint height, guint texture,
|
|||
gst_gl_display_set_error (display,
|
||||
"Failed to initialize seobel length shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ gst_gl_effects_xray_step_five (gint width, gint height, guint texture,
|
|||
multiply_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||
gst_gl_display_set_error (display, "Failed to initialize multiply shader");
|
||||
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
|||
gst_gl_display_set_error (GST_GL_FILTER (differencematte)->display,
|
||||
"Failed to initialize difference shader");
|
||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (differencematte)->display),
|
||||
(NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -116,8 +115,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
|||
gst_gl_display_set_error (GST_GL_FILTER (differencematte)->display,
|
||||
"Failed to initialize hconv7 shader");
|
||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (differencematte)->display),
|
||||
(NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,8 +124,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
|||
gst_gl_display_set_error (GST_GL_FILTER (differencematte)->display,
|
||||
"Failed to initialize vconv7 shader");
|
||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (differencematte)->display),
|
||||
(NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,8 +133,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
|||
gst_gl_display_set_error (GST_GL_FILTER (differencematte)->display,
|
||||
"Failed to initialize interp shader");
|
||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (differencematte)->display),
|
||||
(NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -677,7 +677,7 @@ gst_glimage_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
|
||||
if (g_atomic_int_get (&glimage_sink->to_quit) != 0) {
|
||||
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (glimage_sink->display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -688,7 +688,7 @@ redisplay_failed:
|
|||
{
|
||||
gst_video_frame_unmap (&frame);
|
||||
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (glimage_sink->display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ wrong_caps:
|
|||
display_error:
|
||||
{
|
||||
GST_ELEMENT_ERROR (gltestsrc, RESOURCE, NOT_FOUND,
|
||||
GST_GL_DISPLAY_ERR_MSG (gltestsrc->display), (NULL));
|
||||
("%s", gst_gl_display_get_error ()), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue