summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2021-06-16 15:55:49 +1000
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-06-21 08:02:31 +0000
commitaa8b27d45a5abdcbba4ec4af79aab6009a345ae0 (patch)
tree21744d860e081b6df4f453fe04e2dc6c5e9c33a8
parent973f0bf55212d5df14943fa230b2427a99e65444 (diff)
downloadgstreamer-plugins-base-aa8b27d45a5abdcbba4ec4af79aab6009a345ae0.tar.gz
gl/context: fill a GError on platform-specific fill_info() error
Fixes bindings assuming that GError is always set on error: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957493 https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957494 https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957498 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1204>
-rw-r--r--gst-libs/gst/gl/egl/gstglcontext_egl.c16
-rw-r--r--gst-libs/gst/gl/egl/gstglcontext_egl.h2
-rw-r--r--gst-libs/gst/gl/gstglcontext.c4
-rw-r--r--gst-libs/gst/gl/x11/gstglcontext_glx.c18
-rw-r--r--gst-libs/gst/gl/x11/gstglcontext_glx.h2
5 files changed, 34 insertions, 8 deletions
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
index b0a5d6b1a..bd83f88d8 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
@@ -1415,7 +1415,7 @@ gst_gl_context_egl_request_config (GstGLContext * context,
}
gboolean
-gst_gl_context_egl_fill_info (GstGLContext * context)
+gst_gl_context_egl_fill_info (GstGLContext * context, GError ** error)
{
EGLContext egl_context = (EGLContext) gst_gl_context_get_gl_context (context);
GstGLDisplay *display_egl;
@@ -1426,7 +1426,8 @@ gst_gl_context_egl_fill_info (GstGLContext * context)
int attrs[3];
if (!egl_context) {
- GST_ERROR_OBJECT (context, "no GLX context");
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "no EGL context");
return FALSE;
}
@@ -1439,6 +1440,10 @@ gst_gl_context_egl_fill_info (GstGLContext * context)
GST_WARNING_OBJECT (context,
"could not retrieve egl config id from egl context: %s",
gst_egl_get_error_string (eglGetError ()));
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not retrieve egl config id from egl context: %s",
+ gst_egl_get_error_string (eglGetError ()));
goto failure;
}
@@ -1451,6 +1456,10 @@ gst_gl_context_egl_fill_info (GstGLContext * context)
GST_WARNING_OBJECT (context,
"could not retrieve egl config from its ID 0x%x. "
"Wrong EGLDisplay or context?", config_id);
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not retrieve egl config from its ID 0x%x. "
+ "Wrong EGLDisplay or context?", config_id);
goto failure;
}
@@ -1458,6 +1467,9 @@ gst_gl_context_egl_fill_info (GstGLContext * context)
if (!config) {
GST_WARNING_OBJECT (context, "could not transform config id 0x%x into "
"GstStructure", config_id);
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not transform config id 0x%x into GstStructure", config_id);
goto failure;
}
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h
index 6d9a8a7ae..644731f36 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.h
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.h
@@ -92,7 +92,7 @@ G_GNUC_INTERNAL
gpointer gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name);
G_GNUC_INTERNAL
-gboolean gst_gl_context_egl_fill_info (GstGLContext * context);
+gboolean gst_gl_context_egl_fill_info (GstGLContext * context, GError ** error);
G_END_DECLS
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index 06215d840..4e7fe9187 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -1546,12 +1546,12 @@ gst_gl_context_fill_info (GstGLContext * context, GError ** error)
/* XXX: vfunc? */
#if GST_GL_HAVE_PLATFORM_GLX
if (gst_gl_context_get_gl_platform (context) == GST_GL_PLATFORM_GLX
- && !gst_gl_context_glx_fill_info (context))
+ && !gst_gl_context_glx_fill_info (context, error))
goto failure;
#endif
#if GST_GL_HAVE_PLATFORM_EGL
if (gst_gl_context_get_gl_platform (context) == GST_GL_PLATFORM_EGL
- && !gst_gl_context_egl_fill_info (context))
+ && !gst_gl_context_egl_fill_info (context, error))
goto failure;
#endif
}
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c
index 68d8e636f..7dd719a6c 100644
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.c
+++ b/gst-libs/gst/gl/x11/gstglcontext_glx.c
@@ -969,7 +969,7 @@ gst_gl_context_glx_request_config (GstGLContext * context,
}
gboolean
-gst_gl_context_glx_fill_info (GstGLContext * context)
+gst_gl_context_glx_fill_info (GstGLContext * context, GError ** error)
{
GLXContext glx_context = (GLXContext) gst_gl_context_get_gl_context (context);
GstStructure *config;
@@ -980,7 +980,8 @@ gst_gl_context_glx_fill_info (GstGLContext * context)
int attrs[3];
if (!glx_context) {
- GST_ERROR_OBJECT (context, "no GLX context");
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "No GLX context");
return FALSE;
}
@@ -988,6 +989,9 @@ gst_gl_context_glx_fill_info (GstGLContext * context)
if (!glXQueryVersion (device, &glx_major, &glx_minor)) {
GST_WARNING_OBJECT (context, "could not retrieve GLX version");
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
+ "could not retrieve GLX version");
return FALSE;
}
@@ -1001,6 +1005,9 @@ gst_gl_context_glx_fill_info (GstGLContext * context)
&fbconfig_id)) {
GST_WARNING_OBJECT (context,
"could not retrieve fbconfig id from glx context");
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not retrieve fbconfig id from glx context");
goto failure;
}
@@ -1014,6 +1021,10 @@ gst_gl_context_glx_fill_info (GstGLContext * context)
GST_WARNING_OBJECT (context,
"could not retrieve fbconfig from its ID 0x%x. "
"Wrong Display or Screen?", fbconfig_id);
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not retrieve fbconfig from its ID 0x%x. "
+ "Wrong Display or Screen?", fbconfig_id);
goto failure;
}
@@ -1021,6 +1032,9 @@ gst_gl_context_glx_fill_info (GstGLContext * context)
if (!config) {
GST_WARNING_OBJECT (context, "could not transform fbconfig id 0x%x into "
"GstStructure.", fbconfig_id);
+ g_set_error (error, GST_GL_CONTEXT_ERROR,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ "could not transform fbconfig id 0x%x into GstStructure.", fbconfig_id);
goto failure;
}
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.h b/gst-libs/gst/gl/x11/gstglcontext_glx.h
index e084cb545..20b3b28dc 100644
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.h
+++ b/gst-libs/gst/gl/x11/gstglcontext_glx.h
@@ -69,7 +69,7 @@ G_GNUC_INTERNAL
gpointer gst_gl_context_glx_get_proc_address (GstGLAPI gl_api, const gchar * name);
G_GNUC_INTERNAL
-gboolean gst_gl_context_glx_fill_info (GstGLContext * context);
+gboolean gst_gl_context_glx_fill_info (GstGLContext * context, GError ** error);
G_END_DECLS