/** * Destroys the OpenGL context. */ static void Close (vlc_object_t *obj) { vout_display_t *vd = (vout_display_t *)obj; vout_display_sys_t *sys = vd->sys; vout_display_opengl_Clean (&sys->vgl); vlc_gl_Destroy (sys->gl); vout_display_DeleteWindow (vd, sys->window); free (sys); }
/***************************************************************************** * End: terminate GLX video thread output method *****************************************************************************/ static void End( vout_thread_t *p_vout ) { vout_sys_t *p_sys = p_vout->p_sys; if( I_OUTPUTPICTURES > 0 ) { if( p_sys->p_current ) picture_Release( p_sys->p_current ); vout_display_opengl_Clean( &p_sys->vgl ); p_vout->p_picture[0].i_status = FREE_PICTURE; I_OUTPUTPICTURES = 0; } /* We must release the opengl provider here: opengl requiere init and end to be done in the same thread */ module_unneed( p_sys->p_vout, p_sys->p_vout->p_module ); vlc_object_release( p_sys->p_vout ); }
/***************************************************************************** * Init: initialize the OpenGL video thread output method *****************************************************************************/ static int Init( vout_thread_t *p_vout ) { vout_sys_t *p_sys = p_vout->p_sys; p_sys->p_vout->pf_init( p_sys->p_vout ); p_sys->gl.lock = OpenglLock; p_sys->gl.unlock = OpenglUnlock; p_sys->gl.swap = OpenglSwap; p_sys->gl.sys = p_sys->p_vout; video_format_t fmt; video_format_Init( &fmt, 0 ); video_format_Setup( &fmt, p_vout->render.i_chroma, p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_aspect * p_vout->render.i_height, VOUT_ASPECT_FACTOR * p_vout->render.i_width ); if( vout_display_opengl_Init( &p_sys->vgl, &fmt, &p_sys->gl ) ) { I_OUTPUTPICTURES = 0; return VLC_EGENERIC; } p_sys->p_pool = vout_display_opengl_GetPool( &p_sys->vgl ); if( !p_sys->p_pool ) { vout_display_opengl_Clean( &p_sys->vgl ); I_OUTPUTPICTURES = 0; return VLC_EGENERIC; } /* */ p_vout->output.i_chroma = fmt.i_chroma; p_vout->output.i_rmask = fmt.i_rmask; p_vout->output.i_gmask = fmt.i_gmask; p_vout->output.i_bmask = fmt.i_bmask; /* Since OpenGL can do rescaling for us, stick to the default * coordinates and aspect. */ p_vout->output.i_width = p_vout->render.i_width; p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_aspect = p_vout->render.i_aspect; p_vout->fmt_out = p_vout->fmt_in; p_vout->fmt_out.i_chroma = p_vout->output.i_chroma; /* */ p_sys->p_current = picture_pool_Get( p_sys->p_pool ); p_vout->p_picture[0] = *p_sys->p_current; p_vout->p_picture[0].i_status = DESTROYED_PICTURE; p_vout->p_picture[0].i_type = DIRECT_PICTURE; p_vout->p_picture[0].i_refcount = 0; p_vout->p_picture[0].p_sys = NULL; PP_OUTPUTPICTURE[0] = &p_vout->p_picture[0]; I_OUTPUTPICTURES = 1; return VLC_SUCCESS; }