From 27e24905e839d232b6dbb29912f704dd9290e855 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Fri, 22 Apr 2016 19:33:08 +0900 Subject: [PATCH] [Release version 0.2.53] Update code for exception handling and fix error type in some case Change-Id: Ifec2d635544e15f884e465d7a94ce7228048fef9 Signed-off-by: Jeongmo Yang --- packaging/capi-media-camera.spec | 2 +- src/camera.c | 47 +++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 282afdb..d446b7b 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -3,7 +3,7 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.52 +Version: 0.2.53 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index fbfe46d..26cfc1b 100644 --- a/src/camera.c +++ b/src/camera.c @@ -4329,8 +4329,8 @@ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb) } if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); - return CAMERA_ERROR_NOT_SUPPORTED; + LOGE("invalid white balance %d", wb); + return CAMERA_ERROR_INVALID_PARAMETER; } int ret = CAMERA_ERROR_NONE; @@ -5190,6 +5190,11 @@ int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state) muse_core_api_module_e muse_module = MUSE_CAMERA; int device_type = (int)device; + if (state == NULL) { + LOGE("invalid pointer for state"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + sock_fd = muse_core_client_new(); if (sock_fd < 0) { LOGE("muse_core_client_new failed - returned fd %d", sock_fd); @@ -5681,8 +5686,8 @@ int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode) return CAMERA_ERROR_INVALID_PARAMETER; } if (mode == NULL) { - LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED); - return CAMERA_ERROR_NOT_SUPPORTED; + LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; } int ret = CAMERA_ERROR_NONE; camera_cli_s *pc = (camera_cli_s *)camera; @@ -5732,31 +5737,39 @@ bool camera_attr_is_supported_hdr_capture(camera_h camera) int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB; + int sock_fd; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if (callback == NULL) { - LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED); - return CAMERA_ERROR_NOT_SUPPORTED; - } - int ret = CAMERA_ERROR_NONE; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB; - int sock_fd; if (pc->cb_info == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + sock_fd = pc->cb_info->fd; - LOGD("Enter, handle :%x", pc->remote_handle); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data; + LOGD("Enter, handle :%x", pc->remote_handle); muse_camera_msg_send(api, sock_fd, pc->cb_info, ret); + + if (ret == CAMERA_ERROR_NONE) { + if (callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data; + } + LOGD("ret : 0x%x", ret); + return ret; } @@ -5822,7 +5835,7 @@ int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled) } if (enabled == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_NOT_SUPPORTED; + return CAMERA_ERROR_INVALID_PARAMETER; } int ret = CAMERA_ERROR_NONE; camera_cli_s *pc = (camera_cli_s *)camera; @@ -5904,7 +5917,7 @@ int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled) } if (enabled == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_NOT_SUPPORTED; + return CAMERA_ERROR_INVALID_PARAMETER; } int ret = CAMERA_ERROR_NONE; camera_cli_s *pc = (camera_cli_s *)camera; -- 2.7.4