Commit 546871ce authored by Felix Paul Kühne's avatar Felix Paul Kühne

caopengllayer: don't use GCD to fetch the OpenGL context

This fails in one of three attempts in Webkit and even more often in Gecko browsers
parent 82552e53
...@@ -142,11 +142,12 @@ static int Open (vlc_object_t *p_this) ...@@ -142,11 +142,12 @@ static int Open (vlc_object_t *p_this)
/* store for later, released in Close() */ /* store for later, released in Close() */
sys->container = [container retain]; sys->container = [container retain];
dispatch_sync(dispatch_get_main_queue(), ^{
[CATransaction begin]; [CATransaction begin];
sys->cgLayer = [[VLCCAOpenGLLayer alloc] init]; sys->cgLayer = [[VLCCAOpenGLLayer alloc] init];
[sys->cgLayer setVoutDisplay:vd]; [sys->cgLayer setVoutDisplay:vd];
[sys->cgLayer display]; // TODO: Find a better way to wait until we get a context
[sys->cgLayer performSelectorOnMainThread:@selector(display) withObject:nil waitUntilDone:YES];
if ([container respondsToSelector:@selector(addVoutLayer:)]) { if ([container respondsToSelector:@selector(addVoutLayer:)]) {
msg_Dbg(vd, "container implements implicit protocol"); msg_Dbg(vd, "container implements implicit protocol");
[container addVoutLayer:sys->cgLayer]; [container addVoutLayer:sys->cgLayer];
...@@ -157,17 +158,16 @@ static int Open (vlc_object_t *p_this) ...@@ -157,17 +158,16 @@ static int Open (vlc_object_t *p_this)
msg_Err(vd, "Provided NSObject container isn't compatible"); msg_Err(vd, "Provided NSObject container isn't compatible");
[sys->cgLayer release]; [sys->cgLayer release];
sys->cgLayer = nil; sys->cgLayer = nil;
[CATransaction commit];
goto bailout;
} }
[CATransaction commit]; [CATransaction commit];
});
if (!sys->cgLayer) if (!sys->cgLayer)
goto bailout; goto bailout;
if (!sys->glContext) { if (!sys->glContext)
msg_Err(vd, "Have no gl context"); msg_Warn(vd, "we might not have an OpenGL context yet");
goto bailout;
}
/* Initialize common OpenGL video display */ /* Initialize common OpenGL video display */
sys->gl.lock = OpenglLock; sys->gl.lock = OpenglLock;
...@@ -335,6 +335,10 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -335,6 +335,10 @@ static int Control (vout_display_t *vd, int query, va_list ap)
*gl = &sys->gl; *gl = &sys->gl;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
{
return VLC_SUCCESS;
}
case VOUT_DISPLAY_RESET_PICTURES: case VOUT_DISPLAY_RESET_PICTURES:
assert (0); assert (0);
...@@ -418,9 +422,9 @@ static void *OurGetProcAddress (vlc_gl_t *gl, const char *name) ...@@ -418,9 +422,9 @@ static void *OurGetProcAddress (vlc_gl_t *gl, const char *name)
{ {
[super resizeWithOldSuperlayerSize: size]; [super resizeWithOldSuperlayerSize: size];
CGRect bounds = self.bounds; CGSize boundsSize = self.bounds.size;
if (_vd) if (_vd)
vout_display_SendEventDisplaySize(_vd, bounds.size.width, bounds.size.height, _vd->cfg->is_fullscreen); vout_display_SendEventDisplaySize(_vd, boundsSize.width, boundsSize.height, _vd->cfg->is_fullscreen);
} }
- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp - (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment