msg_Err( p_vout, "out of memory" );
return VLC_ENOMEM;
}
+ vlc_object_attach( p_sys->p_vout, p_this );
p_sys->p_vout->i_window_width = p_vout->i_window_width;
p_sys->p_vout->i_window_height = p_vout->i_window_height;
if( p_sys->p_vout->p_module == NULL )
{
msg_Err( p_vout, "No OpenGL provider found" );
+ vlc_object_detach( p_sys->p_vout );
vlc_object_destroy( p_sys->p_vout );
return VLC_ENOOBJ;
}
- vlc_object_attach( p_sys->p_vout, p_this );
p_vout->pf_init = Init;
p_vout->pf_end = End;
vout_sys_t *p_sys = p_vout->p_sys;
int i_pixel_pitch;
+ p_sys->p_vout->pf_init( p_sys->p_vout );
+
/* No YUV textures :( */
#if VLCGL_RGB_FORMAT == GL_RGB
*****************************************************************************/
static int CreateOpenGL ( vlc_object_t * );
static void DestroyOpenGL( vlc_object_t * );
+static int InitOpenGL ( vout_thread_t * );
static void SwapBuffers ( vout_thread_t * );
/*****************************************************************************
}
/* Set the function pointer */
+ p_vout->pf_init = InitOpenGL;
p_vout->pf_swap = SwapBuffers;
p_vout->p_sys->b_glx13 = b_glx13;
- /* Initialize GLX */
- if( !b_glx13 )
- {
- if( InitGLX12( p_vout ) != VLC_SUCCESS )
- {
- return VLC_EGENERIC;
- }
- }
- else
- {
- if( InitGLX13( p_vout ) != VLC_SUCCESS )
- {
- return VLC_EGENERIC;
- }
- }
-
- /* Set the OpenGL context _for the current thread_ */
- SwitchContext( p_vout );
-
return VLC_SUCCESS;
}
return VLC_SUCCESS;
}
+/*****************************************************************************
+ * InitOpenGL: initializes OpenGL provider
+ *****************************************************************************/
+static int InitOpenGL( vout_thread_t *p_vout )
+{
+ /* Initialize GLX */
+ if( !p_vout->p_sys->b_glx13 )
+ {
+ if( InitGLX12( p_vout ) != VLC_SUCCESS )
+ {
+ return VLC_EGENERIC;
+ }
+ }
+ else
+ {
+ if( InitGLX13( p_vout ) != VLC_SUCCESS )
+ {
+ return VLC_EGENERIC;
+ }
+ }
+
+ /* Set the OpenGL context _for the current thread_ */
+ SwitchContext( p_vout );
+
+ return VLC_SUCCESS;
+}
+
int InitGLX12( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
msg_Err( p_thread, "out of memory" );
return;
}
+ vlc_object_attach( p_thread->p_opengl, p_this );
p_thread->p_opengl->i_window_width = p_thread->i_width;
p_thread->p_opengl->i_window_height = p_thread->i_height;
if( p_thread->p_module == NULL )
{
msg_Err( p_thread, "No OpenGL provider found" );
+ vlc_object_detach( p_thread->p_opengl );
vlc_object_destroy( p_thread->p_opengl );
return;
}
- vlc_object_attach( p_thread->p_opengl, p_this );
+ p_thread->p_opengl->pf_init( p_thread->p_opengl );
setup_opengl( p_thread->i_width, p_thread->i_height );
CreateRenderTarget(512, &RenderTargetTextureID, NULL);