Commit 3c0d600e authored by hartman's avatar hartman
Browse files

* Lets go beserk on the locking and event passing for OpenGL resize. Haven't...

* Lets go beserk on the locking and event passing for OpenGL resize. Haven't been able to crash it anymore.
  closes #45
parent 1e2dc4cd
...@@ -279,6 +279,8 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -279,6 +279,8 @@ static void Unlock( vout_thread_t * p_vout )
{ {
int x, y; int x, y;
vlc_value_t val; vlc_value_t val;
Lock( p_vout );
NSRect bounds = [self bounds]; NSRect bounds = [self bounds];
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
...@@ -301,16 +303,15 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -301,16 +303,15 @@ static void Unlock( vout_thread_t * p_vout )
y = bounds.size.width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect; y = bounds.size.width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
} }
Lock( p_vout );
glViewport( ( bounds.size.width - x ) / 2, glViewport( ( bounds.size.width - x ) / 2,
( bounds.size.height - y ) / 2, x, y ); ( bounds.size.height - y ) / 2, x, y );
Unlock( p_vout );
if( p_vout->p_sys->b_got_frame ) if( p_vout->p_sys->b_got_frame )
{ {
/* Ask the opengl module to redraw */ /* Ask the opengl module to redraw */
vout_thread_t * p_parent; vout_thread_t * p_parent;
p_parent = (vout_thread_t *) p_vout->p_parent; p_parent = (vout_thread_t *) p_vout->p_parent;
Unlock( p_vout );
if( p_parent && p_parent->pf_display ) if( p_parent && p_parent->pf_display )
{ {
p_parent->pf_display( p_parent, NULL ); p_parent->pf_display( p_parent, NULL );
...@@ -318,17 +319,25 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -318,17 +319,25 @@ static void Unlock( vout_thread_t * p_vout )
} }
else else
{ {
Lock( p_vout );
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
Unlock( p_vout ); Unlock( p_vout );
} }
[super reshape];
}
- (void) update
{
Lock( p_vout );
[super update];
Unlock( p_vout );
} }
- (void) drawRect: (NSRect) rect - (void) drawRect: (NSRect) rect
{ {
[[self openGLContext] makeCurrentContext];
Lock( p_vout ); Lock( p_vout );
[[self openGLContext] makeCurrentContext];
glFlush(); glFlush();
[super drawRect:rect];
Unlock( p_vout ); Unlock( p_vout );
} }
......
...@@ -562,6 +562,13 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -562,6 +562,13 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
vout_sys_t *p_sys = p_vout->p_sys; vout_sys_t *p_sys = p_vout->p_sys;
float f_width, f_height; float f_width, f_height;
if( p_sys->p_vout->pf_lock &&
p_sys->p_vout->pf_lock( p_sys->p_vout ) )
{
msg_Warn( p_vout, "could not lock OpenGL provider" );
return;
}
/* glTexCoord works differently with GL_TEXTURE_2D and /* glTexCoord works differently with GL_TEXTURE_2D and
GL_TEXTURE_RECTANGLE_EXT */ GL_TEXTURE_RECTANGLE_EXT */
#ifdef SYS_DARWIN #ifdef SYS_DARWIN
...@@ -576,13 +583,6 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -576,13 +583,6 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
OpenGL providers can call pf_display to force redraw. Currently, OpenGL providers can call pf_display to force redraw. Currently,
the OS X provider uses it to get a smooth window resizing */ the OS X provider uses it to get a smooth window resizing */
if( p_sys->p_vout->pf_lock &&
p_sys->p_vout->pf_lock( p_sys->p_vout ) )
{
msg_Warn( p_vout, "could not lock OpenGL provider" );
return;
}
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
if( p_sys->i_effect == OPENGL_EFFECT_NONE ) if( p_sys->i_effect == OPENGL_EFFECT_NONE )
......
Supports Markdown
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