static struct list *construct_components(void) { struct list *head = NULL, *preload_entry; ComponentHandlePtr component_handle; /* In Chromium OS, the OMX IL Client will call preload_components() * so that the preload_list is already populated. In non-chrome case, * we need to create the list here */ if (!preload_list) { if (!create_preload_list()) { omx_verboseLog("error: Preload list cannot be populated"); } } list_foreach(preload_list, preload_entry) { CModule *cmodule; struct list *entry; OMX_ERRORTYPE ret; component_handle = (ComponentHandlePtr) preload_entry->data; /* skip libraries starting with # */ if (component_handle->comp_name[0] == '#') continue; cmodule = new CModule(component_handle->comp_name); if (!cmodule) continue; omx_verboseLog("found component library %s", component_handle->comp_name); ret = cmodule->Load(MODULE_NOW, component_handle->comp_handle); if (ret != OMX_ErrorNone) goto delete_cmodule; ret = cmodule->SetParser(component_handle->parser_handle); if (ret != OMX_ErrorNone) goto delete_cmodule; ret = cmodule->QueryComponentNameAndRoles(); if (ret != OMX_ErrorNone) goto unload_cmodule; entry = list_alloc(cmodule); if (!entry) goto unload_cmodule; head = __list_add_tail(head, entry); omx_verboseLog("module %s:%s added to component list", cmodule->GetLibraryName(), cmodule->GetComponentName()); continue; unload_cmodule: cmodule->Unload(); delete_cmodule: delete cmodule; }