38 #define OMX_LOADERS_FILENAME ".omxloaders"
40 #ifndef OMX_LOADERS_DIRNAME
41 #define OMX_LOADERS_DIRNAME "/usr/lib/omxloaders/"
44 #ifndef INSTALL_PATH_STR
45 #define INSTALL_PATH_STR "/usr/local/lib/bellagio"
64 void *functionPointer;
66 char *libraryFileName = NULL;
68 char *omxloader_registry_filename;
71 int isFileExisting = 0;
72 int isDirExisting = 0;
76 isFileExisting =
exists(omxloader_registry_filename);
81 if (!isDirExisting && !isFileExisting) {
96 loaderFP = fopen(omxloader_registry_filename,
"r");
102 *(libraryFileName + index_readline) = fgetc(loaderFP);
103 if ((*(libraryFileName + index_readline) ==
'\n') || (*(libraryFileName + index_readline) ==
'\0')) {
108 *(libraryFileName + index_readline) =
'\0';
113 handle = dlopen(libraryFileName, RTLD_NOW);
116 DEBUG(
DEB_LEV_ERR,
"library %s dlopen error: %s\n", libraryFileName, dlerror());
120 if ((functionPointer = dlsym(
handle,
"setup_component_loader")) == NULL) {
121 DEBUG(
DEB_LEV_ERR,
"the library %s is not compatible - %s\n", libraryFileName, dlerror());
124 fptr = functionPointer;
128 if (loader == NULL) {
139 if (libraryFileName) {
140 free(libraryFileName);
147 while ((dp = readdir(dirp_name)) != NULL) {
148 int len = strlen(dp->d_name);
150 if(strncmp(dp->d_name+len-3,
".so", 3) == 0){
153 strcat(lib_absolute_path, dp->d_name);
154 handle = dlopen(lib_absolute_path, RTLD_NOW);
156 DEBUG(
DEB_LEV_ERR,
"library %s dlopen error: %s\n", lib_absolute_path, dlerror());
159 if ((functionPointer = dlsym(
handle,
"setup_component_loader")) == NULL) {
160 DEBUG(
DEB_LEV_ERR,
"the library %s is not compatible - %s\n", lib_absolute_path, dlerror());
163 fptr = functionPointer;
165 if (loader == NULL) {
180 if (loader == NULL) {
187 free(omxloader_registry_filename);