diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h index 17e385b56e..53a14d8dde 100644 --- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h +++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h @@ -46,6 +46,7 @@ G_BEGIN_DECLS gpointer resize_data; GDestroyNotify resize_notify; + gint can_draw; } - (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify; - (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify; diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m index d6148d1e78..d9fd2e27e8 100644 --- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m +++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m @@ -37,6 +37,14 @@ [super dealloc]; } +static void +_context_ready (gpointer data) +{ + GstGLCAOpenGLLayer *ca_layer = data; + + g_atomic_int_set (&ca_layer->can_draw, 1); +} + - (id)initWithGstGLContext:(GstGLContextCocoa *)parent_gl_context { [super init]; @@ -46,6 +54,9 @@ self.asynchronous = YES; self.needsDisplayOnBoundsChange = YES; + gst_gl_window_send_message_async (GST_GL_CONTEXT (parent_gl_context)->window, + (GstGLWindowCB) _context_ready, self, NULL); + return self; } @@ -119,6 +130,13 @@ self->resize_notify = notify; } +- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext + pixelFormat:(CGLPixelFormatObj)pixelFormat + forLayerTime:(CFTimeInterval)interval + displayTime:(const CVTimeStamp *)timeStamp { + return g_atomic_int_get (&self->can_draw); +} + - (void)drawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)interval