diff options
-rw-r--r-- | include/camera.h | 2 | ||||
-rw-r--r-- | include/camera_private.h | 11 | ||||
-rw-r--r-- | packaging/capi-media-camera.spec | 4 | ||||
-rw-r--r-- | src/camera.c | 63 |
4 files changed, 54 insertions, 26 deletions
diff --git a/include/camera.h b/include/camera.h index 39da0ac..1b5dc7c 100644 --- a/include/camera.h +++ b/include/camera.h @@ -1427,7 +1427,7 @@ int camera_set_display_reuse_hint(camera_h camera, bool hint); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected - * @see camera_get_display_reuse_hint() + * @see camera_set_display_reuse_hint() * @see camera_change_device() */ int camera_get_display_reuse_hint(camera_h camera, bool *hint); diff --git a/include/camera_private.h b/include/camera_private.h index 8ec8061..2a74fa5 100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -44,6 +44,13 @@ extern "C" { param.value.value_##msg_type = set_value; \ } +#define CAMERA_MSG_PARAM_SET_ARRAY(param, msg_type, set_value, size) { \ + param.type = MUSE_TYPE_##msg_type; \ + param.name = #set_value; \ + param.value.value_##msg_type = set_value; \ + param.value_size = size; \ +} + #define PREVIEW_CB_TYPE_USER 0x0000000F #define PREVIEW_CB_TYPE_EVAS 0x000000F0 @@ -153,7 +160,7 @@ typedef struct _camera_cb_info_s { camera_pixel_format_e preview_format; /* display */ - camera_display_type_e dp_type; + muse_camera_display_info_s dp_info; mm_display_interface_h dp_interface; gboolean run_evas_render; @@ -203,7 +210,9 @@ typedef struct _camera_msg_param { union { int value_INT; const char *value_STRING; + void *value_ARRAY; } value; + int value_size; } camera_msg_param; typedef struct _camera_cb_info { diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 4c05fb7..8e9e217 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,7 +1,7 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.25 -Release: 1 +Version: 0.4.26 +Release: 0 Group: Multimedia/API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/camera.c b/src/camera.c index 5279908..4da30f3 100644 --- a/src/camera.c +++ b/src/camera.c @@ -736,6 +736,7 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info, int *ret, camera_msg_param *param, int timeout) { int send_ret = 0; + int array_length; char *msg = NULL; if (!cb_info || !param) { @@ -760,6 +761,14 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info, param->type, param->name, param->value.value_STRING, NULL); break; + case MUSE_TYPE_ARRAY: + array_length = param->value_size / sizeof(int) + \ + (param->value_size % sizeof(int) ? 1 : 0); + + msg = muse_core_msg_new(api, + param->type, param->name, array_length, param->value.value_ARRAY, + NULL); + break; default: LOGE("unknown type %d", param->type); break; @@ -2577,7 +2586,7 @@ int camera_create(camera_device_e device, camera_h *camera) pc->remote_handle = handle; pc->cb_info->bufmgr = bufmgr; pc->cb_info->preview_format = preview_format; - pc->cb_info->dp_type = CAMERA_DISPLAY_TYPE_NONE; + pc->cb_info->dp_info.type = CAMERA_DISPLAY_TYPE_NONE; pc->cb_info->user_buffer_supported = (gboolean)user_buffer_supported; LOGD("default preview format %d, user buffer %d", @@ -2706,7 +2715,7 @@ int camera_start_preview(camera_h camera) } LOGD("Enter : preview format %d, display type %d", - pc->cb_info->preview_format, pc->cb_info->dp_type); + pc->cb_info->preview_format, pc->cb_info->dp_info.type); ret = camera_get_state(camera, ¤t_state); if (ret != CAMERA_ERROR_NONE) { @@ -2715,9 +2724,9 @@ int camera_start_preview(camera_h camera) } if (pc->cb_info->preview_format == CAMERA_PIXEL_FORMAT_INVZ && - pc->cb_info->dp_type != CAMERA_DISPLAY_TYPE_NONE) { + pc->cb_info->dp_info.type != CAMERA_DISPLAY_TYPE_NONE) { LOGE("CAMERA_DISPLAY_TYPE_NONE[current %d] should be set with INVZ format", - pc->cb_info->dp_type); + pc->cb_info->dp_info.type); return CAMERA_ERROR_INVALID_OPERATION; } @@ -3123,14 +3132,14 @@ int camera_cancel_focusing(camera_h camera) int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display) { + int mm_ret = MM_ERROR_NONE; int ret = CAMERA_ERROR_NONE; - int parent_id = 0; camera_cli_s *pc = (camera_cli_s *)camera; camera_cb_info_s *cb_info = NULL; camera_state_e current_state = CAMERA_STATE_NONE; - camera_msg_param param0; - camera_msg_param param1; + camera_msg_param param; muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY; + muse_camera_display_info_s *dp_info = NULL; if (!pc || !pc->cb_info) { LOGE("NULL handle"); @@ -3148,6 +3157,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ } cb_info = (camera_cb_info_s *)pc->cb_info; + dp_info = &cb_info->dp_info; ret = camera_get_state(camera, ¤t_state); if (ret != CAMERA_ERROR_NONE) { @@ -3169,13 +3179,19 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ return CAMERA_ERROR_NOT_SUPPORTED; } - ret = mm_display_interface_set_display(cb_info->dp_interface, type, display, &parent_id); - if (ret != MM_ERROR_NONE) { - LOGE("[INVALID_OPERATION] set display failed[0x%x]", ret); + mm_ret = mm_display_interface_set_display(cb_info->dp_interface, type, display, &dp_info->parent_id); + if (mm_ret != MM_ERROR_NONE) { + LOGE("[INVALID_OPERATION] set display failed[0x%x]", mm_ret); return CAMERA_ERROR_INVALID_OPERATION; } - if (type == CAMERA_DISPLAY_TYPE_EVAS) { + if (type == CAMERA_DISPLAY_TYPE_OVERLAY) { + mm_ret = mm_display_interface_get_window_rect(cb_info->dp_interface, &dp_info->window_rect); + + LOGD("ret 0x%x, parent_id %d, window rect %d,%d,%dx%d", + ret, dp_info->parent_id, dp_info->window_rect.x, dp_info->window_rect.y, + dp_info->window_rect.width, dp_info->window_rect.height); + } else if (type == CAMERA_DISPLAY_TYPE_EVAS) { //LCOV_EXCL_START camera_flip_e flip = CAMERA_FLIP_NONE; camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX; @@ -3195,26 +3211,29 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d", flip, mode, rotation, visible, x, y, width, height); - ret = mm_display_interface_evas_set_flip(cb_info->dp_interface, flip); - ret |= mm_display_interface_evas_set_mode(cb_info->dp_interface, mode); - ret |= mm_display_interface_evas_set_rotation(cb_info->dp_interface, rotation); - ret |= mm_display_interface_evas_set_visible(cb_info->dp_interface, visible); + mm_ret = mm_display_interface_evas_set_flip(cb_info->dp_interface, flip); + mm_ret |= mm_display_interface_evas_set_mode(cb_info->dp_interface, mode); + mm_ret |= mm_display_interface_evas_set_rotation(cb_info->dp_interface, rotation); + mm_ret |= mm_display_interface_evas_set_visible(cb_info->dp_interface, visible); if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI) - ret |= mm_display_interface_evas_set_roi_area(cb_info->dp_interface, x, y, width, height); + mm_ret |= mm_display_interface_evas_set_roi_area(cb_info->dp_interface, x, y, width, height); //LCOV_EXCL_STOP } } - CAMERA_MSG_PARAM_SET(param0, INT, type); - CAMERA_MSG_PARAM_SET(param1, INT, parent_id); + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_ret 0x%x failed", mm_ret); + return CAMERA_ERROR_INVALID_OPERATION; + } - _camera_msg_send_param2_int(api, cb_info, &ret, - ¶m0, ¶m1, CAMERA_CB_TIMEOUT); + dp_info->type = type; - if (ret == CAMERA_ERROR_NONE) { - pc->cb_info->dp_type = type; + CAMERA_MSG_PARAM_SET_ARRAY(param, ARRAY, dp_info, sizeof(muse_camera_display_info_s)); + + _camera_msg_send_param1(api, cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { if (type == CAMERA_DISPLAY_TYPE_EVAS) SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS); } |