31 #include <sys/types.h>
86 char *registry_filename;
87 int index_readline = 0;
92 omxregistryfp = fopen(registry_filename,
"r");
93 if (omxregistryfp == NULL){
94 DEBUG(
DEB_LEV_ERR,
"Cannot open OpenMAX registry file %s\n", registry_filename);
97 free(registry_filename);
101 templateList[0] = NULL;
103 fseek(omxregistryfp, 0, 0);
110 c1 = fgetc(omxregistryfp);
111 if (c1 == EOF)
break;
112 *(line+index_readline) = c1;
113 if ((*(line+index_readline) ==
'\n') || (*(line+index_readline) ==
'\0')) {
118 *(line+index_readline) =
'\0';
122 if ((*line ==
' ') && (*(line+1) ==
'=')) {
126 strcpy(libname, line);
128 if((
handle = dlopen(libname, RTLD_NOW)) == NULL) {
133 if ((fptr = dlsym(
handle,
"omx_component_library_Setup")) == NULL) {
134 DEBUG(
DEB_LEV_ERR,
"the library %s is not compatible with ST static component loader - %s\n", libname, dlerror());
136 num_of_comp = (int)(*fptr)(NULL);
137 templateList = realloc(templateList, (listindex + num_of_comp + 1) *
sizeof (
stLoaderComponentType*));
138 templateList[listindex + num_of_comp] = NULL;
140 for (i = 0; i<num_of_comp; i++) {
143 (*fptr)(stComponentsTemp);
144 for (i = 0; i<num_of_comp; i++) {
145 templateList[listindex + i] = stComponentsTemp[i];
146 DEBUG(
DEB_LEV_FULL_SEQ,
"In %s comp name[%d]=%s\n",__func__,listindex + i,templateList[listindex + i]->name);
148 free(stComponentsTemp);
149 stComponentsTemp = NULL;
160 fclose(omxregistryfp);
183 while(templateList[i]) {
184 if(templateList[i]->name_requested){
185 free(templateList[i]->name_requested);
190 if(templateList[i]->name_specific[j]) {
191 free(templateList[i]->name_specific[j]);
194 if(templateList[i]->role_specific[j]){
195 free(templateList[i]->role_specific[j]);
200 if(templateList[i]->name_specific){
201 free(templateList[i]->name_specific);
204 if(templateList[i]->role_specific){
205 free(templateList[i]->role_specific);
208 if(templateList[i]->name){
209 free(templateList[i]->name);
210 templateList[i]->
name=NULL;
212 free(templateList[i]);
213 templateList[i] = NULL;
251 int componentPosition = -1;
260 while(templateList[i]) {
261 if(!strcmp(templateList[i]->name, cComponentName)) {
263 componentPosition = i;
267 if(!strcmp(templateList[i]->name_specific[j], cComponentName)) {
269 componentPosition = i;
273 if(componentPosition != -1) {
279 if (componentPosition == -1) {
280 DEBUG(
DEB_LEV_ERR,
"Component not found with current ST static component loader.\n");
287 if (templateList[componentPosition]->name_requested == NULL)
293 if (!openmaxStandComp) {
296 eError = templateList[componentPosition]->
constructor(openmaxStandComp,cComponentName);
299 *pHandle = openmaxStandComp;
306 free(openmaxStandComp);
307 openmaxStandComp = NULL;
313 *pHandle = openmaxStandComp;
328 if (priv->
loader != loader) {
353 unsigned int j, index = 0;
359 while(templateList[i]) {
360 if (index == nIndex) {
361 strncpy(cComponentName, templateList[i]->name, nNameLength);
366 if (templateList[i]->name_specific_length > 0) {
368 if (index == nIndex) {
369 strncpy(cComponentName,templateList[i]->name_specific[j], nNameLength);
403 unsigned int j, index;
404 unsigned int max_roles = *pNumRoles;
410 while (templateList[i]) {
411 if(!strcmp(templateList[i]->name, compName)) {
420 if (index < max_roles) {
421 strcpy ((
char*)*(roles+index), templateList[i]->role_specific[index]);
427 if(!strcmp(templateList[i]-> name_specific[j], compName)) {
435 strcpy ((
char*)*roles , templateList[i]->role_specific[j]);
446 DEBUG(
DEB_LEV_ERR,
"no component match in whole template list has been found\n");
470 int max_entries = *pNumComps;
475 while(templateList[i]) {
477 if (!strcmp(templateList[i]->role_specific[j], role)) {
478 if (compNames != NULL) {
479 if (num_comp < max_entries) {
480 strcpy((
char*)(compNames[num_comp]), templateList[i]->name);
489 *pNumComps = num_comp;