gl/display: clean up pre gstglcontext api and struct fields
authorMatthew Waters <ystreet00@gmail.com>
Tue, 6 May 2014 06:39:06 +0000 (16:39 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:39 +0000 (19:31 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=729551

gst-libs/gst/gl/gstglcontext.c
gst-libs/gst/gl/gstgldisplay.c
gst-libs/gst/gl/gstgldisplay.h

index 8b5ab29..196dc83 100644 (file)
 #include "eagl/gstglcontext_eagl.h"
 #endif
 
-#define USING_OPENGL(display) (display->gl_api & GST_GL_API_OPENGL)
-#define USING_OPENGL3(display) (display->gl_api & GST_GL_API_OPENGL3)
-#define USING_GLES(display) (display->gl_api & GST_GL_API_GLES)
-#define USING_GLES2(display) (display->gl_api & GST_GL_API_GLES2)
-#define USING_GLES3(display) (display->gl_api & GST_GL_API_GLES3)
-
 static GModule *module_self;
 
 #if GST_GL_HAVE_OPENGL
@@ -726,10 +720,9 @@ gst_gl_context_create_thread (GstGLContext * context)
 {
   GstGLContextClass *context_class;
   GstGLWindowClass *window_class;
-  GstGLDisplay *display;
   GstGLFuncs *gl;
   gboolean ret = FALSE;
-  GstGLAPI compiled_api, user_api;
+  GstGLAPI compiled_api, user_api, gl_api;
   gchar *api_string;
   gchar *compiled_api_s;
   gchar *user_api_string;
@@ -752,7 +745,6 @@ gst_gl_context_create_thread (GstGLContext * context)
       goto failure;
   }
 
-  display = context->priv->display;
   gl = context->gl_vtable;
   compiled_api = _compiled_api ();
 
@@ -801,14 +793,13 @@ gst_gl_context_create_thread (GstGLContext * context)
     goto failure;
   }
 
-  display->gl_api = gst_gl_context_get_gl_api (context);
-  g_assert (display->gl_api != GST_GL_API_NONE
-      && display->gl_api != GST_GL_API_ANY);
+  gl_api = gst_gl_context_get_gl_api (context);
+  g_assert (gl_api != GST_GL_API_NONE && gl_api != GST_GL_API_ANY);
 
-  api_string = gst_gl_api_to_string (display->gl_api);
+  api_string = gst_gl_api_to_string (gl_api);
   GST_INFO ("available GL APIs: %s", api_string);
 
-  if (((compiled_api & display->gl_api) & user_api) == GST_GL_API_NONE) {
+  if (((compiled_api & gl_api) & user_api) == GST_GL_API_NONE) {
     g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
         "failed to create context, context "
         "could not provide correct api. user (%s), compiled (%s), context (%s)",
@@ -835,10 +826,10 @@ gst_gl_context_create_thread (GstGLContext * context)
   }
 
   /* gl api specific code */
-  if (!ret && USING_OPENGL (display))
+  if (!ret && gl_api & GST_GL_API_OPENGL)
     ret = _create_context_opengl (context, &context->priv->gl_major,
         &context->priv->gl_minor, error);
-  if (!ret && USING_GLES2 (display))
+  if (!ret && gl_api & GST_GL_API_GLES2)
     ret =
         _create_context_gles2 (context, &context->priv->gl_major,
         &context->priv->gl_minor, error);
index c99c1d2..d71b55b 100644 (file)
@@ -149,14 +149,6 @@ gst_gl_display_new (void)
   return display;
 }
 
-GstGLAPI
-gst_gl_display_get_gl_api (GstGLDisplay * display)
-{
-  g_return_val_if_fail (GST_IS_GL_DISPLAY (display), GST_GL_API_NONE);
-
-  return display->gl_api;
-}
-
 guintptr
 gst_gl_display_get_handle (GstGLDisplay * display)
 {
index 095aa80..09489a6 100644 (file)
@@ -66,9 +66,6 @@ struct _GstGLDisplay
 
   GstGLDisplayType      type;
 
-  GstGLContext         *context;
-  GstGLAPI              gl_api;
-
   GstGLDisplayPrivate  *priv;
 };
 
@@ -84,7 +81,6 @@ GstGLDisplay *gst_gl_display_new (void);
 #define gst_gl_display_lock(display)        GST_OBJECT_LOCK (display)
 #define gst_gl_display_unlock(display)      GST_OBJECT_UNLOCK (display)
 
-GstGLAPI       gst_gl_display_get_gl_api             (GstGLDisplay * display);
 guintptr         gst_gl_display_get_handle             (GstGLDisplay * display);
 GstGLDisplayType gst_gl_display_get_handle_type        (GstGLDisplay * display);