From 2af0503cc691f09af28cc2994923bdd34d098fce Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 3 Sep 2013 21:49:18 +1000 Subject: context: Move some window error enums to context --- gst-libs/gst/gl/egl/gstglcontext_egl.c | 7 ++++--- gst-libs/gst/gl/gstglwindow.h | 3 --- gst-libs/gst/gl/win32/gstglcontext_wgl.c | 12 +++++++----- gst-libs/gst/gl/x11/gstglcontext_glx.c | 24 ++++++++++++++---------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c index c10bd5b..b7edf4b 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -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; } diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h index 946e551..1d2137d 100644 --- a/gst-libs/gst/gl/gstglwindow.h +++ b/gst-libs/gst/gl/gstglwindow.h @@ -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; diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.c b/gst-libs/gst/gl/win32/gstglcontext_wgl.c index 88e35af..2dba16d 100644 --- a/gst-libs/gst/gl/win32/gstglcontext_wgl.c +++ b/gst-libs/gst/gl/win32/gstglcontext_wgl.c @@ -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; } diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c index abfec94..2be004c 100644 --- a/gst-libs/gst/gl/x11/gstglcontext_glx.c +++ b/gst-libs/gst/gl/x11/gstglcontext_glx.c @@ -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; } } -- cgit v1.2.3