diff options
author | Matthew Waters <matthew@centricular.com> | 2017-11-27 14:44:58 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2017-11-27 15:20:28 +1100 |
commit | a3ce46a454c47626913828104aa15d2c1e84d419 (patch) | |
tree | 0916502506944387b4532c18c759d95a93b459ad /gst-libs | |
parent | 9c20be77e723747e7381d1921a8a8b7bd1b6a232 (diff) |
gl/caopengllayer: use public GstGLContext instead of Cocoa-specific one
Allows keeping the GstGLCAOpenGLLayer public but not the winsys-specific
context/display/window.
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/gl/cocoa/gstglcaopengllayer.h | 6 | ||||
-rw-r--r-- | gst-libs/gst/gl/cocoa/gstglcaopengllayer.m | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h index 2ed87b7b4..808604d27 100644 --- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h +++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h @@ -25,13 +25,11 @@ #include <gst/gl/gl.h> #include <Cocoa/Cocoa.h> -#include <gst/gl/cocoa/gstglcontext_cocoa.h> - G_BEGIN_DECLS @interface GstGLCAOpenGLLayer : CAOpenGLLayer { @public - GstGLContextCocoa *gst_gl_context; + GstGLContext *gst_gl_context; CGLContextObj gl_context; @private @@ -53,7 +51,7 @@ G_BEGIN_DECLS - (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify; - (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify; - (void) queueResize; -- (id) initWithGstGLContext: (GstGLContextCocoa *)context; +- (id) initWithGstGLContext: (GstGLContext *)context; @end G_END_DECLS diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m index 47690b49d..065d596de 100644 --- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m +++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m @@ -62,7 +62,9 @@ _context_ready (gpointer data) g_atomic_int_set (&ca_layer->can_draw, 1); } -- (id)initWithGstGLContext:(GstGLContextCocoa *)parent_gl_context { +- (id)initWithGstGLContext:(GstGLContext *)parent_gl_context { + g_return_val_if_fail (GST_IS_GL_CONTEXT_COCOA (parent_gl_context), nil); + self = [super init]; _init_debug(); @@ -72,7 +74,7 @@ _context_ready (gpointer data) self->gst_gl_context = parent_gl_context; self.needsDisplayOnBoundsChange = YES; - gst_gl_window_send_message_async (GST_GL_CONTEXT (parent_gl_context)->window, + gst_gl_window_send_message_async (parent_gl_context->window, (GstGLWindowCB) _context_ready, (__bridge_retained gpointer)self, (GDestroyNotify)CFRelease); return self; @@ -82,7 +84,7 @@ _context_ready (gpointer data) CGLPixelFormatObj fmt = NULL; if (self->gst_gl_context) - fmt = gst_gl_context_cocoa_get_pixel_format (self->gst_gl_context); + fmt = gst_gl_context_cocoa_get_pixel_format (GST_GL_CONTEXT_COCOA (self->gst_gl_context)); if (!fmt) { CGLPixelFormatAttribute attribs[] = { @@ -111,7 +113,7 @@ _context_ready (gpointer data) GError *error = NULL; if (self->gst_gl_context) - external_context = (CGLContextObj) gst_gl_context_get_gl_context (GST_GL_CONTEXT (self->gst_gl_context)); + external_context = (CGLContextObj) gst_gl_context_get_gl_context (self->gst_gl_context); GST_INFO ("attempting to create CGLContext for CAOpenGLLayer with " "share context %p", external_context); @@ -130,7 +132,7 @@ _context_ready (gpointer data) return NULL; } - display = gst_gl_context_get_display (GST_GL_CONTEXT (self->gst_gl_context)); + display = gst_gl_context_get_display (self->gst_gl_context); self->draw_context = gst_gl_context_new_wrapped (display, (guintptr) self->gl_context, GST_GL_PLATFORM_CGL, gst_gl_context_get_current_gl_api (GST_GL_PLATFORM_CGL, NULL, NULL)); @@ -142,7 +144,7 @@ _context_ready (gpointer data) } gst_gl_context_activate (self->draw_context, TRUE); - gst_gl_context_set_shared_with (self->draw_context, GST_GL_CONTEXT (self->gst_gl_context)); + gst_gl_context_set_shared_with (self->draw_context, self->gst_gl_context); if (!gst_gl_context_fill_info (self->draw_context, &error)) { GST_ERROR ("failed to fill wrapped context information: %s", error->message); return NULL; |