diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2016-01-15 15:30:06 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2016-01-15 15:30:26 +0900 |
commit | 77da96f4ed46d7189773e1692ac6e265e2b414e2 (patch) | |
tree | fe86c70001aa6c9c5b76d1a86ceaf5d1d3a91442 | |
parent | d9aa0f4dde3ea2c94b9cf6aabd168a9e58f85557 (diff) | |
download | camera-77da96f4ed46d7189773e1692ac6e265e2b414e2.tar.gz camera-77da96f4ed46d7189773e1692ac6e265e2b414e2.tar.bz2 camera-77da96f4ed46d7189773e1692ac6e265e2b414e2.zip |
[Release version 0.2.38] Fix bug - invalid display settingsubmit/tizen/20160115.070542accepted/tizen/wearable/20160115.113302accepted/tizen/tv/20160115.113245accepted/tizen/mobile/20160115.113234
Change-Id: Ia2de7e9272f6a73cff18f0a6c2c4787046011bbd
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 185 | ||||
-rw-r--r-- | test/multimedia_camera_test.c | 48 |
3 files changed, 123 insertions, 112 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 01e56e3..0b0a2b7 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.37 +Version: 0.2.38 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index e7dff8d..ef92bc2 100644 --- a/src/camera.c +++ b/src/camera.c @@ -2636,136 +2636,122 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height) int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + pc = (camera_cli_s *)camera; + + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - int set_rotation = (int)rotation; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation); - LOGD("ret : 0x%x", ret); - return ret; + ret = mm_camcorder_set_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_ROTATION, rotation, + NULL); + + return __convert_camera_error_code(__func__, ret); } int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL || rotation == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - int get_rotation; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send(api, sock_fd, pc->cb_info, ret); + ret = mm_camcorder_get_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_ROTATION, rotation, + NULL); - if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg); - *rotation = (camera_rotation_e)get_rotation; - } - LOGD("ret : 0x%x", ret); - return ret; + return __convert_camera_error_code(__func__, ret); } int camera_set_display_flip(camera_h camera, camera_flip_e flip) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - int set_flip = (int)flip; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip); - LOGD("ret : 0x%x", ret); - return ret; + ret = mm_camcorder_set_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_FLIP, flip, + NULL); + + return __convert_camera_error_code(__func__, ret); } int camera_get_display_flip(camera_h camera, camera_flip_e *flip) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL || flip == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - int get_flip; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send(api, sock_fd, pc->cb_info, ret); + ret = mm_camcorder_get_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_FLIP, flip, + NULL); - if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_get(get_flip, pc->cb_info->recv_msg); - *flip = (camera_flip_e)get_flip; - } - LOGD("ret : 0x%x", ret); - return ret; + return __convert_camera_error_code(__func__, ret); } int camera_set_display_visible(camera_h camera, bool visible) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE; - int set_visible = (int)visible; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_visible); - LOGD("ret : 0x%x", ret); - return ret; + ret = mm_camcorder_set_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_VISIBLE, visible, + NULL); + + return __convert_camera_error_code(__func__, ret); } int camera_is_display_visible(camera_h camera, bool* visible) @@ -2800,57 +2786,50 @@ int camera_is_display_visible(camera_h camera, bool* visible) int camera_set_display_mode(camera_h camera, camera_display_mode_e mode) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; - int set_mode = (int)mode; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode); - LOGD("ret : 0x%x", ret); - return ret; + ret = mm_camcorder_set_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); + + return __convert_camera_error_code(__func__, ret); } int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode) { + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = NULL; + if (camera == NULL || mode == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_NONE; + pc = (camera_cli_s *)camera; - camera_cli_s *pc = (camera_cli_s *)camera; - muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE; - int sock_fd; - if (pc->cb_info == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if (pc->client_handle == NULL) { + LOGE("client handle is NULL"); + return CAMERA_ERROR_INVALID_OPERATION; } - sock_fd = pc->cb_info->fd; - int get_mode; - LOGD("Enter, remote_handle : %x", pc->remote_handle); - muse_camera_msg_send(api, sock_fd, pc->cb_info, ret); + ret = mm_camcorder_get_attributes(pc->client_handle, NULL, + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); - if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_get(get_mode, pc->cb_info->recv_msg); - *mode = (camera_display_mode_e)get_mode; - } - LOGD("ret : 0x%x", ret); - return ret; + return __convert_camera_error_code(__func__, ret); } int camera_get_capture_resolution(camera_h camera, int *width, int *height) diff --git a/test/multimedia_camera_test.c b/test/multimedia_camera_test.c index 1ef98ce..0ca7933 100644 --- a/test/multimedia_camera_test.c +++ b/test/multimedia_camera_test.c @@ -39,8 +39,9 @@ #define PACKAGE "camera_testsuite" -Evas_Object* img; -Evas_Object* eo; +Evas_Object *eo; +Evas_Object *bg; +Evas_Object *rect; GMainLoop *g_loop; GIOChannel *stdin_channel; camera_device_e cam_info; @@ -1356,13 +1357,44 @@ int main(int argc, char **argv) elm_init(argc, argv); eo = elm_win_add(NULL, "VIDEO OVERLAY", ELM_WIN_BASIC); - elm_win_title_set(eo, "TITLE"); - elm_win_borderless_set(eo, EINA_TRUE); - elm_win_screen_size_get(eo, NULL, NULL, &w, &h); - evas_object_resize(eo, w, h); - evas_object_show(eo); - elm_win_activate(eo); + if (eo) { + elm_win_title_set(eo, "TITLE"); + elm_win_borderless_set(eo, EINA_TRUE); + elm_win_screen_size_get(eo, NULL, NULL, &w, &h); + evas_object_resize(eo, w, h); + elm_win_autodel_set(eo, EINA_TRUE); +#ifdef HAVE_WAYLAND + elm_win_alpha_set(eo, EINA_TRUE); +#endif /* HAVE_WAYLAND */ + } else { + g_print("\n\tfailed to get window\n\n"); + return 1; + } + + bg = elm_bg_add(eo); + if (bg) { + elm_win_resize_object_add(eo, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + } else { + g_print("\n\tfailed to get elm bg\n\n"); + return 1; + } + + rect = evas_object_rectangle_add(evas_object_evas_get(eo)); + if (rect) { + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_render_op_set(rect, EVAS_RENDER_COPY); + } else { + g_print("\n\tfailed to get rectangle\n\n"); + return 1; + } + elm_win_resize_object_add(eo, rect); + evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(rect); + elm_win_activate(eo); + evas_object_show(eo); #if !GLIB_CHECK_VERSION(2, 35, 0) if (!g_thread_supported()) |