mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
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>
This commit is contained in:
parent
973f0bf552
commit
aa8b27d45a
5 changed files with 34 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue