ret = CAMERA_ERROR_INVALID_STATE;
errorstr = "INVALID_STATE";
break;
+//LCOV_EXCL_START
case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND:
ret = CAMERA_ERROR_DEVICE_NOT_FOUND;
errorstr = "DEVICE_NOT_FOUND";
ret = CAMERA_ERROR_PERMISSION_DENIED;
errorstr = "ERROR_PERMISSION_DENIED";
break;
+//LCOV_EXCL_STOP
case MM_ERROR_COMMON_OUT_OF_ARRAY:
case MM_ERROR_COMMON_OUT_OF_RANGE:
case MM_ERROR_COMMON_ATTR_NOT_EXIST:
ret = CAMERA_ERROR_NOT_SUPPORTED;
errorstr = "ERROR_NOT_SUPPORTED";
break;
+//LCOV_EXCL_START
case MM_ERROR_RESOURCE_INTERNAL:
ret = CAMERA_ERROR_RESOURCE_CONFLICT;
errorstr = "ERROR_RESOURCE_CONFLICT";
ret = CAMERA_ERROR_INVALID_OPERATION;
errorstr = "INVALID_OPERATION";
break;
+//LCOV_EXCL_STOP
}
if (code != MM_ERROR_NONE)
static int __mm_camera_message_callback(int message, void *param, void *user_data)
{
- if (user_data == NULL || param == NULL)
- return 0;
-
int i = 0;
int camera_error = 0;
camera_s *handle = (camera_s *)user_data;
camera_policy_e policy = CAMERA_POLICY_NONE;
MMCamFaceDetectInfo *cam_fd_info = NULL;
+ camera_return_val_if_fail(user_data && param, 0);
+
if (handle->relay_message_callback)
handle->relay_message_callback(message, param, handle->relay_user_data);
break;
}
+//LCOV_EXCL_START
/* check policy */
if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) {
policy = CAMERA_POLICY_SECURITY;
if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])
((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]);
}
+//LCOV_EXCL_STOP
previous_state = handle->state;
handle->state = __camera_state_convert(m->state.current, m->state.previous);
}
break;
}
+//LCOV_EXCL_START
case MM_MESSAGE_CAMCORDER_STATE_CHANGE_STARTED_BY_SECURITY:
case MM_MESSAGE_CAMCORDER_STATE_CHANGE_STARTED_BY_RM:
if (handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]) {
}
}
break;
+//LCOV_EXCL_STOP
case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED:
if (handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]) {
((camera_focus_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE])(m->code,
((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]);
break;
+//LCOV_EXCL_START
case MM_MESSAGE_CAMCORDER_ERROR:
switch (m->code) {
case MM_ERROR_CAMCORDER_DEVICE:
}
break;
+//LCOV_EXCL_STOP
case MM_MESSAGE_CAMCORDER_HDR_PROGRESS:
if (handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS]) {
((camera_attr_hdr_progress_cb)handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS])(m->code,
camera_s *handle = (camera_s *)data;
camera_state_e previous_state = CAMERA_STATE_NONE;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return false;
- }
+ camera_return_val_if_fail(handle, false);
if (handle->current_capture_count > 0 &&
handle->current_capture_count == handle->current_capture_complete_count &&
char *error = NULL;
MMCamPreset info;
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(camera, CAMERA_ERROR_INVALID_PARAMETER);
LOGD("device name = [%d]", device);
info.videodev_type = device;
- handle = (camera_s *)malloc(sizeof(camera_s));
- if (handle == NULL) {
- LOGE("malloc fail");
- return CAMERA_ERROR_OUT_OF_MEMORY;
- }
-
- memset(handle, 0x0, sizeof(camera_s));
+ handle = (camera_s *)g_malloc0(sizeof(camera_s));
ret = mm_camcorder_create(&handle->mm_handle, &info);
if (ret != MM_ERROR_NONE) {
- free(handle);
+ g_free(handle);
return __convert_camera_error_code(__func__, ret);
}
MMCAM_CAPTURE_HEIGHT, &handle->capture_height,
NULL);
if (ret != MM_ERROR_NONE) {
+//LCOV_EXCL_START
LOGE("mm_camcorder_get_attributes fail(%x)", ret);
if (error) {
LOGE("failed attribute name %s", error);
}
mm_camcorder_destroy(handle->mm_handle);
- free(handle);
+ g_free(handle);
return __convert_camera_error_code(__func__, ret);
+//LCOV_EXCL_STOP
}
ret = mm_camcorder_set_attributes(handle->mm_handle, &error,
handle->display_type = CAMERA_DISPLAY_TYPE_NONE;
if (ret != MM_ERROR_NONE) {
+//LCOV_EXCL_START
LOGE("mm_camcorder_set_attributes fail(%x)", ret);
if (error) {
LOGE("failed attribute name %s", error);
}
mm_camcorder_destroy(handle->mm_handle);
- free(handle);
+ g_free(handle);
return __convert_camera_error_code(__func__, ret);
+//LCOV_EXCL_STOP
}
handle->state = CAMERA_STATE_CREATED;
void *reuse_element = NULL;
void *gdbus_connection = NULL;
- if (camera == NULL) {
- LOGE("NULL handle");
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (device > CAMERA_DEVICE_CAMERA9) {
- LOGE("invalid device %d", device);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(camera, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(device <= CAMERA_DEVICE_CAMERA9, CAMERA_ERROR_INVALID_PARAMETER);
old_handle = (camera_s *)*camera;
- if (old_handle->is_used_in_recorder) {
- LOGE("camera is using in another recorder.");
- return CAMERA_ERROR_INVALID_OPERATION;
- }
-
- if (old_handle->device_type == device) {
- LOGE("same device. no need to change it.");
- return CAMERA_ERROR_NONE;
- }
+ camera_return_val_if_fail(old_handle->is_used_in_recorder == false, CAMERA_ERROR_INVALID_OPERATION);
+ camera_return_val_if_fail(old_handle->device_type != device, CAMERA_ERROR_NONE);
/* check current state */
legacy_camera_get_state(*camera, &capi_state);
- if (capi_state != CAMERA_STATE_CREATED) {
- LOGE("invalid state %d", capi_state);
- return CAMERA_ERROR_INVALID_STATE;
- }
+
+ camera_return_val_if_fail(capi_state == CAMERA_STATE_CREATED, CAMERA_ERROR_INVALID_STATE);
/* get reuse element */
ret = mm_camcorder_get_attributes(old_handle->mm_handle, NULL,
LOGD("new handle %p", new_handle);
return CAMERA_ERROR_NONE;
-
+//LCOV_EXCL_START
_CHANGE_DEVICE_FAILED:
legacy_camera_destroy((camera_h)new_handle);
new_handle = NULL;
}
return __convert_camera_error_code(__func__, ret);
+//LCOV_EXCL_STOP
}
int legacy_camera_destroy(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
- if (handle->is_used_in_recorder) {
- LOGE("camera is using in another recorder.");
- return CAMERA_ERROR_INVALID_OPERATION;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(handle->is_used_in_recorder == false, CAMERA_ERROR_INVALID_OPERATION);
LOGW("camera handle %p", handle);
if (ret == MM_ERROR_NONE) {
g_cond_clear(&handle->cond);
g_mutex_clear(&handle->lock);
- free(handle);
+ g_free(handle);
}
return __convert_camera_error_code(__func__, ret);
int legacy_camera_start_preview(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
camera_state_e capi_state = CAMERA_STATE_NONE;
MMCamcorderStateType mm_state = MM_CAMCORDER_STATE_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
legacy_camera_get_state(camera, &capi_state);
if (capi_state == CAMERA_STATE_CAPTURED) {
ret = mm_camcorder_capture_stop(handle->mm_handle);
int legacy_camera_stop_preview(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;;
camera_s *handle = (camera_s *)camera;
MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_state(handle->mm_handle, &state);
if (state == MM_CAMCORDER_STATE_PREPARE) {
ret = mm_camcorder_stop(handle->mm_handle);
int legacy_camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
int ret = MM_ERROR_NONE;
MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_state(handle->mm_handle, &state);
if (state != MM_CAMCORDER_STATE_PREPARE &&
state != MM_CAMCORDER_STATE_RECORDING &&
bool legacy_camera_is_supported_continuous_capture(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_COUNT, &info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
int legacy_camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_is_supported_continuous_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (count < 2 || interval < 0) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE;
int supported_zsl = FALSE;
int ret = MM_ERROR_NONE;
camera_attr_hdr_mode_e hdr_mode = CAMERA_ATTR_HDR_MODE_DISABLE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_continuous_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(count > 1 && interval >= 0, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_state(handle->mm_handle, &state);
if (state != MM_CAMCORDER_STATE_PREPARE) {
LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE);
int legacy_camera_stop_continuous_capture(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_is_supported_continuous_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
camera_s *handle = (camera_s *)camera;
int ret = MM_ERROR_NONE;
camera_state_e state = CAMERA_STATE_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_continuous_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+
legacy_camera_get_state(camera, &state);
if (state != CAMERA_STATE_CAPTURING && handle->capture_count > 1) {
LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE);
bool legacy_camera_is_supported_face_detection(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DETECT_MODE , &info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
int supported_zsl = false;
camera_s *handle = (camera_s *)camera;
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
+ camera_return_val_if_fail(handle, false);
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl,
int supported = false;
camera_s *handle = (camera_s *)camera;
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
+ camera_return_val_if_fail(handle, false);
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &supported,
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
- if (camera == NULL || device_count == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle && device_count, CAMERA_ERROR_INVALID_PARAMETER);
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_DEVICE_COUNT, device_count,
int legacy_camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_is_supported_face_detection(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
camera_s *handle = (camera_s *)camera;
camera_state_e state = CAMERA_STATE_NONE;
int ret = MM_ERROR_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_face_detection(camera), CAMERA_ERROR_NOT_SUPPORTED);
+
legacy_camera_get_state(camera, &state);
- if (state != CAMERA_STATE_PREVIEW) {
- LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE);
- return CAMERA_ERROR_INVALID_STATE;
- }
+
+ camera_return_val_if_fail(state == CAMERA_STATE_PREVIEW, CAMERA_ERROR_INVALID_STATE);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_ON,
int legacy_camera_stop_face_detection(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
int ret = MM_ERROR_NONE;
- if (legacy_camera_is_supported_face_detection(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_face_detection(camera), CAMERA_ERROR_NOT_SUPPORTED);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_OFF,
int legacy_camera_get_state(camera_h camera, camera_state_e *state)
{
- if (camera == NULL || state == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
camera_state_e capi_state = CAMERA_STATE_NONE;
MMCamcorderStateType mm_state = MM_CAMCORDER_STATE_NONE;
MMCamcorderStateType mm_old_state = MM_CAMCORDER_STATE_NONE;
+ camera_return_val_if_fail(handle && state, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_state2(handle->mm_handle, &mm_state, &mm_old_state);
capi_state = __camera_state_convert(mm_state, mm_old_state);
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
- if (camera == NULL || device_type == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle && device_type, CAMERA_ERROR_INVALID_PARAMETER);
*device_type = handle->device_type;
int legacy_camera_start_focusing(camera_h camera, bool continuous)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->cached_focus_mode != -1) {
LOGD("apply cached focus mode %d", handle->cached_focus_mode);
int __camera_start_continuous_focusing(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
int ret = MM_ERROR_NONE;
int mode = MM_CAMCORDER_FOCUS_MODE_NONE;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->on_continuous_focusing = true;
mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FOCUS_MODE, &mode,
int legacy_camera_cancel_focusing(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->on_continuous_focusing = false;
return __convert_camera_error_code(__func__, mm_camcorder_stop_focusing(handle->mm_handle));
int ret = MM_ERROR_NONE;
int set_surface = MM_DISPLAY_SURFACE_OVERLAY;
void *set_handle = NULL;
- char *socket_path = NULL;
- camera_s *handle = NULL;
-
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_s *handle = (camera_s *)camera;
- if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
- LOGE("display type[%d] is not NONE, but display handle is NULL", type);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(type == CAMERA_DISPLAY_TYPE_NONE || display, CAMERA_ERROR_INVALID_PARAMETER);
- handle = (camera_s *)camera;
handle->display_type = type;
LOGD("display type - %d, display handle - %p", type, display);
set_surface = MM_DISPLAY_SURFACE_EVAS;
set_handle = display;
break;
- case CAMERA_DISPLAY_TYPE_REMOTE:
- set_surface = MM_DISPLAY_SURFACE_REMOTE;
- handle->display_handle = display;
- break;
case CAMERA_DISPLAY_TYPE_NONE:
set_surface = MM_DISPLAY_SURFACE_NULL;
handle->display_handle = 0;
break;
+//LCOV_EXCL_START
default:
LOGE("unknown display type %d", type);
return CAMERA_ERROR_INVALID_PARAMETER;
+//LCOV_EXCL_STOP
}
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_SURFACE, set_surface,
NULL);
- if (ret == MM_ERROR_NONE) {
- if (type == CAMERA_DISPLAY_TYPE_REMOTE) {
- socket_path = (char *)handle->display_handle;
-
- if (!unlink(socket_path)) {
- LOGW("[%s] remove done", socket_path);
- } else {
- LOGW("[%s] remove failed : errno %d", socket_path, errno);
- }
-
- ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_SOCKET_PATH, socket_path, strlen(socket_path),
- NULL);
- } else if (type != CAMERA_DISPLAY_TYPE_NONE) {
- ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
- NULL);
- }
+ if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
+ NULL);
}
return __convert_camera_error_code(__func__, ret);
int legacy_camera_set_preview_resolution(camera_h camera, int width, int height)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (width <= 0 || height <= 0) {
- LOGE("invalid preview resolution %dx%d", width, height);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
int mm_fps = 0;
int i = 0;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(width > 0 && height > 0, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FPS, &mm_fps,
NULL);
int legacy_camera_set_capture_resolution(camera_h camera, int width, int height)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (width <= 0 || height <= 0) {
- LOGE("invalid capture resolution %dx%d", width, height);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(width > 0 && height > 0, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAPTURE_WIDTH, width,
MMCAM_CAPTURE_HEIGHT, height,
int legacy_camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
if (format < CAMERA_PIXEL_FORMAT_NV12 || format > CAMERA_PIXEL_FORMAT_MJPEG ||
(format > CAMERA_PIXEL_FORMAT_JPEG && format < CAMERA_PIXEL_FORMAT_H264)) {
LOGE("invalid preview format %d", format);
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAPTURE_FORMAT, format,
NULL);
int legacy_camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
if (format < CAMERA_PIXEL_FORMAT_NV12 || format > CAMERA_PIXEL_FORMAT_MJPEG ||
(format > CAMERA_PIXEL_FORMAT_JPEG && format < CAMERA_PIXEL_FORMAT_H264)) {
LOGE("invalid preview format %d", format);
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
if (format == CAMERA_PIXEL_FORMAT_UYVY) {
bool supported_ITLV_UYVY = false;
MMCamAttrsInfo supported_format;
int legacy_camera_get_preview_resolution(camera_h camera, int *width, int *height)
{
- if (camera == NULL || width == NULL || height == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && width && height, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_WIDTH, width,
MMCAM_CAMERA_HEIGHT, height,
int legacy_camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (rotation > CAMERA_ROTATION_270) {
- LOGE("invalid rotation %d", rotation);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(rotation <= CAMERA_ROTATION_270, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_ROTATION, rotation,
NULL);
int legacy_camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
{
- if (camera == NULL || rotation == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && rotation, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_ROTATION, rotation,
NULL);
int legacy_camera_set_display_flip(camera_h camera, camera_flip_e flip)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (flip > CAMERA_FLIP_BOTH) {
- LOGE("invalid flip %d", flip);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(flip <= CAMERA_FLIP_BOTH, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_FLIP, flip,
NULL);
int legacy_camera_get_display_flip(camera_h camera, camera_flip_e *flip)
{
- if (camera == NULL || flip == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && flip, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_FLIP, flip,
NULL);
int legacy_camera_set_display_visible(camera_h camera, bool visible)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_VISIBLE, visible,
NULL);
}
-int legacy_camera_is_display_visible(camera_h camera, bool* visible)
+int legacy_camera_is_display_visible(camera_h camera, bool *visible)
{
- if (camera == NULL || visible == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int result = false;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && visible, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_VISIBLE, &result,
NULL);
int legacy_camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
- LOGE("invalid mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_DISPLAY_MODE_CUSTOM_ROI, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_GEOMETRY_METHOD, mode,
NULL);
int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_GEOMETRY_METHOD, mode,
NULL);
int legacy_camera_get_capture_resolution(camera_h camera, int *width, int *height)
{
- if (camera == NULL || width == NULL || height == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && width && height, CAMERA_ERROR_INVALID_PARAMETER);
+
*width = handle->capture_width;
*height = handle->capture_height;
int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
{
- if (camera == NULL || format == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && format, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAPTURE_FORMAT, format,
NULL);
int legacy_camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
{
- if (camera == NULL || format == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && format, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FORMAT, format,
NULL);
int legacy_camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direction)
{
- if (camera == NULL || facing_direction == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && facing_direction, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FACING_DIRECTION, facing_direction,
NULL);
int legacy_camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)user_data;
int legacy_camera_unset_preview_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
mm_camcorder_set_video_stream_callback(handle->mm_handle,
(mm_camcorder_video_stream_callback)NULL,
int legacy_camera_set_media_packet_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_is_supported_media_packet_preview_cb(camera) == false) {
- LOGE("NOT SUPPORTED");
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
+ camera_s *handle = (camera_s *)camera;
- if (callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_media_packet_preview_cb(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(callback, CAMERA_ERROR_INVALID_PARAMETER);
- camera_s *handle = (camera_s *)camera;
handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)user_data;
int legacy_camera_unset_media_packet_preview_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_is_supported_media_packet_preview_cb(camera) == false) {
- LOGE("NOT SUPPORTED");
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_is_supported_media_packet_preview_cb(camera), CAMERA_ERROR_NOT_SUPPORTED);
+
if (handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] == NULL) {
mm_camcorder_set_video_stream_callback(handle->mm_handle,
(mm_camcorder_video_stream_callback)NULL,
int legacy_camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)user_data;
int legacy_camera_unset_state_changed_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
int legacy_camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)user_data;
int legacy_camera_unset_interrupted_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
int legacy_camera_set_interrupt_started_cb(camera_h camera, camera_interrupt_started_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = (void *)user_data;
int legacy_camera_unset_interrupt_started_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = (void *)NULL;
int legacy_camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)user_data;
int legacy_camera_unset_focus_changed_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
int legacy_camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
{
- if (camera == NULL || callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void *)user_data;
int legacy_camera_unset_error_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
camera_s *handle = (camera_s *)camera;
camera_state_e capi_state = CAMERA_STATE_NONE;
- if (!handle) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
legacy_camera_get_state(camera, &capi_state);
- if (capi_state != CAMERA_STATE_PREVIEW) {
- LOGE("invalid state %d", capi_state);
- return CAMERA_ERROR_INVALID_STATE;
- }
+
+ camera_return_val_if_fail(capi_state == CAMERA_STATE_PREVIEW, CAMERA_ERROR_INVALID_STATE);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_REUSE_HINT, hint,
int ret = CAMERA_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
- if (!handle || !hint) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle && hint, CAMERA_ERROR_INVALID_PARAMETER);
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_REUSE_HINT, hint,
int legacy_camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo preview_width;
MMCamAttrsInfo preview_height;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WIDTH, &preview_width);
ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HEIGHT, &preview_height);
if (ret != CAMERA_ERROR_NONE)
int legacy_camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo capture_width;
MMCamAttrsInfo capture_height;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_WIDTH, &capture_width);
ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_HEIGHT, &capture_height);
if (ret != CAMERA_ERROR_NONE)
int legacy_camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo format;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_FORMAT, &format);
if (ret != CAMERA_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo format;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT, &format);
if (ret != CAMERA_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
{
- if (camera == NULL || width == NULL || height == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
enum MMCamcorderPreviewType wide = MM_CAMCORDER_PREVIEW_TYPE_NORMAL;
int capture_w = 0;
int capture_h = 0;
MMCamAttrsInfo width_info;
MMCamAttrsInfo height_info;
+ camera_return_val_if_fail(handle && width && height, CAMERA_ERROR_INVALID_PARAMETER);
+
legacy_camera_get_capture_resolution(camera, &capture_w, &capture_h);
if (capture_h == 0) {
LOGE("Capture Height is 0");
int legacy_camera_attr_get_lens_orientation(camera_h camera, int *angle)
{
- if (camera == NULL || angle == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
int rotation = MM_DISPLAY_ROTATION_NONE;
+ camera_return_val_if_fail(handle && angle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation,
NULL);
int legacy_camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_THEATER_MODE_ENABLE) {
- LOGE("invalid theater mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_THEATER_MODE_ENABLE, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_MODE, mode,
NULL);
int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_MODE, mode,
NULL);
int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DISPLAY_MODE, &info);
if (ret != CAMERA_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (fps > CAMERA_ATTR_FPS_120) {
- LOGE("invalid preview fps %d", fps);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(fps <= CAMERA_ATTR_FPS_120, CAMERA_ERROR_INVALID_PARAMETER);
+
if (fps == CAMERA_ATTR_FPS_AUTO) {
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FPS_AUTO, true,
int legacy_camera_attr_set_image_quality(camera_h camera, int quality)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (quality <= 0 || quality > 100) {
- LOGE("invalid image quality %d", quality);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(quality > 0 && quality <= 100, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_IMAGE_ENCODER_QUALITY, quality,
NULL);
int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
{
- if (camera == NULL || fps == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int mm_fps = 0;
int is_auto = false;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && fps, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FPS, &mm_fps,
MMCAM_CAMERA_FPS_AUTO, &is_auto,
int legacy_camera_attr_get_image_quality(camera_h camera, int *quality)
{
- if (camera == NULL || quality == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && quality, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_IMAGE_ENCODER_QUALITY, quality,
NULL);
int legacy_camera_attr_set_zoom(camera_h camera, int zoom)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (zoom < 0) {
- LOGE("invalid zoom %d", zoom);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(zoom >= 0, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_DIGITAL_ZOOM, zoom,
NULL);
int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_AF_FULL) {
- LOGE("invalid mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
int focus_mode;
bool should_change_focus_mode = false;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_AF_FULL, CAMERA_ERROR_INVALID_PARAMETER);
+
mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
NULL);
int legacy_camera_attr_set_af_area(camera_h camera, int x, int y)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (x < 0 || y < 0) {
- LOGE("invalid AF area %d, %d", x, y);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
camera_attr_af_mode_e mode;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(x >= 0 && y >= 0, CAMERA_ERROR_INVALID_PARAMETER);
+
legacy_camera_attr_get_af_mode(camera, &mode);
if (mode == CAMERA_ATTR_AF_NONE) {
LOGE("INVALID_OPERATION(0x%08x) AF mode is CAMERA_ATTR_AF_NONE", CAMERA_ERROR_INVALID_OPERATION);
int legacy_camera_attr_clear_af_area(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->focus_area_valid = false;
return 0;
int legacy_camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
- LOGE("invalid exposure mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
+ int ret = MM_ERROR_NONE;
+ camera_s *handle = (camera_s *)camera;
int maptable[] = {
MM_CAMCORDER_AUTO_EXPOSURE_OFF, /* CAMERA_ATTR_EXPOSURE_MODE_OFF */
MM_CAMCORDER_AUTO_EXPOSURE_ALL, /* CAMERA_ATTR_EXPOSURE_MODE_ALL */
MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1, /* CAMERA_ATTR_EXPOSURE_MODE_CENTER */
MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, /* CAMERA_ATTR_EXPOSURE_MODE_SPOT */
MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1, /* CAMERA_ATTR_EXPOSURE_MODE_CUSTOM */
- };
+ };
- int ret = MM_ERROR_NONE;
- camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, CAMERA_ERROR_INVALID_PARAMETER);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_EXPOSURE_MODE, maptable[mode],
int legacy_camera_attr_set_exposure(camera_h camera, int value)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_EXPOSURE_VALUE, value,
NULL);
int legacy_camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (iso > CAMERA_ATTR_ISO_3200) {
- LOGE("invalid iso %d", iso);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(iso <= CAMERA_ATTR_ISO_3200, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_ISO, iso,
NULL);
int legacy_camera_attr_set_brightness(camera_h camera, int level)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_BRIGHTNESS, level,
NULL);
int legacy_camera_attr_set_contrast(camera_h camera, int level)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_CONTRAST, level,
NULL);
int legacy_camera_attr_set_hue(camera_h camera, int level)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_HUE, level,
NULL);
int legacy_camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
- LOGE("invalid white balance %d", wb);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(wb <= CAMERA_ATTR_WHITE_BALANCE_CUSTOM, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_WB, wb,
NULL);
int legacy_camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (effect > CAMERA_ATTR_EFFECT_OTHER_GRAPHICS) {
- LOGE("invalid effect %d", effect);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(effect <= CAMERA_ATTR_EFFECT_OTHER_GRAPHICS, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_COLOR_TONE, effect,
NULL);
int legacy_camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_SCENE_MODE_AQUA) {
- LOGE("invalid scene mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_SCENE_MODE_AQUA, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_SCENE_MODE, mode,
NULL);
int legacy_camera_attr_enable_tag(camera_h camera, bool enable)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_ENABLE, enable,
NULL);
int legacy_camera_attr_set_tag_image_description(camera_h camera, const char *description)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_IMAGE_DESCRIPTION, description, description ? strlen(description) : 0,
NULL);
int legacy_camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (orientation < CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT || orientation > CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM) {
- LOGE("invalid tag orientation %d", orientation);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(orientation >= CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT &&\
+ orientation <= CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_ORIENTATION, orientation,
NULL);
int legacy_camera_attr_set_tag_software(camera_h camera, const char *software)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_SOFTWARE, software, software ? strlen(software) : 0,
NULL);
int legacy_camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (latitude > 90.0 || latitude < -90.0 ||
- longitude > 180.0 || longitude < -180.0) {
- LOGE("invalid geotag: latitude %lf, logitude %lf", latitude, longitude);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(latitude >= -90.0 && latitude <= 90.0 &&
+ longitude >= -180.0 && longitude <= 180.0, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_GPS_ENABLE, true,
MMCAM_TAG_LATITUDE, latitude,
int legacy_camera_attr_remove_geotag(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_TAG_GPS_ENABLE, false,
NULL);
int legacy_camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_FLASH_MODE_PERMANENT) {
- LOGE("invalid flash mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_FLASH_MODE_PERMANENT, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_STROBE_MODE, mode,
NULL);
int legacy_camera_attr_get_zoom(camera_h camera, int *zoom)
{
- if (camera == NULL || zoom == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && zoom, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_DIGITAL_ZOOM, zoom,
NULL);
int legacy_camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_DIGITAL_ZOOM, &ainfo);
if (ret == MM_ERROR_NONE) {
*min = ainfo.int_range.min;
int legacy_camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int focus_mode;
int af_range;
int detect_mode;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
MMCAM_CAMERA_AF_SCAN_RANGE, &af_range,
int legacy_camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
+ int ret = MM_ERROR_NONE;
+ int exposure_mode;
+ camera_s *handle = (camera_s *)camera;
int maptable[] = {
CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */
CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */
CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */
CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */
CAMERA_ATTR_EXPOSURE_MODE_CUSTOM /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */
- };
- int ret = MM_ERROR_NONE;
- int exposure_mode;
- camera_s *handle = (camera_s *)camera;
+ };
+
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_EXPOSURE_MODE, &exposure_mode,
int legacy_camera_attr_get_exposure(camera_h camera, int *value)
{
- if (camera == NULL || value == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && value, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_EXPOSURE_VALUE, value,
NULL);
int legacy_camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_VALUE, &ainfo);
if (ret == MM_ERROR_NONE) {
*min = ainfo.int_range.min;
int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
{
- if (camera == NULL || iso == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && iso, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_ISO, iso,
NULL);
int legacy_camera_attr_get_brightness(camera_h camera, int *level)
{
- if (camera == NULL || level == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && level, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_BRIGHTNESS, level,
NULL);
int legacy_camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_BRIGHTNESS, &ainfo);
if (ret == MM_ERROR_NONE) {
*min = ainfo.int_range.min;
int legacy_camera_attr_get_contrast(camera_h camera, int *level)
{
- if (camera == NULL || level == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && level, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_CONTRAST, level,
NULL);
int legacy_camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_CONTRAST, &ainfo);
if (ret == MM_ERROR_NONE) {
*min = ainfo.int_range.min;
int legacy_camera_attr_get_hue(camera_h camera, int *level)
{
- if (camera == NULL || level == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && level, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_HUE, level,
NULL);
int legacy_camera_attr_get_hue_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_HUE, &ainfo);
if (ret == MM_ERROR_NONE) {
*min = ainfo.int_range.min;
int legacy_camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
{
- if (camera == NULL || wb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && wb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_WB, wb,
NULL);
int legacy_camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
{
- if (camera == NULL || effect == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && effect, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_COLOR_TONE, effect,
NULL);
int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_FILTER_SCENE_MODE, mode,
NULL);
int legacy_camera_attr_is_enabled_tag(camera_h camera, bool *enable)
{
- if (camera == NULL || enable == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int get_enabled = 0;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && enable, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_TAG_ENABLE, &get_enabled,
NULL);
int legacy_camera_attr_get_tag_image_description(camera_h camera, char **description)
{
- if (camera == NULL || description == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
char *ndescription = NULL;
int desc_size;
+ camera_return_val_if_fail(handle && description, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size,
NULL);
int legacy_camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
{
- if (camera == NULL || orientation == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && orientation, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_TAG_ORIENTATION, orientation,
NULL);
int legacy_camera_attr_get_tag_software(camera_h camera, char **software)
{
- if (camera == NULL || software == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
char *soft = NULL;
int soft_size;
+ camera_return_val_if_fail(handle && software, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_TAG_SOFTWARE, &soft, &soft_size,
NULL);
int legacy_camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
{
- if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && latitude && longitude && altitude, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_TAG_LATITUDE, latitude,
MMCAM_TAG_LONGITUDE, longitude,
int legacy_camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
{
- if (camera == NULL || mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_STROBE_MODE, mode,
NULL);
int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int i = 0;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo af_range;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_AF_SCAN_RANGE, &af_range);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
+ int i = 0;
+ int ret = MM_ERROR_NONE;
+ camera_s *handle = (camera_s *)camera;
+ MMCamAttrsInfo info;
int maptable[] = {
CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */
CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */
-1, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */
CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */
-1 /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */
- };
- int i = 0;
- int ret = MM_ERROR_NONE;
- camera_s *handle = (camera_s *)camera;
- MMCamAttrsInfo info;
+ };
+
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_MODE, &info);
if (ret != MM_ERROR_NONE)
int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ISO, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_WB, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_COLOR_TONE, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_SCENE_MODE, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_STROBE_MODE, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
int height = 0;
int i = 0;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_WIDTH, &width,
MMCAM_CAMERA_HEIGHT, &height,
int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
int i = 0;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FLIP, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ROTATION, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_set_stream_rotation(camera_h camera, camera_rotation_e rotation)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (rotation > CAMERA_ROTATION_270) {
- LOGE("invalid stream rotation %d", rotation);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(rotation <= CAMERA_ROTATION_270, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_ROTATION, rotation,
NULL);
int legacy_camera_attr_get_stream_rotation(camera_h camera, camera_rotation_e *rotation)
{
- if (camera == NULL || rotation == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && rotation, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_ROTATION, rotation,
NULL);
int legacy_camera_attr_set_stream_flip(camera_h camera, camera_flip_e flip)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (flip > CAMERA_FLIP_BOTH) {
- LOGE("invalid stream flip %d", flip);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(flip <= CAMERA_FLIP_BOTH, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FLIP, flip,
NULL);
int legacy_camera_attr_get_stream_flip(camera_h camera, camera_flip_e *flip)
{
- if (camera == NULL || flip == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && flip, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_FLIP, flip,
NULL);
{
camera_s *handle = (camera_s *)camera;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
handle->is_used_in_recorder = used;
int _camera_get_mm_handle(camera_h camera, MMHandleType *handle)
{
- if (camera == NULL || handle == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *camera_handle = (camera_s *)camera;
+ camera_return_val_if_fail(camera_handle && handle, CAMERA_ERROR_INVALID_PARAMETER);
+
*handle = camera_handle->mm_handle;
return CAMERA_ERROR_NONE;
int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->relay_message_callback = callback;
handle->relay_user_data = user_data;
int legacy_camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (mode > CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL) {
- LOGE("invalid HDR mode %d", mode);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_hdr_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(mode <= CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_hdr_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_HDR_CAPTURE, mode,
NULL);
int legacy_camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_hdr_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (mode == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_hdr_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(mode, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_HDR_CAPTURE, mode,
NULL);
bool legacy_camera_attr_is_supported_hdr_capture(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int ret = MM_ERROR_NONE;
int i = 0;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo hdr_info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HDR_CAPTURE, &hdr_info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
int legacy_camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_hdr_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_hdr_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(callback, CAMERA_ERROR_INVALID_PARAMETER);
+
handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)callback;
handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)user_data;
int legacy_camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_hdr_capture(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_hdr_capture(camera), CAMERA_ERROR_NOT_SUPPORTED);
+
handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
int legacy_camera_attr_enable_anti_shake(camera_h camera, bool enable)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_anti_shake(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
int ret = MM_ERROR_NONE;
- int mode = MM_CAMCORDER_AHS_OFF;
camera_s *handle = (camera_s *)camera;
- if (enable)
- mode = MM_CAMCORDER_AHS_ON;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_anti_shake(camera), CAMERA_ERROR_NOT_SUPPORTED);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_CAMERA_ANTI_HANDSHAKE, mode,
+ MMCAM_CAMERA_ANTI_HANDSHAKE, enable ? MM_CAMCORDER_AHS_ON : MM_CAMCORDER_AHS_OFF,
NULL);
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_is_enabled_anti_shake(camera_h camera, bool *enabled)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_anti_shake(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (enabled == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int get_enabled = 0;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_anti_shake(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(enabled, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_ANTI_HANDSHAKE, &get_enabled,
NULL);
bool legacy_camera_attr_is_supported_anti_shake(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ash_info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ANTI_HANDSHAKE, &ash_info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
int legacy_camera_attr_enable_video_stabilization(camera_h camera, bool enable)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_video_stabilization(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
int ret = MM_ERROR_NONE;
- int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF;
camera_s *handle = (camera_s *)camera;
- if (enable)
- mode = MM_CAMCORDER_VIDEO_STABILIZATION_ON;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_video_stabilization(camera), CAMERA_ERROR_NOT_SUPPORTED);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_CAMERA_VIDEO_STABILIZATION, mode,
+ MMCAM_CAMERA_VIDEO_STABILIZATION, enable ? MM_CAMCORDER_VIDEO_STABILIZATION_ON : MM_CAMCORDER_VIDEO_STABILIZATION_OFF,
NULL);
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_video_stabilization(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (enabled == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_video_stabilization(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(enabled, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_VIDEO_STABILIZATION, &mode,
NULL);
bool legacy_camera_attr_is_supported_video_stabilization(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo vs_info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_VIDEO_STABILIZATION, &vs_info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
int legacy_camera_attr_enable_auto_contrast(camera_h camera, bool enable)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_auto_contrast(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
int ret = MM_ERROR_NONE;
- int mode = MM_CAMCORDER_WDR_OFF;
camera_s *handle = (camera_s *)camera;
- if (enable)
- mode = MM_CAMCORDER_WDR_ON;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_auto_contrast(camera), CAMERA_ERROR_NOT_SUPPORTED);
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_CAMERA_WDR, mode,
+ MMCAM_CAMERA_WDR, enable ? MM_CAMCORDER_WDR_ON : MM_CAMCORDER_WDR_OFF,
NULL);
return __convert_camera_error_code(__func__, ret);
int legacy_camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (legacy_camera_attr_is_supported_auto_contrast(camera) == false) {
- LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
- return CAMERA_ERROR_NOT_SUPPORTED;
- }
-
- if (enabled == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int mode = MM_CAMCORDER_WDR_OFF;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(legacy_camera_attr_is_supported_auto_contrast(camera), CAMERA_ERROR_NOT_SUPPORTED);
+ camera_return_val_if_fail(enabled, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_WDR, &mode,
NULL);
bool legacy_camera_attr_is_supported_auto_contrast(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WDR, &info);
set_last_result(__convert_camera_error_code(__func__, ret));
if (ret != MM_ERROR_NONE) {
bool legacy_camera_attr_is_supported_user_buffer(camera_h camera)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return false;
- }
-
int is_supported;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, false);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_SUPPORT_USER_BUFFER, &is_supported,
NULL);
int legacy_camera_attr_disable_shutter_sound(camera_h camera, bool disable)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- "capture-sound-enable", !disable,
- NULL);
+ "capture-sound-enable", !disable,
+ NULL);
if (ret != MM_ERROR_NONE) {
LOGE("CAMERA_ERROR_INVALID_OPERATION : not permitted disable shutter sound");
return CAMERA_ERROR_INVALID_OPERATION;
int legacy_camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
{
- if (camera == NULL || bitrate == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && bitrate, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_ENCODED_PREVIEW_BITRATE, bitrate,
NULL);
int legacy_camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (bitrate <= 0) {
- LOGE("invalid encoded preview bitrate %d", bitrate);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(bitrate > 0, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_ENCODED_PREVIEW_BITRATE, bitrate,
NULL);
int legacy_camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
{
- if (camera == NULL || interval == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && interval, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval,
NULL);
int legacy_camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (interval < 0) {
- LOGE("invalid encoded preview gop interval %d", interval);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(interval >= 0, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval,
NULL);
int legacy_camera_attr_set_pan(camera_h camera, int move_type, int pan_step)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int step = 0;
const char *pan_type = NULL;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
pan_type = MMCAM_CAMERA_PAN_MECHA;
else
int legacy_camera_attr_get_pan(camera_h camera, int *pan_step)
{
- if (camera == NULL || pan_step == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
const char *pan_type = NULL;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && pan_step, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
pan_type = MMCAM_CAMERA_PAN_MECHA;
else
int legacy_camera_attr_get_pan_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
const char *pan_type = NULL;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
pan_type = MMCAM_CAMERA_PAN_MECHA;
else
}
+//LCOV_EXCL_START
int legacy_camera_attr_set_tilt(camera_h camera, int move_type, int tilt_step)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int step = 0;
const char *tilt_type = NULL;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
tilt_type = MMCAM_CAMERA_TILT_MECHA;
else
int legacy_camera_attr_get_tilt(camera_h camera, int *tilt_step)
{
- if (camera == NULL || tilt_step == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
const char *tilt_type = NULL;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && tilt_step, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
tilt_type = MMCAM_CAMERA_TILT_MECHA;
else
int legacy_camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
{
- if (camera == NULL || min == NULL || max == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
const char *tilt_type = NULL;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo ainfo;
+ camera_return_val_if_fail(handle && min && max, CAMERA_ERROR_INVALID_PARAMETER);
+
if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
tilt_type = MMCAM_CAMERA_TILT_MECHA;
else
int legacy_camera_attr_set_ptz_type(camera_h camera, int ptz_type)
{
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_CAMERA_PTZ_TYPE, ptz_type,
NULL);
int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
{
- if (camera == NULL || foreach_cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int i = 0;
int ret = MM_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
MMCamAttrsInfo info;
+ camera_return_val_if_fail(handle && foreach_cb, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_PTZ_TYPE, &info);
if (ret != MM_ERROR_NONE)
return __convert_camera_error_code(__func__, ret);
return CAMERA_ERROR_NONE;
}
+//LCOV_EXCL_STOP
int legacy_camera_attr_set_display_roi_area(camera_h camera, int *display_roi_area)
{
- if (camera == NULL || display_roi_area == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int current_method = MM_DISPLAY_METHOD_LETTER_BOX;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && display_roi_area, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method,
NULL);
int legacy_camera_attr_get_display_roi_area(camera_h camera, int *display_roi_area)
{
- if (camera == NULL || display_roi_area == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
int ret = MM_ERROR_NONE;
int current_method = MM_DISPLAY_METHOD_LETTER_BOX;
int x = 0;
int height = 0;
camera_s *handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle && display_roi_area, CAMERA_ERROR_INVALID_PARAMETER);
+
ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method,
NULL);
{
camera_s *handle = (camera_s *)camera;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return false;
- }
+ camera_return_val_if_fail(handle, false);
return handle->is_used_in_recorder;
}
camera_s *handle = (camera_s *)camera;
gint64 end_time;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return false;
- }
+ camera_return_val_if_fail(handle, false);
end_time = g_get_monotonic_time() + timeout * G_TIME_SPAN_MILLISECOND;
{
camera_s *handle = (camera_s *)camera;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return;
- }
+ camera_return_if_fail(handle);
LOGD("%p lock %d", handle, is_lock);
{
camera_s *handle = (camera_s *)camera;
- if (handle == NULL) {
- LOGE("handle is NULL");
- return;
- }
+ camera_return_if_fail(handle);
LOGD("send signal");
int legacy_camera_set_user_buffer(camera_h camera, int *fds, int number)
{
int ret = MM_ERROR_NONE;
- camera_s *handle = NULL;
-
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- if (!fds || number < 1) {
- LOGE("invalid fds %p or number %d", fds, number);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
+ camera_s *handle = (camera_s *)camera;
- handle = (camera_s *)camera;
+ camera_return_val_if_fail(handle, CAMERA_ERROR_INVALID_PARAMETER);
+ camera_return_val_if_fail(fds && number > 0, CAMERA_ERROR_INVALID_PARAMETER);
LOGD("number - %d", number);
return __convert_camera_error_code(__func__, ret);
}
-