From 975ab60325bd4f1da2ce40a7b23466b3cbfd039f Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 15 Dec 2015 11:29:39 +0900 Subject: [PATCH] [Camera] Add new API - get facing direction Change-Id: I998001a9a1e6a94eec2dea8faaab2f94bab5683a --- include/camera.h | 22 ++++++++++++++++++++++ packaging/capi-media-camera.spec | 2 +- src/camera.c | 30 ++++++++++++++++++++++++++++++ test/multimedia_camera_test.c | 17 +++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) mode change 100644 => 100755 include/camera.h mode change 100644 => 100755 packaging/capi-media-camera.spec mode change 100644 => 100755 test/multimedia_camera_test.c diff --git a/include/camera.h b/include/camera.h old mode 100644 new mode 100755 index dfaed59..4440998 --- a/include/camera.h +++ b/include/camera.h @@ -161,6 +161,15 @@ typedef enum { } camera_focus_state_e; /** + * @brief Enumeration for the facing direction of camera module + * @since_tizen 3.0 + */ +typedef enum { + CAMERA_FACING_DIRECTION_REAR = 0, /**< Rear */ + CAMERA_FACING_DIRECTION_FRONT, /**< Front */ +} camera_facing_direction_e; + +/** * @brief The structure type of the image data. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ @@ -1445,6 +1454,19 @@ int camera_set_preview_format(camera_h camera, camera_pixel_format_e format); int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); /** + * @brief Gets the facing direction of camera module. + * @since_tizen 3.0 + * @param[in] camera The handle to the camera + * @param[out] facing_direciton The facing direction of camera module + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + */ +int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton); + +/** * @} */ diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec old mode 100644 new mode 100755 index 8a3651d..1d6d005 --- 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.28 +Version: 0.2.29 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 3bca0c7..f3f90dd 100755 --- a/src/camera.c +++ b/src/camera.c @@ -2879,6 +2879,36 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format) return ret; } +int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton) +{ + if( camera == NULL || facing_direciton == 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_GET_FACING_DIRECTION; + 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; + int get_facing_direction; + + LOGD("Enter, remote_handle : %x", pc->remote_handle); + muse_camera_msg_send(api, sock_fd, pc->cb_info, ret); + + if (ret == CAMERA_ERROR_NONE) { + muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg); + *facing_direciton = (camera_facing_direction_e)get_facing_direction; + } + LOGD("ret : 0x%x", ret); + return ret; +} + int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data) { if (camera == NULL || callback == NULL) { diff --git a/test/multimedia_camera_test.c b/test/multimedia_camera_test.c old mode 100644 new mode 100755 index fc956cd..cd47f9c --- a/test/multimedia_camera_test.c +++ b/test/multimedia_camera_test.c @@ -420,6 +420,11 @@ const char *visible_mode[] = { "Display ON", }; +const char *facing_direction[] = { + "REAR", + "FRONT", +}; + /*--------------------------------------------------------------------------- | LOCAL FUNCTION PROTOTYPES: | @@ -677,6 +682,7 @@ static void print_menu() g_print("\t 'j' Jpeg quality \n"); g_print("\t 'p' Picture format \n"); g_print("\t 'E' EXIF orientation \n"); + g_print("\t 'F' Get facing direction of camera module\n"); g_print("\t >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n"); g_print("\t 'v' Visible \n"); g_print("\t 'o' Output mode \n"); @@ -998,6 +1004,17 @@ static void setting_menu(gchar buf) break; + case 'F' : // Getting > Get Facing direction + g_print("* Get facing direction of camera module\n"); + err = camera_get_facing_direction(hcamcorder->camera,&idx); + if (CAMERA_ERROR_NONE == err) { + g_print("* Facing direction : %s(%d)\n", facing_direction[idx], idx); + } else { + g_print("* Error : %d\n", err); + } + + break; + /* Display / Filter setting */ case 'v' : // Display visible g_print("* Display visible setting !\n"); -- 2.7.4