OMX_ERRORTYPE OMX_CONF_ListComponents() { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 i = 0; OMX_S8 cCompEnumName[256]; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "\nAvailable Components:\n\n"); /* Initialize OpenMax */ if (OMX_ErrorNone == (eError = OMX_Init())) { while (OMX_ErrorNone == eError) { /* loop through all enumerated components to determine if the component name specificed for the test is enumerated by the OMX core */ eError = OMX_ComponentNameEnum((OMX_STRING) cCompEnumName, 256, i); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "\t%s\n", cCompEnumName); i++; } } /* didn't find it */ OMX_Deinit(); return OMX_ErrorNone; }
OMX_BOOL OMX_CONF_ComponentExists(OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 i = 0; OMX_S8 cCompEnumName[256]; /* Initialize OpenMax */ if (OMX_ErrorNone == (eError = OMX_Init())) { while (OMX_ErrorNone == eError) { /* loop through all enumerated components to determine if the component name specificed for the test is enumerated by the OMX core */ eError = OMX_ComponentNameEnum((OMX_STRING) cCompEnumName, 256, i); if (OMX_ErrorNone == eError){ if (!strcmp((OMX_STRING) cCompEnumName, cComponentName)) { /* found it */ OMX_Deinit(); return OMX_TRUE; } } i++; } } /* didn't find it */ OMX_Deinit(); return OMX_FALSE; }
int main(int argc, char** argv) { int index; char name[256]; OMX_ERRORTYPE err = OMX_ErrorNone; err = OMX_Init(); if(err != OMX_ErrorNone) { DEBUG(DEB_LEV_ERR, "OMX_Init() failed\n"); exit(1); } index = 0; while(err == OMX_ErrorNone) { err = OMX_ComponentNameEnum(name, 256, index); if (err == OMX_ErrorNone) { printf("Component %d is %s\n", index, name); } index++; } printf("Hit any key\n"); getchar(); OMX_Deinit(); return 0; }
OMX_API OMX_ERRORTYPE TIOMX_ComponentNameEnum(OMX_OUT OMX_STRING cComponentName, OMX_IN OMX_U32 nNameLength, OMX_IN OMX_U32 nIndex) { ALOGV("TIOMX_ComponentNameEnum\n"); return OMX_ComponentNameEnum(cComponentName, nNameLength, nIndex); }
void AnatomyOMXClient::init() { OMX_HANDLETYPE handle = NULL; char componentName[256]; OMX_Init(); OMX_ComponentNameEnum(componentName, 256, 0); OMX_GetHandle(&handle, componentName, this, &AnatomyOMXClient::kCallbacks); CHECK(handle != NULL); mComponentHandle = handle; }
OMX_ERRORTYPE tiz::omxutil::list_comps (std::vector< std::string > &components) { OMX_ERRORTYPE error = OMX_ErrorNone; OMX_U32 index = 0; char comp_name[OMX_MAX_STRINGNAME_SIZE]; do { error = OMX_ComponentNameEnum ((OMX_STRING)comp_name, OMX_MAX_STRINGNAME_SIZE, index++); if (OMX_ErrorNone == error) { components.push_back (std::string (comp_name)); } } while (OMX_ErrorNone == error); return error; }
OMX_ERRORTYPE test_OMX_ComponentNameEnum() { char * name; int index; OMX_ERRORTYPE err = OMX_ErrorNone; DEBUG(DEFAULT_MESSAGES, "GENERAL TEST %s\n", __func__); name = malloc(OMX_MAX_STRINGNAME_SIZE); index = 0; while(1) { err = OMX_ComponentNameEnum (name, OMX_MAX_STRINGNAME_SIZE, index); if ((name != NULL) && (err == OMX_ErrorNone)) { DEBUG(DEFAULT_MESSAGES, "component %i is %s\n", index, name); } else break; if (err != OMX_ErrorNone) break; index++; } free(name); name = NULL; DEBUG(DEFAULT_MESSAGES, "GENERAL TEST %s result %i\n", __func__, err); return err; }
OMX_ERRORTYPE OMX_CONF_ComponentNameTest(OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_HANDLETYPE hComp = 0; OMX_U32 i = 0; OMX_BOOL bNameValid = OMX_FALSE; OMX_BOOL bFound = OMX_FALSE; OMX_S8 cCompEnumName[TEST_COMPONENT_NAME_SIZE]; OMX_CALLBACKTYPE sCallbacks; sCallbacks.EventHandler = ComponentNameTest_EventHandler; sCallbacks.EmptyBufferDone = ComponentNameTest_EmptyBufferDone; sCallbacks.FillBufferDone = ComponentNameTest_FillBufferDone; /* Initialize OpenMax */ eError = OMX_Init(); if (eError != OMX_ErrorNone) { goto OMX_CONF_TEST_BAIL; } while (OMX_ErrorNone == eError) { /* loop through all enumerated components to determine if the component name specificed for the test is enumerated by the OMX core */ eError = OMX_ComponentNameEnum((OMX_STRING) cCompEnumName, TEST_COMPONENT_NAME_SIZE, i); if (OMX_ErrorNone == eError) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "OMX_ComponenNameEnum enumerated %s at index %i\n", cCompEnumName, i); if (!strcmp((OMX_STRING) cCompEnumName, cComponentName)) { /* component name enumerated by OMX_CORE */ bFound = OMX_TRUE; eError = OMX_GetHandle(&hComp, (OMX_STRING) cCompEnumName, 0x0, &sCallbacks); if (eError == OMX_ErrorNone) { /* validate the first 4 characters of the name match the OMX standard */ if (!strncmp("OMX.", cComponentName, 4)) { bNameValid = OMX_TRUE; } eError = OMX_FreeHandle(hComp); } else { OMX_CONF_ErrorToString(eError, szDesc); OMX_OSAL_Trace(OMX_OSAL_TRACE_ERROR, "%s error=0x%X (%s) from OMX_GetHandle\n", cCompEnumName, eError, szDesc); } } } else if (OMX_ErrorNoMore != eError) { /* OMX_CORE reported unexpected error other than no more components */ OMX_CONF_ErrorToString(eError, szDesc); OMX_OSAL_Trace(OMX_OSAL_TRACE_ERROR, "unexepected error=0x%X (%s) from OMX_ComponenNameEnum\n", eError, szDesc); } i++; } if (OMX_ErrorNoMore == eError) { /* not an error, so clear the error code */ eError = OMX_ErrorNone; } OMX_CONF_TEST_BAIL: if (OMX_ErrorNone == eError) { eError = OMX_Deinit(); } else { OMX_Deinit(); } return eError; }