/* Must be called in the gl thread */
GstGLContextCocoa *
-gst_gl_context_cocoa_new (void)
+gst_gl_context_cocoa_new (GstGLDisplay * display)
{
- GstGLContextCocoa *context = g_object_new (GST_GL_TYPE_CONTEXT_COCOA, NULL);
+ if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0)
+ /* we require an cocoa display to create CGL contexts */
+ return NULL;
- return context;
+ return g_object_new (GST_GL_TYPE_CONTEXT_COCOA, NULL);
}
struct pixel_attr
GType gst_gl_context_eagl_get_type (void);
-GstGLContextEagl * gst_gl_context_eagl_new (void);
+GstGLContextEagl * gst_gl_context_eagl_new (GstGLDisplay * display);
void gst_gl_context_eagl_update_layer (GstGLContext * context);
void gst_gl_context_eagl_resize (GstGLContextEagl * eagl_context);
/* Must be called in the gl thread */
GstGLContextEagl *
-gst_gl_context_eagl_new (void)
+gst_gl_context_eagl_new (GstGLDisplay * display)
{
- GstGLContextEagl *context = g_object_new (GST_GL_TYPE_CONTEXT_EAGL, NULL);
-
- return context;
+ /* there isn't actually a display type for eagl yet? */
+ return g_object_new (GST_GL_TYPE_CONTEXT_EAGL, NULL);
}
void
/* Must be called in the gl thread */
GstGLContextEGL *
-gst_gl_context_egl_new (void)
+gst_gl_context_egl_new (GstGLDisplay * display)
{
- GstGLContextEGL *window = g_object_new (GST_GL_TYPE_CONTEXT_EGL, NULL);
-
- return window;
+ /* XXX: display type could theoretically be anything, as long as
+ * eglGetDisplay supports it. */
+ return g_object_new (GST_GL_TYPE_CONTEXT_EGL, NULL);
}
static const gchar *
typedef struct _GstGLContextEGL GstGLContextEGL;
typedef struct _GstGLContextEGLClass GstGLContextEGLClass;
+GType gst_gl_context_egl_get_type (void);
#define GST_GL_TYPE_CONTEXT_EGL (gst_gl_context_egl_get_type())
#define GST_GL_CONTEXT_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_CONTEXT_EGL, GstGLContextEGL))
#define GST_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_CONTEXT_EGL, GstGLContextEGLClass))
GstGLContextClass parent;
};
-GType gst_gl_context_egl_get_type (void);
-GstGLContextEGL * gst_gl_context_egl_new (void);
+GstGLContextEGL * gst_gl_context_egl_new (GstGLDisplay * display);
guintptr gst_gl_context_egl_get_current_context (void);
gpointer gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name);
", user choice:%s", display, user_choice);
#if GST_GL_HAVE_PLATFORM_CGL
if (!context && (!user_choice || g_strstr_len (user_choice, 5, "cgl")))
- context = GST_GL_CONTEXT (gst_gl_context_cocoa_new ());
+ context = GST_GL_CONTEXT (gst_gl_context_cocoa_new (display));
#endif
#if GST_GL_HAVE_PLATFORM_GLX
if (!context && (!user_choice || g_strstr_len (user_choice, 3, "glx")))
- context = GST_GL_CONTEXT (gst_gl_context_glx_new ());
+ context = GST_GL_CONTEXT (gst_gl_context_glx_new (display));
#endif
#if GST_GL_HAVE_PLATFORM_EGL
if (!context && (!user_choice || g_strstr_len (user_choice, 7, "egl")))
- context = GST_GL_CONTEXT (gst_gl_context_egl_new ());
+ context = GST_GL_CONTEXT (gst_gl_context_egl_new (display));
#endif
#if GST_GL_HAVE_PLATFORM_WGL
if (!context && (!user_choice || g_strstr_len (user_choice, 3, "wgl"))) {
- context = GST_GL_CONTEXT (gst_gl_context_wgl_new ());
+ context = GST_GL_CONTEXT (gst_gl_context_wgl_new (display));
}
#endif
#if GST_GL_HAVE_PLATFORM_EAGL
if (!context && (!user_choice || g_strstr_len (user_choice, 5, "eagl")))
- context = GST_GL_CONTEXT (gst_gl_context_eagl_new ());
+ context = GST_GL_CONTEXT (gst_gl_context_eagl_new (display));
#endif
if (!context) {
GstGLContextWGL *
gst_gl_context_wgl_new (void)
{
- GstGLContextWGL *context = g_object_new (GST_GL_TYPE_CONTEXT_WGL, NULL);
+ if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) ==
+ 0)
+ /* we require an win32 display handle to create WGL contexts */
+ return NULL;
- return context;
+ return g_object_new (GST_GL_TYPE_CONTEXT_WGL, NULL);
}
static gboolean
#include <gst/gl/gl.h>
#include "gstglcontext_glx.h"
-#define GST_CAT_DEFAULT gst_gl_window_debug
+#define GST_CAT_DEFAULT gst_gl_context_debug
#define gst_gl_context_glx_parent_class parent_class
G_DEFINE_TYPE (GstGLContextGLX, gst_gl_context_glx, GST_GL_TYPE_CONTEXT);
}
GstGLContextGLX *
-gst_gl_context_glx_new (void)
+gst_gl_context_glx_new (GstGLDisplay * display)
{
- GstGLContextGLX *context = g_object_new (GST_GL_TYPE_CONTEXT_GLX, NULL);
+ if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) == 0)
+ /* we require an x11 display handle to create GLX contexts */
+ return NULL;
- return context;
+ return g_object_new (GST_GL_TYPE_CONTEXT_GLX, NULL);
}
static inline void
GType gst_gl_context_glx_get_type (void);
-GstGLContextGLX * gst_gl_context_glx_new (void);
+GstGLContextGLX * gst_gl_context_glx_new (GstGLDisplay * display);
guintptr gst_gl_context_glx_get_current_context (void);
gpointer gst_gl_context_glx_get_proc_address (GstGLAPI gl_api, const gchar * name);