/*-----------------------------------------------------------------------
| LOCAL VARIABLE DEFINITIONS |
-----------------------------------------------------------------------*/
-#define DEFAULT_AUDIO_BUFFER_INTERVAL 50
+#define DEFAULT_AUDIO_BUFFER_INTERVAL 50
+#define DEFAULT_ENCODED_PREVIEW_BITRATE (1024*1024*4)
+#define MMCAMCORDER_CONF_FILEPATH_LENGTH 128
+#define MMCAMCORDER_BUFFER_LINE_MAX 256
+
+#define BUFFER_NUM_DETAILS 256
+#define BUFFER_NUM_TOKEN 64
char *get_new_string(char* src_string)
{
int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info)
{
int category_num = 0;
- int info_table_size = sizeof(conf_info_table);
+ size_t info_table_size = sizeof(conf_info_table);
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
0,
};
+ /* MJPEG decoder element default value */
+ static type_element _videodecoder_element_mjpeg_default = {
+ "VideodecoderElementMJPEG",
+ "jpegdec",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* VP8 decoder element default value */
+ static type_element _videodecoder_element_vp8_default = {
+ "VideodecoderElementVP8",
+ "vp8dec",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* VP9 decoder element default value */
+ static type_element _videodecoder_element_vp9_default = {
+ "VideodecoderElementVP9",
+ "vp9dec",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
/* Record sink element default value */
static type_element _recordsink_element_default = {
"RecordsinkElement",
/* [General] matching table */
static conf_info_table conf_main_general_table[] = {
- { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
- { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
- { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
- { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
+ { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
+ { "PlatformPrivilegeCamera", CONFIGURE_VALUE_STRING, {NULL} },
+ { "LogLevel", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_LOG_LEVEL_INFO} },
+ { "NetworkCameraHALName", CONFIGURE_VALUE_STRING, {NULL} },
};
/* [VideoInput] matching table */
static conf_info_table conf_main_video_input_table[] = {
- { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
- { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
- { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
- { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
- { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
- { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
- { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
+ { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
+ { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
+ { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "MeasurePreviewFPS", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "DefaultEncodedPreviewBitrate", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_ENCODED_PREVIEW_BITRATE} },
+ { "UpdateCapsByStreamRotation", CONFIGURE_VALUE_INT, {.value_int = 0} },
};
/* [AudioInput] matching table */
{ "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
{ "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
+ { "VideodecoderElementMJPEG",CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_mjpeg_default} },
+ { "VideodecoderElementVP8", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_vp8_default} },
+ { "VideodecoderElementVP9", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_vp9_default} },
{ "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
};
/* [Capture] matching table */
static conf_info_table conf_main_capture_table[] = {
- { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
- { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "CaptureMode", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAPTURE_MODE_ENCODEBIN} },
{ "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
{ "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
};
{ "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
- { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
+ { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} }
};
/* [VideoEncoder] matching table */
{ "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} },
+ { "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} },
- { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
+ { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "SupportExtraPreview", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "ExtraPreviewMode", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_EXTRA_PREVIEW_MODE_CAMERA_CONTROL} },
+ { "AltVideosrcElement", CONFIGURE_VALUE_ELEMENT, {NULL} }, /* The alternative of videosrc element, it will be used instead of "VideosrcElement" if exists. */
+ { "AltUseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = -1} }, /* The alternative of "UseZeroCopyFormat", it will be used if it's not default(-1) value. */
+ { "VideoFilterElement", CONFIGURE_VALUE_ELEMENT, {NULL} }, /* The video filter element which is placed between videosrc and videosink elements. */
+ { "VideoFilterCropX", CONFIGURE_VALUE_INT, {.value_int = 0} }, /* The VideoFilterElement is existed and these values are valid, they will be set to "crop" property. */
+ { "VideoFilterCropY", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilterCropW", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilterCropH", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilter2Element", CONFIGURE_VALUE_ELEMENT, {NULL} },
+ { "VideoFilter2CropX", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilter2CropY", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilter2CropW", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "VideoFilter2CropH", CONFIGURE_VALUE_INT, {.value_int = 0} }
};
/* [Strobe] matching table */
{ "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "StrobeBrightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
};
/* [Effect] matching table */
static conf_info_table conf_ctrl_effect_table[] = {
- { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
- { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
- { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
- { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
+ { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "WhiteBalanceTemperature", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "WhiteBalanceTemperatureStep", CONFIGURE_VALUE_INT, {.value_int = 1} }
};
/* [Photograph] matching table */
{ "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
{ "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
{ "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FocusLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
{ "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
{ "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {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} },
+ { "Gain", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "GainStep", CONFIGURE_VALUE_INT, {.value_int = 1} }
};
/* [Capture] matching table */
{ "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
};
- _mmcam_dbg_log("Entered...");
+ MMCAM_LOG_INFO("Entered...");
if (type == CONFIGURE_TYPE_MAIN) {
hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
}
configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
- if (configure_info->info == NULL) {
- _mmcam_dbg_err("category info alloc failed : type %d", type);
- return MM_ERROR_CAMCORDER_LOW_MEMORY;
- }
- _mmcam_dbg_log("Done.");
+ MMCAM_LOG_INFO("Done.");
return MM_ERROR_NONE;
}
{
int ret = MM_ERROR_NONE;
FILE *fp = NULL;
- char conf_path[60] = {'\0',};
+ char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
- _mmcam_dbg_log("Opening...[%s]", ConfFile);
+ MMCAM_LOG_INFO("Opening...[%s]", ConfFile);
mmf_return_val_if_fail(ConfFile, FALSE);
snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
- _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
+ MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
fp = fopen(conf_path, "r");
if (!fp) {
- _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
+ MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path);
snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
- _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
+ MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
fp = fopen(conf_path, "r");
if (!fp) {
- _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
- ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno);
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
}
}
- if (fp) {
- ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
- fclose(fp);
- }
+ ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
- _mmcam_dbg_log("Leave [0x%x]", ret);
+ fclose(fp);
+
+ MMCAM_LOG_INFO("Leave [0x%x]", ret);
return ret;
}
int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
{
- const unsigned int BUFFER_NUM_DETAILS = 256;
- const unsigned int BUFFER_NUM_TOKEN = 20;
- size_t BUFFER_LENGTH_STRING = 256;
- const char* delimiters = " |=,\t\n";
+ size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
+ const char* delimiters = " |=,\t\r\n";
int i = 0;
int ret = MM_ERROR_NONE;
int read_main = 0;
char *buffer_string = NULL;
- char *buffer_details[BUFFER_NUM_DETAILS];
- char *buffer_token[BUFFER_NUM_TOKEN];
+ char *buffer_details[BUFFER_NUM_DETAILS] = {NULL, };
+ char *buffer_token[BUFFER_NUM_TOKEN] = {NULL, };
char *token = NULL;
char *category_name = NULL;
char *detail_string = NULL;
camera_conf *new_conf = NULL;
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
*configure_info = NULL;
new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
- if (new_conf == NULL) {
- _mmcam_dbg_err("new_conf alloc failed : %zu", sizeof(camera_conf));
- return MM_ERROR_CAMCORDER_LOW_MEMORY;
- }
-
- buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
- if (buffer_string == NULL) {
- _mmcam_dbg_err("buffer_string alloc failed : %zu", sizeof(char) * BUFFER_LENGTH_STRING);
- g_free(new_conf);
- return MM_ERROR_CAMCORDER_LOW_MEMORY;
- }
+ buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size);
new_conf->type = type;
ret = _mmcamcorder_conf_init(handle, type, new_conf);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("conf init failed 0x%x", ret);
+ MMCAM_LOG_ERROR("conf init failed 0x%x", ret);
g_free(new_conf);
g_free(buffer_string);
return ret;
while (!feof(fp)) {
if (read_main == 0) {
- length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
- /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
+ buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
+ length_read = getline(&buffer_string, &buffer_line_size, fp);
+ if (length_read < 1) {
+ MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
+ continue;
+ }
+
+ buffer_string[--length_read] = '\0'; /* remove new line character */
+
+ MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string);
count_token = 0;
token = strtok_r(buffer_string, delimiters, &user_ptr);
if ((token) && (token[0] == ';') && (length_read > -1)) {
- /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
+ MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
continue;
}
while (token) {
- /*_mmcam_dbg_log("token : [%s]", token);*/
+ MMCAM_LOG_VERBOSE("token : \"%s\"", token);
buffer_token[count_token] = token;
count_token++;
token = strtok_r(NULL, delimiters, &user_ptr);
if (*buffer_token[0] == ';') {
/* Comment */
- /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
+ MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
} else if (*buffer_token[0] == '[') {
/* Main Category */
category_name = get_new_string(buffer_token[0]);
if (category_name == NULL) {
- _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
+ MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]);
continue;
}
count_details = 0;
while (!feof(fp)) {
- length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
- /*_mmcam_dbg_log("Read Detail Line : [%s], read length : [%d]", buffer_string, length_read);*/
+ length_read = getline(&buffer_string, &buffer_line_size, fp);
+ if (length_read < 1) {
+ MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
+ continue;
+ }
+
+ buffer_string[--length_read] = '\0'; /* remove new line character */
+
+ MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read);
detail_string = get_new_string(buffer_string);
token = strtok_r(buffer_string, delimiters, &user_ptr);
if (token && token[0] != ';' && length_read > -1) {
- /*_mmcam_dbg_log("token : [%s]", token);*/
+ MMCAM_LOG_VERBOSE("token : [%s]", token);
if (token[0] == '[') {
read_main = 1;
buffer_token[0] = token;
}
}
- /*_mmcam_dbg_log("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);*/
+ MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);
if (count_details == 0) {
- _mmcam_dbg_warn("category %s has no detail value... skip this category...", category_name);
+ MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name);
SAFE_G_FREE(category_name);
continue;
}
if (category != -1) {
_mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
- buffer_details, category, count_details);
+ buffer_details, category, count_details);
} else {
- _mmcam_dbg_warn("No matched category[%s],type[%d]... check it.", category_name, type);
+ MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type);
}
/* Free memory */
SAFE_G_FREE(buffer_string);
- /*_mmcam_dbg_log("Done.");*/
+ /*MMCAM_LOG_INFO("Done.");*/
return MM_ERROR_NONE;
}
type_string_array *temp_string_array = NULL;
type_element2 *temp_element = NULL;
- _mmcam_dbg_log("Entered...");
+ MMCAM_LOG_INFO("Entered...");
mmf_return_if_fail(temp_conf);
for (i = 0 ; i < category_num ; i++) {
if (temp_conf->info[i]) {
for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
- if (temp_conf->info[i]->detail_info[j] == NULL)
+ if (temp_conf->info[i]->detail_info[j] == NULL) {
+ MMCAM_LOG_WARNING("[%d][%d][%d] -> NULL", temp_conf->type, i, j);
continue;
+ }
if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
switch (type) {
}
break;
default:
- _mmcam_dbg_warn("unknown type %d", type);
+ MMCAM_LOG_WARNING("unknown type %d", type);
break;
}
}
SAFE_G_FREE((*configure_info)->info);
SAFE_G_FREE((*configure_info));
- _mmcam_dbg_log("Done.");
+ MMCAM_LOG_INFO("Done.");
}
int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (hcamcorder == NULL) {
- _mmcam_dbg_err("handle is NULL");
+ MMCAM_LOG_ERROR("handle is NULL");
return FALSE;
}
- /*_mmcam_dbg_log("Entered...");*/
+ /*MMCAM_LOG_INFO("Entered...");*/
mmf_return_val_if_fail(name, FALSE);
if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
- _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
+ MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
return FALSE;
}
- /*_mmcam_dbg_log("Number of value : [%d]", count_value);*/
+ /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/
if (type == CONFIGURE_TYPE_MAIN) {
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
*value_type = hcamcorder->conf_main_info_table[category][i].value_type;
- /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
+ /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
return TRUE;
}
}
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
*value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
- /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
+ /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
return TRUE;
}
}
int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
{
- const int BUFFER_NUM_TOKEN = 256;
-
int i = 0;
int j = 0;
int count_token;
int value_type;
char *token = NULL;
- char *buffer_token[BUFFER_NUM_TOKEN];
+ char *buffer_token[BUFFER_NUM_TOKEN] = {NULL, };
char *user_ptr = NULL;
- const char *delimiters = " |=,\t\n";
- const char *delimiters_sub = " |\t\n";
- const char *delimiters_3rd = "|\n";
+ const char *delimiters = " |=,\t\r\n";
+ const char *delimiters_sub = " |\t\r\n";
+ const char *delimiters_3rd = "|\r\n";
mmf_return_val_if_fail(info && buffer_details, FALSE);
- (*info) = (conf_detail*)g_malloc0(sizeof(conf_detail));
- if (*info == NULL) {
- _mmcam_dbg_err("info allo failed");
- return FALSE;
- }
+ (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail));
(*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
(*info)->count = count_details;
- if ((*info)->detail_info == NULL) {
- _mmcam_dbg_err("detail_info alloc failed");
- g_free(*info);
- *info = NULL;
- return FALSE;
- }
-
for (i = 0 ; i < count_details ; i++) {
- /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
+ if (!buffer_details[i]) {
+ MMCAM_LOG_WARNING("t[%d],cat[%d],index[%d]- NULL > skip", type, category, i);
+ continue;
+ }
+
+ MMCAM_LOG_VERBOSE("Read line \"%s\"", buffer_details[i]);
count_token = 0;
token = strtok_r(buffer_details[i], delimiters, &user_ptr);
count_token++;
} else {
(*info)->detail_info[i] = NULL;
- _mmcam_dbg_warn("No token... check it.[%s]", buffer_details[i]);
+ MMCAM_LOG_WARNING("No token... check it.[%s]", buffer_details[i]);
continue;
}
if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
(*info)->detail_info[i] = NULL;
- _mmcam_dbg_warn("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
+ MMCAM_LOG_WARNING("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
continue;
}
token = strtok_r(NULL, delimiters, &user_ptr);
while (token) {
buffer_token[count_token] = token;
- /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
+ MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
count_token++;
token = strtok_r(NULL, delimiters, &user_ptr);
}
if (count_token < 2) {
(*info)->detail_info[i] = NULL;
- _mmcam_dbg_warn("Number of token is too small... check it.[%s]", buffer_details[i]);
+ MMCAM_LOG_WARNING("Number of token is too small... check it.[%s]", buffer_details[i]);
continue;
}
} else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
token = strtok_r(NULL, delimiters_sub, &user_ptr);
while (token) {
buffer_token[count_token] = token;
- /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
+ MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
count_token++;
token = strtok_r(NULL, delimiters_sub, &user_ptr);
}
if (token) {
g_strchug(token);
buffer_token[count_token] = token;
- /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
+ MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
count_token++;
}
}
if (count_token < 2) {
(*info)->detail_info[i] = NULL;
- _mmcam_dbg_warn("No string value... check it.[%s]", buffer_details[i]);
+ MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]);
continue;
}
}
type_int2* new_int;
new_int = (type_int2*)g_malloc0(sizeof(type_int2));
- if (new_int == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int->name = get_new_string(buffer_token[0]);
new_int->value = atoi(buffer_token[1]);
(*info)->detail_info[i] = (void*)new_int;
- /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
+ MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value);
break;
}
case CONFIGURE_VALUE_INT_RANGE:
type_int_range* new_int_range;
new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
- if (new_int_range == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_range->name = get_new_string(buffer_token[0]);
new_int_range->min = atoi(buffer_token[1]);
new_int_range->max = atoi(buffer_token[2]);
new_int_range->default_value = atoi(buffer_token[3]);
(*info)->detail_info[i] = (void*)new_int_range;
- /*
- _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
+
+ MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
new_int_range->name,
new_int_range->min,
new_int_range->max,
new_int_range->default_value);
- */
break;
}
case CONFIGURE_VALUE_INT_ARRAY:
type_int_array* new_int_array;
new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
- if (new_int_array == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_array->name = get_new_string(buffer_token[0]);
new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
- if (new_int_array->value == NULL) {
- SAFE_G_FREE(new_int_array->name);
- SAFE_G_FREE(new_int_array);
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_array->count = count_value;
- /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
+ MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name);
for (j = 0 ; j < count_value ; j++) {
new_int_array->value[j] = atoi(buffer_token[j+1]);
- /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
+ MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]);
}
new_int_array->default_value = atoi(buffer_token[count_token-1]);
- /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
+ MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value);
(*info)->detail_info[i] = (void*)new_int_array;
break;
type_int_pair_array* new_int_pair_array;
new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
- if (new_int_pair_array == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_pair_array->name = get_new_string(buffer_token[0]);
new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
- if (new_int_pair_array->value[0] == NULL) {
- SAFE_G_FREE(new_int_pair_array->name);
- SAFE_G_FREE(new_int_pair_array);
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
- if (new_int_pair_array->value[1] == NULL) {
- SAFE_G_FREE(new_int_pair_array->value[0]);
- SAFE_G_FREE(new_int_pair_array->name);
- SAFE_G_FREE(new_int_pair_array);
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_int_pair_array->count = count_value;
- /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
+ MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);
for (j = 0 ; j < count_value ; j++) {
new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
- /*
- _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
+
+ MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j,
new_int_pair_array->value[0][j],
new_int_pair_array->value[1][j]);
- */
}
new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
- /*
- _mmcam_dbg_log(" default value[%d,%d]",
+
+ MMCAM_LOG_VERBOSE(" default value[%d,%d]",
new_int_pair_array->default_value[0],
new_int_pair_array->default_value[1]);
- */
+
(*info)->detail_info[i] = (void*)new_int_pair_array;
break;
}
type_string2* new_string;
new_string = (type_string2*)g_malloc0(sizeof(type_string2));
- if (new_string == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_string->name = get_new_string(buffer_token[0]);
new_string->value = get_new_string(buffer_token[1]);
(*info)->detail_info[i] = (void*)new_string;
- /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
+ MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value);
break;
}
case CONFIGURE_VALUE_STRING_ARRAY:
type_string_array* new_string_array;
new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
- if (new_string_array == NULL)
- break;
-
new_string_array->name = get_new_string(buffer_token[0]);
new_string_array->count = count_value;
new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
- if (new_string_array->value == NULL) {
- SAFE_G_FREE(new_string_array->name);
- SAFE_G_FREE(new_string_array);
- _mmcam_dbg_err("allocation failed");
- break;
- }
- /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
+
+ MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name);
+
for (j = 0 ; j < count_value ; j++) {
new_string_array->value[j] = get_new_string(buffer_token[j+1]);
- /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
+ MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]);
}
new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
- /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
+
+ MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value);
+
(*info)->detail_info[i] = (void*)new_string_array;
break;
}
{
type_element2* new_element;
+ j = 0;
new_element = (type_element2*)g_malloc0(sizeof(type_element2));
- if (new_element == NULL) {
- _mmcam_dbg_err("allocation failed");
- break;
- }
new_element->name = get_new_string(buffer_token[0]);
new_element->element_name = get_new_string(buffer_token[1]);
new_element->count_int = atoi(buffer_token[2]);
new_element->value_int = NULL;
new_element->count_string = atoi(buffer_token[3]);
new_element->value_string = NULL;
- /*
- _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
+
+ MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
- */
/* add int values */
if (new_element->count_int > 0 && new_element->count_int <= 30) {
new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
- if (new_element->value_int) {
- for (j = 0 ; j < new_element->count_int ; j++) {
- new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
- if (new_element->value_int[j]) {
- new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
- new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
- } else {
- _mmcam_dbg_err("allocation failed");
- }
- /*
- _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
- j, new_element->value_int[j]->name, new_element->value_int[j]->value);
- */
- }
- } else {
- _mmcam_dbg_err("allocation failed");
+ for ( ; j < new_element->count_int ; j++) {
+ new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
+ new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
+ new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
+
+ MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]",
+ j, new_element->value_int[j]->name, new_element->value_int[j]->value);
}
- } else {
- /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
- new_element->value_int = NULL;
}
/* add string values */
if (new_element->count_string > 0 && new_element->count_string <= 30 &&
new_element->count_int >= 0 && new_element->count_int <= 30) {
new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
- if (new_element->value_string) {
- for ( ; j < new_element->count_string + new_element->count_int ; j++) {
- new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
- if (new_element->value_string[j-new_element->count_int]) {
- new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
- new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
- /*
- _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
- j-new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value);
- */
- } else {
- _mmcam_dbg_err("allocation failed");
- }
- }
- } else {
- _mmcam_dbg_err("malloc failed : %zu", sizeof(type_string2*)*(new_element->count_string));
+ for ( ; j < new_element->count_string + new_element->count_int ; j++) {
+ new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
+ new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
+ new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
+
+ MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]",
+ j - new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value);
}
- } else {
- /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
- new_element->value_string = NULL;
}
(*info)->detail_info[i] = (void*)new_element;
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
*value = ((type_int*)(info->detail_info[i]))->value;
- /* _mmcam_dbg_log("Get[%s] int[%d]", name, *value); */
+ MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value);
return TRUE;
}
}
}
if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
- /*_mmcam_dbg_log("Get[%s] int[%d]", name, *value);*/
+ MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value);
return TRUE;
}
- _mmcam_dbg_err("Faild to get int... check it...Category[%d],Name[%s]", category, name);
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
*value = (type_int_range*)(info->detail_info[i]);
- /*
- _mmcam_dbg_log("Get[%s] int range - min[%d],max[%d],default[%d]",
+ MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]",
name, (*value)->min, (*value)->max, (*value)->default_value);
- */
return TRUE;
}
}
*value = NULL;
- /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
-int
-_mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
+int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
{
int i, count;
conf_detail* info;
- /*_mmcam_dbg_log("Entered... category[%d],name[%s]", category, name);*/
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
*value = (type_int_array*)(info->detail_info[i]);
- /*
- _mmcam_dbg_log("Get[%s] int array - [%x],count[%d],default[%d]",
+ MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]",
name, (*value)->value, (*value)->count, (*value)->default_value);
- */
return TRUE;
}
}
*value = NULL;
- /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
*value = (type_int_pair_array*)(info->detail_info[i]);
- /*
- _mmcam_dbg_log("Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
+ MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]",
name, (*value)->value[0], (*value)->value[1], (*value)->count,
(*value)->default_value[0], (*value)->default_value[1]);
- */
return TRUE;
}
}
*value = NULL;
- /*_mmcam_dbg_warn("Faild to get int pair array... check it...Category[%d],Name[%s]", category, name);*/
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
*value = ((type_string*)(info->detail_info[i]))->value;
- /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
+ MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL");
return TRUE;
}
}
}
if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
- /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
+ MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL");
return TRUE;
}
- _mmcam_dbg_err("Faild to get string... check it...Category[%d],Name[%s]", category, name);
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
-int
-_mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
+int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
{
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
*value = (type_string_array*)(info->detail_info[i]);
- /*
- _mmcam_dbg_log("Get[%s] string array - [%x],count[%d],default[%s]",
+ MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]",
name, (*value)->value, (*value)->count, (*value)->default_value);
- */
return TRUE;
}
}
*value = NULL;
- /*_mmcam_dbg_warn("Faild to get string array... check it...Category[%d],Name[%s]", category, name);*/
+ MMCAM_LOG_DEBUG("Failed to get [%s]", name);
return FALSE;
}
int i, count;
conf_detail* info;
- /* _mmcam_dbg_log("Entered... category[%d], ame[%s]", category, name); */
+ MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
mmf_return_val_if_fail(configure_info, FALSE);
mmf_return_val_if_fail(name, FALSE);
if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
*element = (type_element*)(info->detail_info[i]);
- /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
+ MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element);
return TRUE;
}
}
}
if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
- /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
+ MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element);
return TRUE;
}
- _mmcam_dbg_warn("Faild to get element name... check it...Category[%d],Name[%s]", category, name);
+ MMCAM_LOG_ERROR("Failed to get [%s]", name);
return FALSE;
}
-int
-_mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
+int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
{
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(element, FALSE);
*value = element->element_name;
- /* _mmcam_dbg_log("Get element name : [%s]", *value); */
+ MMCAM_LOG_DEBUG("Get element name : [%s]", *value);
return TRUE;
}
-int
-_mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
+int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
{
int i;
- /* _mmcam_dbg_log( "Entered..." ); */
-
mmf_return_val_if_fail(element, FALSE);
mmf_return_val_if_fail(name, FALSE);
for (i = 0 ; i < element->count_int ; i++) {
if (!strcmp(element->value_int[i]->name, name)) {
*value = element->value_int[i]->value;
- /* _mmcam_dbg_log("Get[%s] element int[%d]", name, *value); */
+ MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value);
return TRUE;
}
}
- _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
+ MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
element->name, name, element->count_int);
return FALSE;
}
-int
-_mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
+int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
{
int i;
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(element, FALSE);
mmf_return_val_if_fail(name, FALSE);
for (i = 0 ; i < element->count_string ; i++) {
if (!strcmp(element->value_string[i]->name, name)) {
*value = element->value_string[i]->value;
- /*_mmcam_dbg_log("Get[%s] element string[%s]", name, *value);*/
+ MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value);
return TRUE;
}
}
- _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
+ MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
element->name, name, element->count_string);
return FALSE;
}
-int
-_mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
+int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
{
int i;
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(gst, FALSE);
mmf_return_val_if_fail(element, FALSE);
if (element->count_int == 0) {
- /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
+ MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name );
} else {
if (element->value_int == NULL) {
- _mmcam_dbg_warn("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
+ MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
return FALSE;
}
for (i = 0 ; i < element->count_int ; i++) {
MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
- /*
- _mmcam_dbg_log("Element[%s] Set[%s] -> integer[%d]",
+ MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [i:%d]",
element->element_name,
element->value_int[i]->name,
element->value_int[i]->value);
- */
}
}
if (element->count_string == 0) {
- _mmcam_dbg_log("There is no string property to set in INI file[%s].", element->name);
+ MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name);
} else {
if (element->value_string == NULL) {
- _mmcam_dbg_warn("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
+ MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
return FALSE;
}
for (i = 0 ; i < element->count_string ; i++) {
MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
- _mmcam_dbg_log("Element[%s] Set[%s] -> string[%s]",
+ MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [s:%s]",
element->element_name,
element->value_string[i]->name,
element->value_string[i]->value);
}
}
- /* _mmcam_dbg_log( "Done." ); */
-
return TRUE;
}
-int
-_mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
+int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
{
int i = 0;
int count_value = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (hcamcorder == NULL) {
- _mmcam_dbg_err("handle is NULL");
+ MMCAM_LOG_ERROR("handle is NULL");
return FALSE;
}
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(name, FALSE);
if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
- _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
+ MMCAM_LOG_WARNING("No matched category. categoty[%d]", category);
return FALSE;
}
}
}
- _mmcam_dbg_err("Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
+ MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name);
return FALSE;
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (hcamcorder == NULL) {
- _mmcam_dbg_err("handle is NULL");
+ MMCAM_LOG_ERROR("handle is NULL");
return FALSE;
}
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(name, FALSE);
if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
- _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
+ MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
return FALSE;
}
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
*value = hcamcorder->conf_main_info_table[category][i].value_string;
- /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
return TRUE;
}
}
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
*value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
- /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
return TRUE;
}
}
}
- _mmcam_dbg_warn("Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
+ MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name);
return FALSE;
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (hcamcorder == NULL) {
- _mmcam_dbg_err("handle is NULL");
+ MMCAM_LOG_ERROR("handle is NULL");
return FALSE;
}
- /* _mmcam_dbg_log("Entered..."); */
-
mmf_return_val_if_fail(name, FALSE);
if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
- _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
+ MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
return FALSE;
}
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
*element = hcamcorder->conf_main_info_table[category][i].value_element;
- _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
return TRUE;
}
}
for (i = 0 ; i < count_value ; i++) {
if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
*element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
- _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
return TRUE;
}
}
}
- _mmcam_dbg_warn("Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
+ MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name);
return FALSE;
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (hcamcorder == NULL) {
- _mmcam_dbg_err("handle is NULL");
+ MMCAM_LOG_ERROR("handle is NULL");
return FALSE;
}
- /*
- mmf_return_val_if_fail(conf_main_category_size, FALSE);
- mmf_return_val_if_fail(conf_ctrl_category_size, FALSE);
- */
-
if (type == CONFIGURE_TYPE_MAIN) {
mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
-
*size = (int)hcamcorder->conf_main_category_size[category];
} else {
mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
-
*size = (int)hcamcorder->conf_ctrl_category_size[category];
}
return TRUE;
}
-void
-_mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
+void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, camera_conf *conf, int category,
+ const char *name, type_element **element, const char **element_name)
+{
+ type_element *_element = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (!hcamcorder) {
+ MMCAM_LOG_ERROR("NULL handle");
+ return;
+ }
+
+ if (!_mmcamcorder_conf_get_element(handle, conf,
+ category, name, &_element)) {
+ MMCAM_LOG_WARNING("get [%s] failed", name);
+ return;
+ }
+
+ if (element)
+ *element = _element;
+
+ if (element_name) {
+ _mmcamcorder_conf_get_value_element_name(_element, element_name);
+ MMCAM_LOG_INFO("[%s] -> [%s]", name, *element_name);
+ }
+}
+
+void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
{
int i, j, k, type, category_type;
}
-static type_element *
-__mmcamcorder_get_audio_codec_element(MMHandleType handle)
+static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
const char *codec_type_str = NULL;
mmf_return_val_if_fail(sc, NULL);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
/* Check element availability */
mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
codec_type_str = "VORBIS";
break;
default:
- _mmcam_dbg_err("Not supported audio codec[%d]", codec_type);
+ MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type);
return NULL;
}
}
-static type_element *
-__mmcamcorder_get_video_codec_element(MMHandleType handle)
+static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
const char *codec_type_str = NULL;
mmf_return_val_if_fail(sc, NULL);
- _mmcam_dbg_log("");
-
/* Check element availability */
mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
codec_type_str = "THEORA";
break;
default:
- _mmcam_dbg_err("Not supported video codec[%d]", codec_type);
+ MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type);
return NULL;
}
}
-static type_element *
-__mmcamcorder_get_image_codec_element(MMHandleType handle)
+static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
const char *codec_type_str = NULL;
mmf_return_val_if_fail(sc, NULL);
- _mmcam_dbg_log("");
-
/* Check element availability */
mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
codec_type_str = "XPM";
break;
default:
- _mmcam_dbg_err("Not supported image codec[%d]", codec_type);
+ MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type);
return NULL;
}
}
-static type_element *
-__mmcamcorder_get_file_format_element(MMHandleType handle)
+static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle)
{
type_element *telement = NULL;
const char *mux_type_str = NULL;
mmf_return_val_if_fail(sc, NULL);
- _mmcam_dbg_log("");
-
/* Check element availability */
mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
mux_type_str = "M2TS";
break;
default:
- _mmcam_dbg_err("Not supported file format[%d]", file_type);
+ MMCAM_LOG_ERROR("Not supported file format[%d]", file_type);
return NULL;
}
}
-type_element *
-_mmcamcorder_get_type_element(MMHandleType handle, int type)
+type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type)
{
type_element *telement = NULL;
- _mmcam_dbg_log("type:%d", type);
-
switch (type) {
case MM_CAM_AUDIO_ENCODER:
telement = __mmcamcorder_get_audio_codec_element(handle);
telement = __mmcamcorder_get_file_format_element(handle);
break;
default:
- _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
+ MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type);
}
return telement;
int codec_index = MM_AUDIO_CODEC_INVALID;
if (!name) {
- _mmcam_dbg_err("name is NULL");
+ MMCAM_LOG_ERROR("name is NULL");
return MM_AUDIO_CODEC_INVALID;
}
else if (!strcmp(name, "VORBIS"))
codec_index = MM_AUDIO_CODEC_VORBIS;
- /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
+ MMCAM_LOG_DEBUG("audio codec index %d", codec_index);
return codec_index;
}
int codec_index = MM_VIDEO_CODEC_INVALID;
if (!name) {
- _mmcam_dbg_err("name is NULL");
+ MMCAM_LOG_ERROR("name is NULL");
return MM_VIDEO_CODEC_INVALID;
}
else if (!strcmp(name, "THEORA"))
codec_index = MM_VIDEO_CODEC_THEORA;
- /*_mmcam_dbg_log("video codec index %d", codec_index);*/
+ MMCAM_LOG_DEBUG("video codec index %d", codec_index);
return codec_index;
}
int codec_index = MM_IMAGE_CODEC_INVALID;
if (!name) {
- _mmcam_dbg_err("name is NULL");
+ MMCAM_LOG_ERROR("name is NULL");
return MM_IMAGE_CODEC_INVALID;
}
else if (!strcmp(name, "XPM"))
codec_index = MM_IMAGE_CODEC_XPM;
- _mmcam_dbg_log("image codec index %d", codec_index);
+ MMCAM_LOG_DEBUG("image codec index %d", codec_index);
return codec_index;
}
int mux_index = MM_FILE_FORMAT_INVALID;
if (!name) {
- _mmcam_dbg_err("name is NULL");
+ MMCAM_LOG_ERROR("name is NULL");
return MM_FILE_FORMAT_INVALID;
}
else if (!strcmp(name, "M2TS"))
mux_index = MM_FILE_FORMAT_M2TS;
- /*_mmcam_dbg_log("mux index %d", mux_index);*/
+ MMCAM_LOG_DEBUG("mux index %d", mux_index);
return mux_index;
}
-int
-_mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
+int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
{
int fmt = -1;
fmt = _mmcamcorder_get_mux_format(handle, name);
break;
default:
- _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
+ MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category);
}
return fmt;
}
-int
-_mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
+int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
camera_conf* configure_info = NULL;
mmf_return_val_if_fail(hcamcorder, 0);
- /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
-
configure_info = hcamcorder->conf_main;
if (configure_info->info[conf_category]) {
int count = configure_info->info[conf_category]->count;
conf_detail *info = configure_info->info[conf_category];
- /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
+ MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]",
+ conf_category, count, info);
if (count <= 0 || !info)
return total_count;
- arr = (int*) g_malloc0(count * sizeof(int));
- if (arr == NULL) {
- _mmcam_dbg_err("malloc failed : %zu", count * sizeof(int));
- return 0;
- }
+ arr = (int*)g_malloc0(count * sizeof(int));
for (i = 0 ; i < count ; i++) {
if (info->detail_info[i] == NULL)
if (fmt >= 0)
arr[total_count++] = fmt;
- /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/
+ MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt);
}
}