00001
00030 #include <st_static_component_loader.h>
00031 #include <omx_camera_source_component.h>
00032 #include <string.h>
00033
00047 int omx_component_library_Setup(stLoaderComponentType **stComponents) {
00048 int i;
00049 OMX_ERRORTYPE err = OMX_ErrorNone;
00050
00051 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for camera component\n",__func__);
00052
00053 if (stComponents == NULL) {
00054 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for camera component, return code: %d\n",__func__, 1);
00055 return 1;
00056 }
00057
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
00064 stComponents[0]->name = (char* )calloc(1, OMX_MAX_STRINGNAME_SIZE);
00065 if (stComponents[0]->name == NULL) {
00066 err = OMX_ErrorInsufficientResources;
00067 goto ERR_HANDLE;
00068 }
00069 strncpy(stComponents[0]->name, "OMX.st.v4l.camera_source", OMX_MAX_STRINGNAME_SIZE);
00070 stComponents[0]->name[OMX_MAX_STRINGNAME_SIZE-1] = '\0';
00071
00072
00073 stComponents[0]->name_specific_length = 1;
00074 stComponents[0]->name_specific = (char **)calloc(stComponents[0]->name_specific_length, sizeof(char *));
00075 if (stComponents[0]->name_specific == NULL) {
00076 err = OMX_ErrorInsufficientResources;
00077 goto ERR_HANDLE;
00078 }
00079
00080 for (i=0;i<stComponents[0]->name_specific_length;i++) {
00081 stComponents[0]->name_specific[i] = (char* )calloc(1, OMX_MAX_STRINGNAME_SIZE);
00082 if (stComponents[0]->name_specific[i] == NULL) {
00083 err = OMX_ErrorInsufficientResources;
00084 goto ERR_HANDLE;
00085 }
00086 }
00087
00088 strncpy(stComponents[0]->name_specific[0], "OMX.st.v4l.camera_source", OMX_MAX_STRINGNAME_SIZE);
00089 stComponents[0]->name_specific[OMX_MAX_STRINGNAME_SIZE-1] = '\0';
00090
00091
00092 stComponents[0]->role_specific = (char **)calloc(stComponents[0]->name_specific_length, sizeof(char *));
00093 if (stComponents[0]->role_specific == NULL) {
00094 err = OMX_ErrorInsufficientResources;
00095 goto ERR_HANDLE;
00096 }
00097
00098 for (i=0;i<stComponents[0]->name_specific_length;i++) {
00099 stComponents[0]->role_specific[i] = (char* )calloc(1, OMX_MAX_STRINGNAME_SIZE);
00100 if (stComponents[0]->role_specific[i] == NULL) {
00101 err = OMX_ErrorInsufficientResources;
00102 goto ERR_HANDLE;
00103 }
00104 }
00105
00106 strncpy(stComponents[0]->role_specific[0], "v4l.camera_source", OMX_MAX_STRINGNAME_SIZE);
00107 stComponents[0]->role_specific[OMX_MAX_STRINGNAME_SIZE-1] = '\0';
00108
00109
00110 stComponents[0]->constructor = omx_camera_source_component_Constructor;
00111
00112 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for camera component, return code: %d\n",__func__, 1);
00113 return 1;
00114
00115 ERR_HANDLE:
00116 if (stComponents[0]->name != NULL) {
00117 free(stComponents[0]->name);
00118 stComponents[0]->name = NULL;
00119 }
00120
00121 if (stComponents[0]->name_specific != NULL) {
00122 for (i=0;i<stComponents[0]->name_specific_length;i++) {
00123 if (stComponents[0]->name_specific[i] != NULL) {
00124 free(stComponents[0]->name_specific[i]);
00125 }
00126 }
00127 free(stComponents[0]->name_specific);
00128 stComponents[0]->name_specific = NULL;
00129 }
00130
00131 if (stComponents[0]->role_specific != NULL) {
00132 for (i=0;i<stComponents[0]->name_specific_length;i++) {
00133 if (stComponents[0]->role_specific[i] != NULL) {
00134 free(stComponents[0]->role_specific[i]);
00135 }
00136 }
00137 free(stComponents[0]->role_specific);
00138 stComponents[0]->role_specific = NULL;
00139 }
00140
00141
00142 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for camera component, return code: 0x%X\n",__func__, err);
00143 return err;
00144 }