[807/906] context: Move some window error enums to context

This commit is contained in:
Matthew Waters 2013-09-03 21:49:18 +10:00 committed by Tim-Philipp Müller
parent 57c32baab7
commit d9cc31aca0
4 changed files with 25 additions and 21 deletions

View file

@ -143,8 +143,8 @@ gst_gl_context_egl_choose_format (GstGLContext * context, GError ** error)
gst_object_unref (window); gst_object_unref (window);
if (ret == 0) { if (ret == 0) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
"Failed to match XVisualInfo"); GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Failed to match XVisualInfo");
return FALSE; return FALSE;
} }
} }
@ -209,7 +209,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
if (other_context) { if (other_context) {
if (!GST_GL_IS_CONTEXT_EGL (other_context)) { if (!GST_GL_IS_CONTEXT_EGL (other_context)) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Cannot share context with non-EGL context"); "Cannot share context with non-EGL context");
goto failure; goto failure;
} }

View file

@ -54,10 +54,7 @@ G_BEGIN_DECLS
typedef enum typedef enum
{ {
GST_GL_WINDOW_ERROR_FAILED, GST_GL_WINDOW_ERROR_FAILED,
GST_GL_WINDOW_ERROR_WRONG_CONFIG,
GST_GL_WINDOW_ERROR_WRONG_API,
GST_GL_WINDOW_ERROR_OLD_LIBS, GST_GL_WINDOW_ERROR_OLD_LIBS,
GST_GL_WINDOW_ERROR_CREATE_CONTEXT,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
} GstGLWindowError; } GstGLWindowError;

View file

@ -97,7 +97,8 @@ gst_gl_context_wgl_create_context (GstGLContext * context,
if (other_context) { if (other_context) {
if (!GST_GL_IS_CONTEXT_WGL (other_context)) { if (!GST_GL_IS_CONTEXT_WGL (other_context)) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Cannot share context with a non-WGL context"); "Cannot share context with a non-WGL context");
goto failure; goto failure;
} }
@ -109,8 +110,9 @@ gst_gl_context_wgl_create_context (GstGLContext * context,
GST_DEBUG ("gl context created: %" G_GUINTPTR_FORMAT, GST_DEBUG ("gl context created: %" G_GUINTPTR_FORMAT,
(guintptr) context_wgl->wgl_context); (guintptr) context_wgl->wgl_context);
else { else {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_CREATE_CONTEXT, g_set_error (error, GST_GL_CONTEXT_ERROR,
"failed to create glcontext:0x%x", (unsigned int) GetLastError ()); GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "failed to create glcontext:0x%x",
(unsigned int) GetLastError ());
goto failure; goto failure;
} }
g_assert (context_wgl->wgl_context); g_assert (context_wgl->wgl_context);
@ -120,8 +122,8 @@ gst_gl_context_wgl_create_context (GstGLContext * context,
if (other_wgl) { if (other_wgl) {
if (!wglShareLists (other_wgl->wgl_context, context_wgl->wgl_context)) { if (!wglShareLists (other_wgl->wgl_context, context_wgl->wgl_context)) {
g_set_error (error, GST_GL_WINDOW_ERROR, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_WINDOW_ERROR_CREATE_CONTEXT, "failed to share contexts 0x%x", GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "failed to share contexts 0x%x",
(unsigned int) GetLastError ()); (unsigned int) GetLastError ());
goto failure; goto failure;
} }

View file

@ -152,7 +152,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
GstGLWindow *other_window; GstGLWindow *other_window;
if (!GST_GL_IS_CONTEXT_GLX (other_context)) { if (!GST_GL_IS_CONTEXT_GLX (other_context)) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Cannot share context with non-GLX context"); "Cannot share context with non-GLX context");
goto failure; goto failure;
} }
@ -222,8 +223,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
XFree (context_glx->priv->fbconfigs); XFree (context_glx->priv->fbconfigs);
if (!context_glx->glx_context) { if (!context_glx->glx_context) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_CREATE_CONTEXT, g_set_error (error, GST_GL_CONTEXT_ERROR,
"Failed to create opengl context"); GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "Failed to create opengl context");
goto failure; goto failure;
} }
@ -274,14 +275,15 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
device = (Display *) gst_gl_window_get_display (window); device = (Display *) gst_gl_window_get_display (window);
if (!glXQueryExtension (device, &error_base, &event_base)) { if (!glXQueryExtension (device, &error_base, &event_base)) {
g_set_error (error, GST_GL_WINDOW_ERROR, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension"); GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension");
goto failure; goto failure;
} }
if (!glXQueryVersion (device, &context_glx->priv->glx_major, if (!glXQueryVersion (device, &context_glx->priv->glx_major,
&context_glx->priv->glx_minor)) { &context_glx->priv->glx_minor)) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_CREATE_CONTEXT, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
"Failed to query GLX version (glXQueryVersion failed)"); "Failed to query GLX version (glXQueryVersion failed)");
goto failure; goto failure;
} }
@ -306,7 +308,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
window_x11->screen_num, attribs); window_x11->screen_num, attribs);
if (!window_x11->visual_info) { if (!window_x11->visual_info) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Bad attributes in glXChooseVisual"); "Bad attributes in glXChooseVisual");
goto failure; goto failure;
} }
@ -326,7 +329,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
DefaultScreen (device), attribs, &fbcount); DefaultScreen (device), attribs, &fbcount);
if (!context_glx->priv->fbconfigs) { if (!context_glx->priv->fbconfigs) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Could not find any FBConfig's to use (check attributes?)"); "Could not find any FBConfig's to use (check attributes?)");
goto failure; goto failure;
} }
@ -337,8 +341,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
context_glx->priv->fbconfigs[0]); context_glx->priv->fbconfigs[0]);
if (!window_x11->visual_info) { if (!window_x11->visual_info) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR,
"Bad attributes in FBConfig"); GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Bad attributes in FBConfig");
goto failure; goto failure;
} }
} }