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);
109 *(line+index_readline) = fgetc(omxregistryfp);
110 if ((*(line+index_readline) ==
'\n') || (*(line+index_readline) ==
'\0')) {
115 *(line+index_readline) =
'\0';
119 if ((*line ==
' ') && (*(line+1) ==
'=')) {
123 strcpy(libname, line);
125 if((
handle = dlopen(libname, RTLD_NOW)) == NULL) {
130 if ((fptr = dlsym(
handle,
"omx_component_library_Setup")) == NULL) {
131 DEBUG(
DEB_LEV_ERR,
"the library %s is not compatible with ST static component loader - %s\n", libname, dlerror());
133 num_of_comp = (int)(*fptr)(NULL);
134 templateList = realloc(templateList, (listindex + num_of_comp + 1) *
sizeof (
stLoaderComponentType*));
135 templateList[listindex + num_of_comp] = NULL;
137 for (i = 0; i<num_of_comp; i++) {
140 (*fptr)(stComponentsTemp);
141 for (i = 0; i<num_of_comp; i++) {
142 templateList[listindex + i] = stComponentsTemp[i];
143 DEBUG(
DEB_LEV_FULL_SEQ,
"In %s comp name[%d]=%s\n",__func__,listindex + i,templateList[listindex + i]->name);
145 free(stComponentsTemp);
146 stComponentsTemp = NULL;
157 fclose(omxregistryfp);
180 while(templateList[i]) {
181 if(templateList[i]->name_requested){
182 free(templateList[i]->name_requested);
187 if(templateList[i]->name_specific[j]) {
188 free(templateList[i]->name_specific[j]);
191 if(templateList[i]->role_specific[j]){
192 free(templateList[i]->role_specific[j]);
197 if(templateList[i]->name_specific){
198 free(templateList[i]->name_specific);
201 if(templateList[i]->role_specific){
202 free(templateList[i]->role_specific);
205 if(templateList[i]->name){
206 free(templateList[i]->name);
207 templateList[i]->
name=NULL;
209 free(templateList[i]);
210 templateList[i] = NULL;
248 int componentPosition = -1;
257 while(templateList[i]) {
258 if(!strcmp(templateList[i]->name, cComponentName)) {
260 componentPosition = i;
264 if(!strcmp(templateList[i]->name_specific[j], cComponentName)) {
266 componentPosition = i;
270 if(componentPosition != -1) {
276 if (componentPosition == -1) {
277 DEBUG(
DEB_LEV_ERR,
"Component not found with current ST static component loader.\n");
284 if (templateList[componentPosition]->name_requested == NULL)
290 if (!openmaxStandComp) {
293 eError = templateList[componentPosition]->
constructor(openmaxStandComp,cComponentName);
296 *pHandle = openmaxStandComp;
303 free(openmaxStandComp);
304 openmaxStandComp = NULL;
310 *pHandle = openmaxStandComp;
325 if (priv->
loader != loader) {
350 unsigned int j, index = 0;
356 while(templateList[i]) {
357 if (index == nIndex) {
358 strncpy(cComponentName, templateList[i]->name, nNameLength);
363 if (templateList[i]->name_specific_length > 0) {
365 if (index == nIndex) {
366 strncpy(cComponentName,templateList[i]->name_specific[j], nNameLength);
400 unsigned int j, index;
401 unsigned int max_roles = *pNumRoles;
407 while (templateList[i]) {
408 if(!strcmp(templateList[i]->name, compName)) {
417 if (index < max_roles) {
418 strcpy ((
char*)*(roles+index), templateList[i]->role_specific[index]);
424 if(!strcmp(templateList[i]-> name_specific[j], compName)) {
432 strcpy ((
char*)*roles , templateList[i]->role_specific[j]);
443 DEBUG(
DEB_LEV_ERR,
"no component match in whole template list has been found\n");
467 int max_entries = *pNumComps;
472 while(templateList[i]) {
474 if (!strcmp(templateList[i]->role_specific[j], role)) {
475 if (compNames != NULL) {
476 if (num_comp < max_entries) {
477 strcpy((
char*)(compNames[num_comp]), templateList[i]->name);
486 *pNumComps = num_comp;