mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
This commit is contained in:
parent
518e8a3fd2
commit
06b4b52a20
8 changed files with 21 additions and 67 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue