由第十二章节分析,可知,vlc使用OpenGL加载时,android端会加载【“opengl”】名的组件模块。
如下找到该组件声明:
// 【vlc/modules/video_output/opengl/egl.c】
vlc_module_begin ()
set_shortname (N_("EGL"))
set_description (N_("EGL extension for OpenGL"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
// android端加载的是该模块
set_capability ("opengl", 50)
set_callbacks (OpenGL, Close)
add_shortcut ("egl")
add_submodule ()
set_capability ("opengl es2", 50)
set_callbacks (OpenGLES2, Close)
add_shortcut ("egl")
vlc_module_end ()
1、组件初始化入口OpenGL:
// 【vlc/modules/video_output/opengl/egl.c】
static int OpenGL (vlc_object_t *obj)
{
// GL API的设置
static const struct gl_api api = {
"OpenGL", EGL_OPENGL_API, 4, EGL_OPENGL_BIT,
{
EGL_NONE },
};
return Open (obj, &api);
}
// 【vlc/modules/video_output/opengl/egl.c】
/**
* Probe EGL display availability
*/
static int Open (vlc_object_t *obj, const struct gl_api *api)
{
vlc_gl_t *gl = (vlc_gl_t *)obj;
vlc_gl_sys_t *sys = malloc(sizeof (*sys));
if (unlikely(sys