41 static int globalTimestamp = 0;
53 listOfcomponentRegistered[i].
index = -1;
56 globalComponentList = malloc(
sizeof(
ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
57 globalWaitingComponentList = malloc(
sizeof(
ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
58 memset(globalComponentList,
'\0',
sizeof(
ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
59 memset(globalWaitingComponentList,
'\0',
sizeof(
ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
70 while (listOfcomponentRegistered[i].component_name != NULL) {
71 if (!strcmp(listOfcomponentRegistered[i].component_name, name)) {
78 if (listOfcomponentRegistered[i].component_name == NULL) {
81 strcpy(listOfcomponentRegistered[i].component_name, name);
101 while(globalComponentList[i] != NULL) {
103 clearList(&globalWaitingComponentList[i]);
123 globalComponentList[index] = *list;
125 globalWaitingComponentList[index] = *list;
131 (*list)->openmaxStandComp = openmaxStandComp;
132 (*list)->timestamp = globalTimestamp;
134 (*list)->nGroupPriority = omx_base_component_Private->
nGroupPriority;
135 (*list)->next = NULL;
139 componentTemp = *list;
140 while(componentTemp->
next) {
141 componentTemp = componentTemp->
next;
144 if (!componentNext) {
148 componentTemp->
next = componentNext;
149 componentNext->
next = NULL;
151 componentNext->
timestamp = globalTimestamp;
169 DEBUG(
DEB_LEV_ERR,
"In %s, the resource manager is not initialized\n", __func__);
172 componentTemp = *list;
173 componentPrev = *list;
174 while(componentTemp) {
176 if (componentTemp == *list) {
177 *list = (*list)->
next;
180 componentPrev->
next = componentTemp->
next;
186 if (componentTemp != *list) {
187 componentPrev = componentPrev->
next;
189 componentTemp = componentTemp->
next;
193 DEBUG(
DEB_LEV_ERR,
"In %s, the specified component does not exist\n", __func__);
215 componentTemp = list;
216 while(componentTemp) {
218 componentTemp = componentTemp->
next;
236 componentTemp = *list;
237 while(componentTemp) {
238 componentPrev = componentTemp;
239 componentTemp = componentTemp->
next;
257 printf(
"The list is empty\n");
261 while (componentTemp) {
264 printf(
"Name %s ", omx_base_component_Private->
name);
271 componentTemp = componentTemp->
next;
291 componentTemp = list;
292 componentCandidate = NULL;
293 while (componentTemp) {
298 if (componentCandidate) {
300 componentCandidate = componentTemp;
303 componentCandidate = componentTemp;
306 componentTemp = componentTemp->
next;
308 *oldest_component_preemptable = componentCandidate;
325 (openmaxStandComp, omx_base_component_Private->
callbackData,
355 int indexComponent = -1;
360 if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->
name)) {
362 indexComponent = listOfcomponentRegistered[i].
index;
367 if (indexComponent <0) {
372 if (
numElemInList(globalComponentList[indexComponent]) >= listOfcomponentRegistered[i].max_components) {
410 int indexComponent = -1;
416 if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->
name)) {
418 indexComponent = listOfcomponentRegistered[i].
index;
423 if (indexComponent <0) {
428 if (!globalComponentList[indexComponent]) {
429 DEBUG(
DEB_LEV_ERR,
"In %s, the resource manager is not initialized\n", __func__);
437 if(
numElemInList(globalWaitingComponentList[indexComponent])) {
438 openmaxWaitingComp = globalWaitingComponentList[indexComponent]->
openmaxStandComp;
460 int indexComponent = -1;
466 if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->
name)) {
468 indexComponent = listOfcomponentRegistered[i].
index;
473 if (indexComponent <0) {
479 addElemToList(&globalWaitingComponentList[indexComponent], openmaxStandComp, listOfcomponentRegistered[i].index,
OMX_TRUE);
493 int indexComponent = -1;
499 if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->
name)) {
506 if (indexComponent <0) {
NameIndexType * listOfcomponentRegistered
OMX_ERRORTYPE clearList(ComponentListType **list)
#define DEB_LEV_SIMPLE_SEQ
ComponentListType ** globalWaitingComponentList
#define DEBUG(n, fmt, args...)
OMX_CALLBACKTYPE * callbacks
OMX_ERRORTYPE RM_RegisterComponent(char *name, int max_components)
#define OMX_SendCommand(hComponent,Cmd,nParam,pCmdData)
OMX_ERRORTYPE preemptComponent(OMX_COMPONENTTYPE *openmaxStandComp)
ComponentListType ** globalComponentList
OMX_ERRORTYPE addElemToList(ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp, int index, OMX_BOOL bIsWaiting)
#define OMX_MAX_STRINGNAME_SIZE
OMX_ERRORTYPE RM_getResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE RM_removeFromWaitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE RM_Deinit()
OMX_PTR pComponentPrivate
#define DEB_LEV_FUNCTION_NAME
OMX_COMPONENTTYPE * openmaxStandComp
OMX_ERRORTYPE RM_waitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
void RM_printList(ComponentListType *list, int viewFlag)
int numElemInList(ComponentListType *list)
OMX_ERRORTYPE RM_releaseResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE(* EventHandler)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_EVENTTYPE eEvent, OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2, OMX_IN OMX_PTR pEventData)
#define MAX_COMPONENTS_TYPES_HANDLED
int searchLowerPriority(ComponentListType *list, int current_priority, ComponentListType **oldest_component_preemptable)
OMX_ERRORTYPE removeElemFromList(ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp)