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,32 +142,32 @@ static int Open (vlc_object_t *p_this) ...@@ -142,32 +142,32 @@ 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:)]) {
msg_Dbg(vd, "container implements implicit protocol"); if ([container respondsToSelector:@selector(addVoutLayer:)]) {
[container addVoutLayer:sys->cgLayer]; msg_Dbg(vd, "container implements implicit protocol");
} else if ([container respondsToSelector:@selector(addSublayer:)] || [container isKindOfClass:[CALayer class]]) { [container addVoutLayer:sys->cgLayer];
msg_Dbg(vd, "container doesn't implement implicit protocol, fallback mode used"); } else if ([container respondsToSelector:@selector(addSublayer:)] || [container isKindOfClass:[CALayer class]]) {
[container addSublayer:sys->cgLayer]; msg_Dbg(vd, "container doesn't implement implicit protocol, fallback mode used");
} else { [container addSublayer:sys->cgLayer];
msg_Err(vd, "Provided NSObject container isn't compatible"); } else {
[sys->cgLayer release]; msg_Err(vd, "Provided NSObject container isn't compatible");
sys->cgLayer = nil; [sys->cgLayer release];
} sys->cgLayer = nil;
[CATransaction commit]; [CATransaction commit];
}); goto bailout;
}
[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