/*-----------------------------------------------------------------------
| MACRO DEFINITIONS: |
-----------------------------------------------------------------------*/
-#define CONFIGURE_PATH "/usr/etc"
-#define CONFIGURE_PATH_RETRY "/opt/etc"
/*-----------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS |
/* [Camera] matching table */
static conf_info_table conf_ctrl_camera_table[] = {
- { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
- { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
- { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
- { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
- { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
+ { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
{ "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
{ "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
{ "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
{ "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
- { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
+ { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
};
/* [Strobe] matching table */
{ "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
};
/* [Capture] matching table */
/* [Detect] matching table */
static conf_info_table conf_ctrl_detect_table[] = {
- { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
};
if (hcamcorder == NULL) {
}
-int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
+int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
{
- int ret = MM_ERROR_NONE;
- FILE* fd = NULL;
- char* conf_path = NULL;
+ int ret = MM_ERROR_NONE;
+ FILE *fd = NULL;
+ char conf_path[60] = {'\0',};
- _mmcam_dbg_log( "Opening...[%s]", ConfFile );
+ _mmcam_dbg_log("Opening...[%s]", ConfFile);
- mmf_return_val_if_fail( ConfFile, FALSE );
+ mmf_return_val_if_fail(ConfFile, FALSE);
- conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
+ snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
+ _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
- if( conf_path == NULL )
- {
- _mmcam_dbg_err( "malloc failed." );
- return MM_ERROR_CAMCORDER_LOW_MEMORY;
- }
-
- snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
- _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
+ fd = fopen(conf_path, "r");
+ if (fd == NULL) {
+ _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
- fd = fopen( conf_path, "r" );
- if( fd == NULL )
- {
- _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
- snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
- _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
- fd = fopen( conf_path, "r" );
- if( fd == NULL )
- {
- _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
+ snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
+ _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
+ fd = fopen(conf_path, "r");
+ if (fd == NULL) {
+ _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
}
}
- if( fd != NULL )
- {
- ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
- fclose( fd );
- }
- else
- {
- ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
- }
-
- if( conf_path != NULL )
- {
- free( conf_path );
- conf_path = NULL;
+ if (fd != NULL) {
+ ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
+ fclose(fd);
+ } else {
+ if (errno == ENOENT) {
+ ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ } else {
+ ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
+ }
}
- _mmcam_dbg_log( "Leave..." );
+ _mmcam_dbg_log("Leave...");
return ret;
}
+
int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
{
const unsigned int BUFFER_NUM_DETAILS = 256;