[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
parent cb7bf213fe
commit 311592f8b1
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);
if (ret == 0) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG,
"Failed to match XVisualInfo");
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Failed to match XVisualInfo");
return FALSE;
}
}
@ -209,7 +209,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
if (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");
goto failure;
}

View file

@ -54,10 +54,7 @@ G_BEGIN_DECLS
typedef enum
{
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_CREATE_CONTEXT,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
} GstGLWindowError;

View file

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

View file

@ -152,7 +152,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
GstGLWindow *other_window;
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");
goto failure;
}
@ -222,8 +223,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
XFree (context_glx->priv->fbconfigs);
if (!context_glx->glx_context) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_CREATE_CONTEXT,
"Failed to create opengl context");
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "Failed to create opengl context");
goto failure;
}
@ -274,14 +275,15 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
device = (Display *) gst_gl_window_get_display (window);
if (!glXQueryExtension (device, &error_base, &event_base)) {
g_set_error (error, GST_GL_WINDOW_ERROR,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension");
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension");
goto failure;
}
if (!glXQueryVersion (device, &context_glx->priv->glx_major,
&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)");
goto failure;
}
@ -306,7 +308,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
window_x11->screen_num, attribs);
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");
goto failure;
}
@ -326,7 +329,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
DefaultScreen (device), attribs, &fbcount);
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?)");
goto failure;
}
@ -337,8 +341,8 @@ gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
context_glx->priv->fbconfigs[0]);
if (!window_x11->visual_info) {
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_WRONG_CONFIG,
"Bad attributes in FBConfig");
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Bad attributes in FBConfig");
goto failure;
}
}