Use GError's instead if necessary.
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;
}
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;
}
}
{
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);
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;
}
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)));
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
}
}
-
/* called by _init_convert (in the gl thread) */
static gboolean
_init_convert_fbo (GstGLColorConvert * convert)
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;
}
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;
}
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;
}
}
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;
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;
#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;
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)
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,
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;
}
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;
}
&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);
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);
/* 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);
}
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);
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);