}
+static int __color_channel_item_compare_func(gconstpointer data, gconstpointer user_data)
+{
+ GstColorBalanceChannel *Colorchannel = (GstColorBalanceChannel *)data;
+ MMCAM_LOG_VERBOSE("check[%s], input[%s]", Colorchannel->label, (char *)user_data);
+ return strcmp(Colorchannel->label, user_data);
+}
+
bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
GstColorBalance *balance = NULL;
GstColorBalanceChannel *Colorchannel = NULL;
- const GList *controls = NULL;
- const GList *item = NULL;
+ GList *controls = NULL;
+ GList *item = NULL;
int newVal = 0;
- int mslNewVal = 0;
+ int mslVal = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
const char *control_label = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
gboolean check_scene_mode = FALSE;
+ int wb_temp_table[] = {
+ [MM_CAMCORDER_WHITE_BALANCE_DAYLIGHT] = 5200,
+ [MM_CAMCORDER_WHITE_BALANCE_CLOUDY] = 6000,
+ [MM_CAMCORDER_WHITE_BALANCE_FLUORESCENT] = 4000,
+ [MM_CAMCORDER_WHITE_BALANCE_INCANDESCENT] = 3200,
+ [MM_CAMCORDER_WHITE_BALANCE_SHADE] = 7000,
+ [MM_CAMCORDER_WHITE_BALANCE_FLASH] = 6000
+ };
+
mmf_return_val_if_fail(hcamcorder && value, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
if (value->type != MM_ATTRS_TYPE_INT) {
MMCAM_LOG_WARNING("Mismatched value type (%d)", value->type);
return FALSE;
- } else {
- mslNewVal = value->value.i_val;
}
+ mslVal = value->value.i_val;
+
switch (attr_idx) {
case MM_CAM_FILTER_BRIGHTNESS:
control_label = "brightness";
check_scene_mode = TRUE;
break;
-
case MM_CAM_FILTER_CONTRAST:
control_label = "contrast";
break;
-
case MM_CAM_FILTER_WB:
control_label = "white balance";
check_scene_mode = TRUE;
break;
-
case MM_CAM_FILTER_COLOR_TONE:
control_label = "color tone";
break;
-
case MM_CAM_FILTER_SATURATION:
control_label = "saturation";
check_scene_mode = TRUE;
break;
-
case MM_CAM_FILTER_HUE:
control_label = "hue";
break;
-
case MM_CAM_FILTER_SHARPNESS:
control_label = "sharpness";
check_scene_mode = TRUE;
}
}
- newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslNewVal);
+ newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE)
return FALSE;
- /*MMCAM_LOG_INFO("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);*/
-
if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
MMCAM_LOG_INFO("Can't cast Video source into color balance.");
return TRUE;
return FALSE;
}
- controls = gst_color_balance_list_channels(balance);
+ controls = (GList *)gst_color_balance_list_channels(balance);
if (controls == NULL) {
MMCAM_LOG_INFO("There is no list of colorbalance controls");
return FALSE;
}
- for (item = controls ; item && item->data ; item = item->next) {
+_CHECK_AGAIN:
+ MMCAM_LOG_DEBUG("attr[%d] label[%s]: MSL[%d] -> Sensor[%d]",
+ attr_idx, control_label, mslVal, newVal);
+
+ item = g_list_find_custom(controls, control_label, __color_channel_item_compare_func);
+ if (item) {
Colorchannel = item->data;
- /*MMCAM_LOG_INFO("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);*/
+ gst_color_balance_set_value(balance, Colorchannel, newVal);
+ MMCAM_LOG_INFO("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslVal, newVal);
+ return TRUE;
+ }
- if (!strcmp(Colorchannel->label, control_label)) {
- gst_color_balance_set_value(balance, Colorchannel, newVal);
- MMCAM_LOG_INFO("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal);
- break;
+ if (attr_idx == MM_CAM_FILTER_WB && !strcmp(control_label, "white balance")) {
+ if (mslVal == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC) {
+ newVal = 1;
+ control_label = "white_balance_temperature_auto";
+ goto _CHECK_AGAIN;
+ } else {
+ newVal = wb_temp_table[mslVal];
+ control_label = "white_balance_temperature";
+ goto _CHECK_AGAIN;
}
}
- if (item == NULL) {
- MMCAM_LOG_ERROR("failed to find color channel item");
- return FALSE;
- }
+ MMCAM_LOG_ERROR("failed to find color channel item");
- return TRUE;
+ return FALSE;
}