summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-07-12 15:29:29 +1000
committerMatthew Waters <matthew@centricular.com>2016-07-26 14:07:24 +1000
commit06b4b52a2092b54cc6c10ca0c23e57f17782d994 (patch)
treeadfd83bf2addfb4ff802d316008c2ae64d7de9b5
parent518e8a3fd2e1e29f6435df46eb1c9e2d63aa46ef (diff)
downloadgstreamer-plugins-bad-06b4b52a2092b54cc6c10ca0c23e57f17782d994.tar.gz
glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
-rw-r--r--ext/gl/gstglimagesink.c6
-rw-r--r--gst-libs/gst/gl/gstglcolorconvert.c17
-rw-r--r--gst-libs/gst/gl/gstglmemorypbo.c12
-rw-r--r--gst-libs/gst/gl/gstglutils.c22
-rw-r--r--gst-libs/gst/gl/gstglutils.h3
-rw-r--r--gst-libs/gst/gl/gstglviewconvert.c10
-rw-r--r--tests/check/libs/gstglmemory.c12
-rw-r--r--tests/check/libs/gstglupload.c6
8 files changed, 21 insertions, 67 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index f176c235c..47314329f 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -1777,7 +1777,7 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (g_atomic_int_get (&glimage_sink->to_quit) != 0) {
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
- ("%s", gst_gl_context_get_error ()), (NULL));
+ ("%s", "Quit requested"), (NULL));
return GST_FLOW_ERROR;
}
@@ -1787,7 +1787,7 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
redisplay_failed:
{
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
- ("%s", gst_gl_context_get_error ()), (NULL));
+ ("%s", "Window redisplay failed"), (NULL));
return GST_FLOW_ERROR;
}
}
@@ -2306,7 +2306,7 @@ gst_glimage_sink_on_close (GstGLImageSink * gl_sink)
{
GstGLWindow *window;
- gst_gl_context_set_error (gl_sink->context, "Output window was closed");
+ GST_WARNING_OBJECT (gl_sink, "Output window was closed");
window = gst_gl_context_get_window (gl_sink->context);
diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
index 34a581897..5c8eba7b7 100644
--- a/gst-libs/gst/gl/gstglcolorconvert.c
+++ b/gst-libs/gst/gl/gstglcolorconvert.c
@@ -1922,8 +1922,8 @@ _init_convert (GstGLColorConvert * convert)
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->out_info)));
if (!gl->CreateProgramObject && !gl->CreateProgram) {
- gst_gl_context_set_error (convert->context,
- "Cannot perform color conversion without OpenGL shaders");
+ GST_ERROR_OBJECT (convert, "Cannot perform color conversion without "
+ "OpenGL shaders");
goto error;
}
@@ -2061,8 +2061,7 @@ _init_convert (GstGLColorConvert * convert)
return TRUE;
unhandled_format:
- gst_gl_context_set_error (convert->context,
- "Don't know how to convert from %s to %s",
+ GST_ERROR_OBJECT (convert, "Don't know how to convert from %s to %s",
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->in_info)),
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->out_info)));
@@ -2071,8 +2070,7 @@ error:
incompatible_api:
{
- gst_gl_context_set_error (convert->context,
- "Converting from %s to %s requires "
+ GST_ERROR_OBJECT (convert, "Converting from %s to %s requires "
"functionality that the current OpenGL setup does not support",
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->in_info)),
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT
@@ -2081,7 +2079,6 @@ incompatible_api:
}
}
-
/* called by _init_convert (in the gl thread) */
static gboolean
_init_convert_fbo (GstGLColorConvert * convert)
@@ -2218,15 +2215,13 @@ out:
if (!gst_memory_map ((GstMemory *) convert->priv->out_tex[j], &from_info,
GST_MAP_READ | GST_MAP_GL)) {
- gst_gl_context_set_error (convert->context, "Failed to map "
- "intermediate memory");
+ GST_ERROR_OBJECT (convert, "Failed to map intermediate memory");
res = FALSE;
continue;
}
if (!gst_memory_map ((GstMemory *) out_tex, &to_info,
GST_MAP_WRITE | GST_MAP_GL)) {
- gst_gl_context_set_error (convert->context, "Failed to map "
- "intermediate memory");
+ GST_ERROR_OBJECT (convert, "Failed to map intermediate memory");
res = FALSE;
continue;
}
diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c
index e749488ca..ebf8f2971 100644
--- a/gst-libs/gst/gl/gstglmemorypbo.c
+++ b/gst-libs/gst/gl/gstglmemorypbo.c
@@ -429,7 +429,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
in_gl_type = GL_UNSIGNED_SHORT_5_6_5;
if (!gl->GenFramebuffers) {
- gst_gl_context_set_error (context,
+ GST_CAT_ERROR (GST_CAT_GL_MEMORY,
"Context, EXT_framebuffer_object not supported");
goto error;
}
@@ -439,9 +439,9 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
if (copy_params->respecify) {
if (in_size != out_size) {
- GST_ERROR ("Cannot copy between textures with backing data of different"
- "sizes. input %" G_GSIZE_FORMAT " output %" G_GSIZE_FORMAT, in_size,
- out_size);
+ GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy between textures with "
+ "backing data of different sizes. input %" G_GSIZE_FORMAT " output %"
+ G_GSIZE_FORMAT, in_size, out_size);
goto error;
}
}
@@ -487,7 +487,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
GstMapInfo pbo_info;
if (!gl->GenBuffers || !src->pbo) {
- gst_gl_context_set_error (context, "Cannot reinterpret texture contents "
+ GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot reinterpret texture contents "
"without pixel buffer objects");
gl->BindTexture (out_tex_target, 0);
goto fbo_error;
@@ -495,7 +495,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2
&& (in_gl_format != GL_RGBA || in_gl_type != GL_UNSIGNED_BYTE)) {
- gst_gl_context_set_error (context, "Cannot copy non RGBA/UNSIGNED_BYTE "
+ GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy non RGBA/UNSIGNED_BYTE "
"textures on GLES2");
gl->BindTexture (out_tex_target, 0);
goto fbo_error;
diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c
index e4cbd91e9..4a23914b5 100644
--- a/gst-libs/gst/gl/gstglutils.c
+++ b/gst-libs/gst/gl/gstglutils.c
@@ -42,8 +42,6 @@
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-static gchar *error_message;
-
struct _compile_shader
{
GstGLShader **shader;
@@ -125,26 +123,6 @@ gst_gl_context_gen_shader (GstGLContext * context, const gchar * vert_src,
return *shader != NULL;
}
-void
-gst_gl_context_set_error (GstGLContext * context, const char *format, ...)
-{
- va_list args;
-
- 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_context_get_error (void)
-{
- return error_message;
-}
-
/* Called by glfilter */
void
gst_gl_context_del_shader (GstGLContext * context, GstGLShader * shader)
diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h
index 8914310fa..1e87c0dec 100644
--- a/gst-libs/gst/gl/gstglutils.h
+++ b/gst-libs/gst/gl/gstglutils.h
@@ -66,9 +66,6 @@ gboolean gst_gl_context_gen_shader (GstGLContext * context,
const gchar * shader_fragment_source, GstGLShader ** shader);
void gst_gl_context_del_shader (GstGLContext * context, GstGLShader * shader);
-void gst_gl_context_set_error (GstGLContext * context, const char * format, ...);
-gchar *gst_gl_context_get_error (void);
-
gboolean gst_gl_ensure_element_data (gpointer element,
GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c
index c50ca5213..54c0ca61c 100644
--- a/gst-libs/gst/gl/gstglviewconvert.c
+++ b/gst-libs/gst/gl/gstglviewconvert.c
@@ -1590,8 +1590,8 @@ _init_view_convert (GstGLViewConvert * viewconvert)
viewconvert->out_info.width, viewconvert->out_info.height);
if (!gl->CreateProgramObject && !gl->CreateProgram) {
- gst_gl_context_set_error (viewconvert->context,
- "Cannot perform multiview conversion without OpenGL shaders");
+ GST_ERROR_OBJECT (viewconvert, "Cannot perform multiview conversion "
+ "without OpenGL shaders");
goto error;
}
@@ -2093,15 +2093,13 @@ out:
GstMapInfo to_info, from_info;
if (!gst_memory_map ((GstMemory *) priv->out_tex[j],
&from_info, GST_MAP_READ | GST_MAP_GL)) {
- gst_gl_context_set_error (viewconvert->context,
- "Failed to map " "intermediate memory");
+ GST_ERROR_OBJECT (viewconvert, "Failed to map intermediate memory");
res = FALSE;
continue;
}
if (!gst_memory_map ((GstMemory *) out_tex, &to_info,
GST_MAP_WRITE | GST_MAP_GL)) {
- gst_gl_context_set_error (viewconvert->context, "Failed to map "
- "intermediate memory");
+ GST_ERROR_OBJECT (viewconvert, "Failed to map intermediate memory");
res = FALSE;
continue;
}
diff --git a/tests/check/libs/gstglmemory.c b/tests/check/libs/gstglmemory.c
index f8f9840cf..0cdd1ddc8 100644
--- a/tests/check/libs/gstglmemory.c
+++ b/tests/check/libs/gstglmemory.c
@@ -102,10 +102,6 @@ GST_START_TEST (test_basic)
&gl_mem->info) == FALSE);
fail_if (gl_mem->mem.context != gl_mem2->mem.context);
- if (gst_gl_context_get_error ())
- printf ("%s\n", gst_gl_context_get_error ());
- fail_if (gst_gl_context_get_error () != NULL);
-
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
gst_memory_unref (mem);
gst_memory_unref (mem2);
@@ -272,10 +268,6 @@ test_transfer_allocator (const gchar * allocator_name)
fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
- if (gst_gl_context_get_error ())
- printf ("%s\n", gst_gl_context_get_error ());
- fail_if (gst_gl_context_get_error () != NULL);
-
gst_memory_unref (mem);
gst_memory_unref (mem2);
gst_memory_unref (mem3);
@@ -334,10 +326,6 @@ GST_START_TEST (test_separate_transfer)
/* FIXME: add download transfer */
- if (gst_gl_context_get_error ())
- printf ("%s\n", gst_gl_context_get_error ());
- fail_if (gst_gl_context_get_error () != NULL);
-
gst_memory_unref (mem);
gst_object_unref (gl_allocator);
}
diff --git a/tests/check/libs/gstglupload.c b/tests/check/libs/gstglupload.c
index 4f9e4b2b7..7257597ca 100644
--- a/tests/check/libs/gstglupload.c
+++ b/tests/check/libs/gstglupload.c
@@ -165,8 +165,7 @@ GST_START_TEST (test_upload_data)
0, WIDTH * HEIGHT * 4, NULL, NULL);
res = gst_gl_upload_perform_with_buffer (upload, inbuf, &outbuf);
- fail_if (res == FALSE, "Failed to upload buffer: %s\n",
- gst_gl_context_get_error ());
+ fail_if (res == FALSE, "Failed to upload buffer");
fail_unless (GST_IS_BUFFER (outbuf));
res = gst_buffer_map (outbuf, &map_info, GST_MAP_READ | GST_MAP_GL);
@@ -238,8 +237,7 @@ GST_START_TEST (test_upload_buffer)
gst_gl_upload_set_caps (upload, in_caps, out_caps);
res = gst_gl_upload_perform_with_buffer (upload, buffer, &outbuf);
- fail_if (res == FALSE, "Failed to upload buffer: %s\n",
- gst_gl_context_get_error ());
+ fail_if (res == FALSE, "Failed to upload buffer");
fail_unless (GST_IS_BUFFER (outbuf));
gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);