本文整理汇总了C++中OMX_COMPONENTTYPE::SetCallbacks方法的典型用法代码示例。如果您正苦于以下问题:C++ OMX_COMPONENTTYPE::SetCallbacks方法的具体用法?C++ OMX_COMPONENTTYPE::SetCallbacks怎么用?C++ OMX_COMPONENTTYPE::SetCallbacks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OMX_COMPONENTTYPE
的用法示例。
在下文中一共展示了OMX_COMPONENTTYPE::SetCallbacks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_component
OMX_ERRORTYPE load_component(HTEST *hTest, OMX_U32 idx)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *hComponent = NULL;
OMX_COMPONENTINITTYPE pInit = NULL;
OMX_STRING cError;
hTest->pLibHandle[idx] = dlopen(hTest->lib_name[idx], RTLD_NOW);
if(hTest->pLibHandle[idx] == NULL)
{
cError = dlerror();
printf("%s\n", cError);
return OMX_ErrorInvalidComponentName;
}
pInit = (OMX_COMPONENTINITTYPE)dlsym(hTest->pLibHandle[idx], hTest->itf_name[idx]);
if(pInit == NULL)
{
cError = dlerror();
printf("%s\n", cError);
return OMX_ErrorInvalidComponent;
}
hComponent = (OMX_COMPONENTTYPE*)fsl_osal_malloc_new(sizeof(OMX_COMPONENTTYPE));
if(hComponent == NULL)
{
printf("Failed to allocate memory for hComponent.\n");
return OMX_ErrorInsufficientResources;
}
OMX_INIT_STRUCT(hComponent, OMX_COMPONENTTYPE);
ret = pInit((OMX_HANDLETYPE)(hComponent));
if(ret != OMX_ErrorNone)
{
printf("Load component failed.\n");
return OMX_ErrorInvalidComponentName;
}
hComponent->SetCallbacks(hComponent, &gCallBacks, hTest);
hTest->component[idx].hComponent = hComponent;
return OMX_ErrorNone;
}
示例2: OMX_GetHandle
/* OMX_GetHandle */
OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
OMX_OUT OMX_HANDLETYPE* pHandle,
OMX_IN OMX_STRING cComponentName,
OMX_IN OMX_PTR pAppData,
OMX_IN OMX_CALLBACKTYPE* pCallBacks)
{
OMX_ERRORTYPE eError;
OMX_COMPONENTTYPE *pComp;
OMX_HANDLETYPE hHandle = 0;
if (pHandle == NULL || cComponentName == NULL || pCallBacks == NULL || ilcs_service == NULL)
{
if(pHandle)
*pHandle = NULL;
return OMX_ErrorBadParameter;
}
{
pComp = (OMX_COMPONENTTYPE *)malloc(sizeof(OMX_COMPONENTTYPE));
if (!pComp)
{
vcos_assert(0);
return OMX_ErrorInsufficientResources;
}
memset(pComp, 0, sizeof(OMX_COMPONENTTYPE));
hHandle = (OMX_HANDLETYPE)pComp;
pComp->nSize = sizeof(OMX_COMPONENTTYPE);
pComp->nVersion.nVersion = OMX_VERSION;
eError = vcil_out_create_component(ilcs_get_common(ilcs_service), hHandle, cComponentName);
if (eError == OMX_ErrorNone) {
// Check that all function pointers have been filled in.
// All fields should be non-zero.
int i;
uint32_t *p = (uint32_t *) pComp;
for(i=0; i<sizeof(OMX_COMPONENTTYPE)>>2; i++)
if(*p++ == 0)
eError = OMX_ErrorInvalidComponent;
if(eError != OMX_ErrorNone && pComp->ComponentDeInit)
pComp->ComponentDeInit(hHandle);
}
if (eError == OMX_ErrorNone) {
eError = pComp->SetCallbacks(hHandle,pCallBacks,pAppData);
if (eError != OMX_ErrorNone)
pComp->ComponentDeInit(hHandle);
}
if (eError == OMX_ErrorNone) {
*pHandle = hHandle;
}
else {
*pHandle = NULL;
free(pComp);
}
}
if (eError == OMX_ErrorNone) {
vcos_mutex_lock(&lock);
nActiveHandles++;
vcos_mutex_unlock(&lock);
}
return eError;
}