Commit 70944c2a authored by Eric Petit's avatar Eric Petit

video_output/opengl.c: fixed a (OS X only) segfault

 macosx/vout*.m: cleaning
parent 3ce6222f
...@@ -47,10 +47,26 @@ ...@@ -47,10 +47,26 @@
- (id)initWithVout:(vout_thread_t *)_p_vout frame:(NSRect *)s_frame - (id)initWithVout:(vout_thread_t *)_p_vout frame:(NSRect *)s_frame
{ {
[self setReleasedWhenClosed: YES]; int i_timeout;
p_vout = _p_vout; p_vout = _p_vout;
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
{
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( NSApp == NULL )
{
/* No MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
return NULL;
}
/* p_real_vout: the vout we have to use to check for video-on-top /* p_real_vout: the vout we have to use to check for video-on-top
and a few other things. If we are the QuickTime output, it's us. and a few other things. If we are the QuickTime output, it's us.
It we are the OpenGL provider, it is our parent. */ It we are the OpenGL provider, it is our parent. */
...@@ -202,6 +218,7 @@ ...@@ -202,6 +218,7 @@
[self updateTitle]; [self updateTitle];
[self makeKeyAndOrderFront: nil]; [self makeKeyAndOrderFront: nil];
[self setReleasedWhenClosed: YES];
/* We'll catch mouse events */ /* We'll catch mouse events */
[self setAcceptsMouseMovedEvents: YES]; [self setAcceptsMouseMovedEvents: YES];
...@@ -215,7 +232,7 @@ ...@@ -215,7 +232,7 @@
{ {
if( p_fullscreen_state ) if( p_fullscreen_state )
{ {
EndFullScreen( p_fullscreen_state, NULL ); EndFullScreen( p_fullscreen_state, 0 );
} }
[super close]; [super close];
} }
......
...@@ -76,12 +76,6 @@ static void Swap ( vout_thread_t * p_vout ); ...@@ -76,12 +76,6 @@ static void Swap ( vout_thread_t * p_vout );
int E_(OpenVideoGL) ( vlc_object_t * p_this ) int E_(OpenVideoGL) ( vlc_object_t * p_this )
{ {
vout_thread_t * p_vout = (vout_thread_t *) p_this; vout_thread_t * p_vout = (vout_thread_t *) p_this;
int i_timeout;
/* OpenGL interface disabled until
* - the green line is gone
* - other problems?????
*/
if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) ) if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
{ {
...@@ -99,34 +93,16 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) ...@@ -99,34 +93,16 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
{
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( NSApp == NULL )
{
/* No MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
return VLC_EGENERIC;
}
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
p_vout->pf_control= Control;
p_vout->pf_swap = Swap;
p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init]; p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
/* Spawn window */ /* Spawn window */
p_vout->p_sys->b_got_frame = VLC_FALSE; p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout
frame: nil]; frame: nil];
if( !p_vout->p_sys->o_window )
{
return VLC_EGENERIC;
}
/* Add OpenGL view */ /* Add OpenGL view */
#define o_glview p_vout->p_sys->o_glview #define o_glview p_vout->p_sys->o_glview
...@@ -136,6 +112,12 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) ...@@ -136,6 +112,12 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
[o_glview autorelease]; [o_glview autorelease];
#undef o_glview #undef o_glview
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
p_vout->pf_control= Control;
p_vout->pf_swap = Swap;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -107,7 +107,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this ) ...@@ -107,7 +107,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
{ {
vout_thread_t * p_vout = (vout_thread_t *)p_this; vout_thread_t * p_vout = (vout_thread_t *)p_this;
OSErr err; OSErr err;
int i_timeout;
p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
...@@ -118,22 +117,7 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this ) ...@@ -118,22 +117,7 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */ p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
for( i_timeout = 20 ; i_timeout-- ; )
{
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( NSApp == NULL )
{
/* no MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
free( p_vout->p_sys );
return( 1 );
}
p_vout->pf_init = InitVideo; p_vout->pf_init = InitVideo;
p_vout->pf_end = EndVideo; p_vout->pf_end = EndVideo;
...@@ -142,7 +126,13 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this ) ...@@ -142,7 +126,13 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
p_vout->pf_display = DisplayVideo; p_vout->pf_display = DisplayVideo;
p_vout->pf_control = ControlVideo; p_vout->pf_control = ControlVideo;
p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init]; /* Spawn window */
p_vout->p_sys->o_window =
[[VLCWindow alloc] initWithVout: p_vout frame: nil];
if( !p_vout->p_sys->o_window )
{
return VLC_EGENERIC;
}
p_vout->p_sys->b_altivec = p_vout->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC; p_vout->p_sys->b_altivec = p_vout->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC;
msg_Dbg( p_vout, "We do%s have Altivec", p_vout->p_sys->b_altivec ? "" : "n't" ); msg_Dbg( p_vout, "We do%s have Altivec", p_vout->p_sys->b_altivec ? "" : "n't" );
...@@ -204,10 +194,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this ) ...@@ -204,10 +194,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Spawn window */
p_vout->p_sys->o_window =
[[VLCWindow alloc] initWithVout: p_vout frame: nil];
#define o_qtview p_vout->p_sys->o_qtview #define o_qtview p_vout->p_sys->o_qtview
o_qtview = [[VLCQTView alloc] initWithVout: p_vout]; o_qtview = [[VLCQTView alloc] initWithVout: p_vout];
[p_vout->p_sys->o_window setContentView: o_qtview]; [p_vout->p_sys->o_window setContentView: o_qtview];
......
...@@ -162,6 +162,7 @@ static int CreateVout( vlc_object_t *p_this ) ...@@ -162,6 +162,7 @@ static int CreateVout( vlc_object_t *p_this )
var_Create( p_vout, "opengl-effect", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "opengl-effect", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
p_sys->i_index = 0;
#ifdef SYS_DARWIN #ifdef SYS_DARWIN
p_sys->i_tex_width = p_vout->render.i_width; p_sys->i_tex_width = p_vout->render.i_width;
p_sys->i_tex_height = p_vout->render.i_height; p_sys->i_tex_height = p_vout->render.i_height;
......
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