{.int_min = MM_CAMCORDER_LOG_LEVEL_CRITICAL},
{.int_max = MM_CAMCORDER_LOG_LEVEL_VERBOSE},
NULL,
+ },
+ {
+ MM_CAM_STROBE_BRIGHTNESS,
+ "strobe-brightness",
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = -1},
+ _mmcamcorder_commit_strobe,
}
};
bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
- bool bret = FALSE;
_MMCamcorderSubContext *sc = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
int strobe_type, mslVal, newVal, cur_value;
/* check flash state */
if (attr_idx == MM_CAM_STROBE_MODE) {
- int flash_brightness = 0;
+ int led_brightness = 0;
- /* get current flash brightness */
- if (_mmcamcorder_get_device_flash_brightness(hcamcorder->gdbus_conn, &flash_brightness) != MM_ERROR_NONE) {
- MMCAM_LOG_ERROR("_mmcamcorder_get_device_flash_brightness failed");
+ if (_mmcamcorder_get_device_led_brightness(hcamcorder->gdbus_conn, &led_brightness) != MM_ERROR_NONE) {
+ MMCAM_LOG_ERROR("_mmcamcorder_get_device_led_brightness failed");
hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION;
return FALSE;
}
- MMCAM_LOG_INFO("flash brightness %d", flash_brightness);
+ MMCAM_LOG_INFO("LED brightness[%d] from deviced", led_brightness);
- if (flash_brightness > 0 &&
+ if (led_brightness > 0 &&
mslVal != MM_CAMCORDER_STROBE_MODE_OFF) {
- /* other module already turned on flash */
+ /* other module already turned on LED */
hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY;
- MMCAM_LOG_ERROR("other module already turned on flash. avoid to set flash mode here.");
+ MMCAM_LOG_ERROR("other module already turned on LED. avoid to set strobe mode here.");
return FALSE;
- } else {
- MMCAM_LOG_INFO("keep going");
}
+
+ MMCAM_LOG_INFO("keep going");
}
/* check state */
strobe_type = GST_CAMERA_CONTROL_STROBE_MODE;
newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, mslVal);
break;
+ case MM_CAM_STROBE_BRIGHTNESS:
+ strobe_type = GST_CAMERA_CONTROL_STROBE_BRIGHTNESS;
+ newVal = mslVal;
+ break;
default:
- MMCAM_LOG_ERROR("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx);
+ MMCAM_LOG_ERROR("invalid attribute[%d]", attr_idx);
return FALSE;
}
GstCameraControl *control = NULL;
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
- bret = FALSE;
- } else {
- control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
- if (control == NULL) {
- MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
- return FALSE;
- }
+ return FALSE;
+ }
- if (gst_camera_control_get_strobe(control, strobe_type, &cur_value)) {
- if (newVal != cur_value) {
- if (gst_camera_control_set_strobe(control, strobe_type, newVal)) {
- MMCAM_LOG_INFO("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal);
- bret = TRUE;
- } else {
- MMCAM_LOG_WARNING("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal);
- bret = FALSE;
- }
- } else {
- MMCAM_LOG_INFO("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal);
- bret = TRUE;
- }
- } else {
- MMCAM_LOG_WARNING("Failed to get strobe. Type[%d]", strobe_type);
- bret = FALSE;
- }
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
+ return FALSE;
}
- return bret;
+ if (!gst_camera_control_get_strobe(control, strobe_type, &cur_value)) {
+ MMCAM_LOG_WARNING("Failed to get strobe. Type[%d]", strobe_type);
+ return FALSE;
+ }
+
+ if (newVal == cur_value) {
+ MMCAM_LOG_INFO("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal);
+ return TRUE;
+ }
+
+ if (!gst_camera_control_set_strobe(control, strobe_type, newVal)) {
+ MMCAM_LOG_WARNING("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal);
+ return FALSE;
+ }
+
+ MMCAM_LOG_INFO("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal);
+
+ return TRUE;
}
MM_CAM_CAMERA_WDR,
MM_CAM_FILTER_CONTRAST,
MM_CAM_FILTER_HUE,
- MM_CAM_DETECT_MODE
+ MM_CAM_DETECT_MODE,
+ MM_CAM_STROBE_BRIGHTNESS
};
int attr_idxs_extra[] = {