OpenMAXBellagio 0.9.3
library_entry_point.c
Go to the documentation of this file.
00001 
00031 #include <st_static_component_loader.h>
00032 #include <omx_volume_component.h>
00033 #include <omx_audiomixer_component.h>
00034 
00048 int omx_component_library_Setup(stLoaderComponentType **stComponents) {
00049   unsigned int i;
00050   DEBUG(DEB_LEV_FUNCTION_NAME, "In %s \n",__func__);
00051 
00052   if (stComponents == NULL) {
00053     DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s \n",__func__);
00054     return 2; // Return Number of Components - one for audio volume component
00055   }
00056 
00058   stComponents[0]->componentVersion.s.nVersionMajor = 1;
00059   stComponents[0]->componentVersion.s.nVersionMinor = 1;
00060   stComponents[0]->componentVersion.s.nRevision = 1;
00061   stComponents[0]->componentVersion.s.nStep = 1;
00062 
00063   stComponents[0]->name = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00064   if (stComponents[0]->name == NULL) {
00065     return OMX_ErrorInsufficientResources;
00066   }
00067   strcpy(stComponents[0]->name, VOLUME_COMP_NAME);
00068   stComponents[0]->name_specific_length = 1;
00069   stComponents[0]->constructor = omx_volume_component_Constructor;
00070 
00071   stComponents[0]->name_specific = calloc(stComponents[0]->name_specific_length,sizeof(char *));
00072   stComponents[0]->role_specific = calloc(stComponents[0]->name_specific_length,sizeof(char *));
00073 
00074   for(i=0;i<stComponents[0]->name_specific_length;i++) {
00075     stComponents[0]->name_specific[i] = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00076     if (stComponents[0]->name_specific[i] == NULL) {
00077       return OMX_ErrorInsufficientResources;
00078     }
00079   }
00080   for(i=0;i<stComponents[0]->name_specific_length;i++) {
00081     stComponents[0]->role_specific[i] = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00082     if (stComponents[0]->role_specific[i] == NULL) {
00083       return OMX_ErrorInsufficientResources;
00084     }
00085   }
00086 
00087   strcpy(stComponents[0]->name_specific[0], VOLUME_COMP_NAME);
00088   strcpy(stComponents[0]->role_specific[0], VOLUME_COMP_ROLE);
00089 
00090   stComponents[0]->nqualitylevels = VOLUME_QUALITY_LEVELS;
00091   stComponents[0]->multiResourceLevel = malloc(stComponents[0]->nqualitylevels * sizeof(multiResourceDescriptor *));
00092   for (i=0; i<stComponents[0]->nqualitylevels; i++) {
00093       stComponents[0]->multiResourceLevel[i] = malloc(sizeof(multiResourceDescriptor));
00094       stComponents[0]->multiResourceLevel[i]->CPUResourceRequested = volumeQualityLevels[i * 2];
00095       stComponents[0]->multiResourceLevel[i]->MemoryResourceRequested = volumeQualityLevels[i * 2 + 1];
00096   }
00097 
00099   stComponents[1]->componentVersion.s.nVersionMajor = 1;
00100   stComponents[1]->componentVersion.s.nVersionMinor = 1;
00101   stComponents[1]->componentVersion.s.nRevision = 1;
00102   stComponents[1]->componentVersion.s.nStep = 1;
00103 
00104   stComponents[1]->name = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00105   if (stComponents[1]->name == NULL) {
00106     return OMX_ErrorInsufficientResources;
00107   }
00108   strcpy(stComponents[1]->name, MIXER_COMP_NAME);
00109   stComponents[1]->name_specific_length = 1;
00110   stComponents[1]->constructor = omx_audio_mixer_component_Constructor;
00111 
00112   stComponents[1]->name_specific = calloc(stComponents[0]->name_specific_length,sizeof(char *));
00113   stComponents[1]->role_specific = calloc(stComponents[0]->name_specific_length,sizeof(char *));
00114 
00115   for(i=0;i<stComponents[1]->name_specific_length;i++) {
00116     stComponents[1]->name_specific[i] = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00117     if (stComponents[1]->name_specific[i] == NULL) {
00118       return OMX_ErrorInsufficientResources;
00119     }
00120   }
00121   for(i=0;i<stComponents[1]->name_specific_length;i++) {
00122     stComponents[1]->role_specific[i] = calloc(1, OMX_MAX_STRINGNAME_SIZE);
00123     if (stComponents[1]->role_specific[i] == NULL) {
00124       return OMX_ErrorInsufficientResources;
00125     }
00126   }
00127 
00128   strcpy(stComponents[1]->name_specific[0], MIXER_COMP_NAME);
00129   strcpy(stComponents[1]->role_specific[0], MIXER_COMP_ROLE);
00130 
00131   stComponents[1]->nqualitylevels = MIXER_QUALITY_LEVELS;
00132   stComponents[1]->multiResourceLevel = malloc(stComponents[1]->nqualitylevels * sizeof(multiResourceDescriptor *));
00133   for (i=0; i<stComponents[1]->nqualitylevels; i++) {
00134       stComponents[1]->multiResourceLevel[i] = malloc(sizeof(multiResourceDescriptor));
00135       stComponents[1]->multiResourceLevel[i]->CPUResourceRequested = mixerQualityLevels[i * 2];
00136       stComponents[1]->multiResourceLevel[i]->MemoryResourceRequested = mixerQualityLevels[i * 2 + 1];
00137   }
00138 
00139   DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s \n",__func__);
00140   return 2;
00141 }