diff options
author | Haesu Gwon <haesu.gwon@samsung.com> | 2015-12-15 11:29:39 +0900 |
---|---|---|
committer | Haesu Gwon <haesu.gwon@samsung.com> | 2015-12-21 18:04:18 +0900 |
commit | 975ab60325bd4f1da2ce40a7b23466b3cbfd039f (patch) | |
tree | 823b87b627320af309005f400ad7295b80be8a97 | |
parent | 890cf39b1daf219207db80243c98a2125b35c613 (diff) | |
download | camera-975ab60325bd4f1da2ce40a7b23466b3cbfd039f.tar.gz camera-975ab60325bd4f1da2ce40a7b23466b3cbfd039f.tar.bz2 camera-975ab60325bd4f1da2ce40a7b23466b3cbfd039f.zip |
[Camera] Add new API - get facing directionsubmit/tizen/20151222.052554accepted/tizen/wearable/20151222.090436accepted/tizen/tv/20151222.090412accepted/tizen/mobile/20151222.090349
Change-Id: I998001a9a1e6a94eec2dea8faaab2f94bab5683a
-rwxr-xr-x[-rw-r--r--] | include/camera.h | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | packaging/capi-media-camera.spec | 2 | ||||
-rwxr-xr-x | src/camera.c | 30 | ||||
-rwxr-xr-x[-rw-r--r--] | test/multimedia_camera_test.c | 17 |
4 files changed, 70 insertions, 1 deletions
diff --git a/include/camera.h b/include/camera.h index dfaed59..4440998 100644..100755 --- 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 index 8a3651d..1d6d005 100644..100755 --- 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 index fc956cd..cd47f9c 100644..100755 --- 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"); |