[Camera] Add new API - get facing direction 29/54329/6 accepted/tizen/mobile/20151222.090349 accepted/tizen/tv/20151222.090412 accepted/tizen/wearable/20151222.090436 submit/tizen/20151222.052554
authorHaesu Gwon <haesu.gwon@samsung.com>
Tue, 15 Dec 2015 02:29:39 +0000 (11:29 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 21 Dec 2015 09:04:18 +0000 (18:04 +0900)
Change-Id: I998001a9a1e6a94eec2dea8faaab2f94bab5683a

include/camera.h [changed mode: 0644->0755]
packaging/capi-media-camera.spec [changed mode: 0644->0755]
src/camera.c
test/multimedia_camera_test.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index dfaed59..4440998
@@ -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);
+
+/**
  * @}
  */
 
old mode 100644 (file)
new mode 100755 (executable)
index 8a3651d..1d6d005
@@ -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
index 3bca0c7..f3f90dd 100755 (executable)
@@ -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) {
old mode 100644 (file)
new mode 100755 (executable)
index fc956cd..cd47f9c
@@ -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");