[ACR-1187] Add new enum and APIs 45/173645/4 accepted/tizen/4.0/unified/20180327.055711 submit/tizen_4.0/20180326.041150
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 20 Dec 2017 08:26:27 +0000 (17:26 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 23 Mar 2018 04:46:24 +0000 (13:46 +0900)
This commit can support maximum 10 cameras in a target,
and new attribute setting(hue level).

[Version] 0.3.10
[Profile] Common
[Issue Type] Update
[Dependency module] N/A

Change-Id: I675adab79b60d13a402ccceeea34c5df14b707ee
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/camera.h
packaging/capi-media-camera.spec
src/camera.c
test/camera_test.c

index a221fa1a01857d6d4b6e297b3237e6cd9dfe937e..4f02771a2de201d865e3fcce2b5f1be25be2ebcb 100644 (file)
@@ -89,7 +89,15 @@ typedef enum {
  */
 typedef enum {
        CAMERA_DEVICE_CAMERA0 = 0, /**< Primary camera */
-       CAMERA_DEVICE_CAMERA1      /**< Secondary camera */
+       CAMERA_DEVICE_CAMERA1,     /**< Secondary camera */
+       CAMERA_DEVICE_CAMERA2,     /**< Third camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA3,     /**< 4th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA4,     /**< 5th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA5,     /**< 6th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA6,     /**< 7th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA7,     /**< 8th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA8,     /**< 9th camera (Since 4.0) */
+       CAMERA_DEVICE_CAMERA9      /**< 10th camera (Since 4.0) */
 } camera_device_e;
 
 /**
@@ -2890,6 +2898,50 @@ int camera_attr_get_contrast(camera_h camera, int *level);
  */
 int camera_attr_get_contrast_range(camera_h camera, int *min, int *max);
 
+/**
+ * @brief Sets the hue level.
+ * @since_tizen 4.0
+ * @param[in] camera The handle to the camera
+ * @param[in] level The hue level
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see camera_attr_get_hue()
+ * @see camera_attr_get_hue_range()
+ */
+int camera_attr_set_hue(camera_h camera, int level);
+
+/**
+ * @brief Gets the hue level.
+ * @since_tizen 4.0
+ * @param[in] camera The handle to the camera
+ * @param[out] level The hue level
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see camera_attr_set_hue()
+ * @see camera_attr_get_hue_range()
+ */
+int camera_attr_get_hue(camera_h camera, int *level);
+
+/**
+ * @brief Gets the available hue level.
+ * @since_tizen 4.0
+ * @remarks If the min value is greater than the max value, it means that this feature is not supported.
+ * @param[in] camera The handle to the camera
+ * @param[out] min The minimum hue level
+ * @param[out] max The maximum hue level
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see camera_attr_set_hue()
+ * @see camera_attr_get_hue()
+ */
+int camera_attr_get_hue_range(camera_h camera, int *min, int *max);
+
 /**
  * @brief Sets the white balance mode.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 6ec1a7fceafd976fa602afc8dd7755433fc85c19..b2b57756a6163be0cffcac4e6582b27403744f8f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.3.9
+Version:    0.3.10
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index df501d9bc08798a57d472241175c0de72f8be167..69088f20b6a3ce58f21b5859a9f9854b87e96b90 100644 (file)
@@ -4828,6 +4828,30 @@ int camera_attr_set_contrast(camera_h camera, int level)
 }
 
 
+int camera_attr_set_hue(camera_h camera, int level)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HUE;
+       camera_msg_param param;
+
+       if (!pc || !pc->cb_info) {
+               LOGE("NULL handle");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("Enter");
+
+       CAMERA_MSG_PARAM_SET(param, INT, level);
+
+       _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
+
+       LOGD("ret : 0x%x", ret);
+
+       return ret;
+}
+
+
 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
 {
        int ret = CAMERA_ERROR_NONE;
@@ -5373,6 +5397,57 @@ int camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
 }
 
 
+int camera_attr_get_hue(camera_h camera, int *level)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HUE;
+
+       if (!pc || !pc->cb_info || !level) {
+               LOGE("NULL pointer %p %p", pc, level);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("Enter");
+
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE)
+               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_HUE];
+
+       LOGD("ret : 0x%x", ret);
+
+       return ret;
+}
+
+
+int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HUE_RANGE;
+
+       if (!pc || !pc->cb_info || !min || !max) {
+               LOGE("NULL pointer %p %p %p", pc, min, max);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("Enter");
+
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][1];
+               LOGD("min %d, max %d", *min, *max);
+       }
+
+       LOGD("ret : 0x%x", ret);
+
+       return ret;
+}
+
+
 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
 {
        int ret = CAMERA_ERROR_NONE;
index d872bb4ecfc9e0e92cee7f7bac898895c4ccf157..97b7610ad19b925b20f83d8202faf6d33a4685c2 100644 (file)
@@ -403,6 +403,7 @@ static bool _release_idle_event_callback(void *data)
        camera_destroy(hcamcorder->camera);
        hcamcorder->camera = NULL;
        hcamcorder->menu_state = MENU_STATE_INIT;
+
        print_menu();
 
        return 0;
@@ -434,26 +435,30 @@ static void _camera_error_cb(int error, camera_state_e current_state, void *user
 
 static void _camera_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data)
 {
-       g_print("\ncamera state changed %d -> %d\n", previous, current);
+       g_print("\n\tcamera state changed %d -> %d\n", previous, current);
+
        return;
 }
 
 static void _camera_device_state_changed_cb(camera_device_e device, camera_device_state_e state, void *user_data)
 {
-       g_print("\ncamera device[%d] state changed to %d\n", device, state);
+       g_print("\n\tcamera device[%d] state changed to %d\n", device, state);
+
        return;
 }
 
 static void _camera_interrupted_cb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data)
 {
-       g_print("\ncamera interrupted callback called[state %d -> %d, policy %d]\n",
+       g_print("\n\tcamera interrupted callback called[state %d -> %d, policy %d]\n",
                previous, current, policy);
+
        return;
 }
 
 static void _camera_interrupt_started_cb(camera_policy_e policy, camera_state_e state, void *user_data)
 {
-       g_print("\ncamera interrupt started callback called[state %d, policy %d]\n", state, policy);
+       g_print("\n\tcamera interrupt started callback called[state %d, policy %d]\n", state, policy);
+
        return;
 }
 
@@ -505,7 +510,7 @@ static bool preview_resolution_cb(int width, int height, void *user_data)
        data->width[data->count] = width;
        data->height[data->count] = height;
 
-       g_print("%d. %dx%d\n", data->count, width, height);
+       g_print("\t%d. %dx%d\n", data->count, width, height);
 
        data->count++;
 
@@ -524,7 +529,7 @@ static bool capture_resolution_test_cb(int width, int height, void *user_data)
        data->width[data->count] = width;
        data->height[data->count] = height;
 
-       g_print("%d. %dx%d\n", data->count, width, height);
+       g_print("\t%d. %dx%d\n", data->count, width, height);
 
        data->count++;
 
@@ -533,7 +538,7 @@ static bool capture_resolution_test_cb(int width, int height, void *user_data)
 
 static bool af_mode_foreach_cb(camera_attr_iso_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, af_scan[mode]);
+       g_print("\t%d. %s\n", mode, af_scan[mode]);
        return true;
 }
 
@@ -549,13 +554,13 @@ static bool exposure_mode_cb(camera_attr_af_mode_e mode, void *user_data)
        data->mode = mode;
        data->count++;
 
-       g_print("%d.%s\n", mode, exposure_mode[mode]);
+       g_print("\t%d. %s\n", mode, exposure_mode[mode]);
        return true;
 }
 
 static bool iso_mode_cb(camera_attr_iso_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, iso_mode[mode]);
+       g_print("\t%d. %s\n", mode, iso_mode[mode]);
        return true;
 }
 
@@ -571,48 +576,48 @@ static bool camera_rotation_cb(camera_rotation_e mode, void *user_data)
        data->mode = mode;
        data->count++;
 
-       g_print("%d.%s\n", mode, camera_rotation[mode]);
+       g_print("\t%d. %s\n", mode, camera_rotation[mode]);
 
        return true;
 }
 
 static bool preview_format_cb(camera_pixel_format_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, image_fmt[mode]);
+       g_print("\t%d. %s\n", mode, image_fmt[mode]);
        return true;
 }
 
 static bool white_balance_cb(camera_attr_whitebalance_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, wb[mode]);
+       g_print("\t%d. %s\n", mode, wb[mode]);
        return true;
 }
 
 static bool colortone_cb(camera_attr_effect_mode_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, ct[mode]);
+       g_print("\t%d. %s\n", mode, ct[mode]);
        return true;
 }
 
 static bool program_mode_cb(camera_attr_scene_mode_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, program_mode[mode]);
+       g_print("\t%d. %s\n", mode, program_mode[mode]);
        return true;
 }
 
 static bool strobe_mode_cb(camera_attr_flash_mode_e mode, void *user_data)
 {
-       g_print("%d.%s\n", mode, strobe_mode[mode]);
+       g_print("\t%d. %s\n", mode, strobe_mode[mode]);
        return true;
 }
 
 static void _face_detected(camera_detected_face_s *faces, int count, void *user_data)
 {
-       g_print("face detected!! - count %d\n", count);
+       g_print("\tface detected!! - count %d\n", count);
        int i;
 
        for (i = 0 ; i < count ; i++)
-               g_print("%d) - %dx%d\n", faces[i].id, faces[i].x, faces[i].y);
+               g_print("\t%d] %dx%d\n", faces[i].id, faces[i].x, faces[i].y);
 
        return;
 }
@@ -622,24 +627,25 @@ static void _file_write(char *path, void *data, int size)
        FILE *fp = NULL;
 
        if (!path || !data || size <= 0) {
-               g_print("ERROR %p %p %d\n", path, data, size);
+               g_print("\n\tERROR %p %p %d\n", path, data, size);
                return;
        }
 
        fp = fopen(path, "w");
-       if (fp == NULL) {
-               g_print("open error! [%s], errno %d\n", path, errno);
-               return;
-       } else {
-               g_print("open success [%s]\n", path);
+       if (fp) {
+               g_print("\n\topen success [%s]\n", path);
                if (fwrite(data, size, 1, fp) != 1)
-                       g_print("write error! errno %d\n", errno);
+                       g_print("\n\twrite error! errno %d\n", errno);
                else
-                       g_print("write success [%s]\n", path);
+                       g_print("\n\twrite success [%s]\n", path);
 
                fclose(fp);
                fp = NULL;
+       } else {
+               g_print("\n\topen error! [%s], errno %d\n", path, errno);
        }
+
+       return;
 }
 
 static void capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data)
@@ -666,8 +672,6 @@ static void capture_completed_cb(void *user_data)
 {
        camera_start_preview(hcamcorder->camera);
 
-       print_menu();
-
        return;
 }
 
@@ -678,28 +682,21 @@ static void print_menu()
                g_print("\n\t=======================================\n");
                g_print("\t   CAMERA_TESTSUITE\n");
                g_print("\t=======================================\n");
-               g_print("\t   '1' Video Capture - Front Camera\n");
-               g_print("\t   '2' Video Capture - Rear Camera\n");
-               g_print("\t   '3' Add camera device state changed callback\n");
-               g_print("\t   '4' Remove camera device state changed callback\n");
-               g_print("\t   '5' Get camera device state\n");
+               g_print("\t   '1' Video Capture\n");
+               g_print("\t   '2' Add camera device state changed callback\n");
+               g_print("\t   '3' Remove camera device state changed callback\n");
+               g_print("\t   '4' Get camera device state\n");
                g_print("\t   'q' Exit\n");
                g_print("\t=======================================\n");
-
-               g_print("\t  Enter the media type:\n\t");
                break;
        case MENU_STATE_MAIN:
                g_print("\n\t=======================================\n");
-               if (cam_info == CAMERA_DEVICE_CAMERA1)
-                       g_print("\t   Video Capture (Front camera)\n");
-               else if (cam_info == CAMERA_DEVICE_CAMERA0)
-                       g_print("\t   Video Capture (Rear camera)\n");
+               g_print("\t   Video Capture (CAMERA%d)\n", cam_info);
                g_print("\t=======================================\n");
-
                g_print("\t   '1' Stillshot test\n");
                g_print("\t   '2' Multishot test\n");
                g_print("\t   '3' Setting\n");
-               g_print("\t   '4' Change device (Rear <-> Front)\n");
+               g_print("\t   '4' Change device (CAMERA0 <-> CAMERA1)\n");
                g_print("\t   '5' Add preview callback\n");
                g_print("\t   '6' Remove preview callback\n");
                g_print("\t   'b' back\n");
@@ -733,6 +730,7 @@ static void print_menu()
                g_print("\t     'Y' Flip display \n");
                g_print("\t     'g' Brightness \n");
                g_print("\t     'c' Contrast \n");
+               g_print("\t     'h' Hue \n");
                g_print("\t     'w' White balance \n");
                g_print("\t     't' Color tone \n");
                g_print("\t     'd' WDR \n");
@@ -752,9 +750,11 @@ static void print_menu()
                break;
        default:
                g_print("\n\tunknow menu state !!\n");
-               break;
+               return;
        }
 
+       g_print("\tCommand >> ");
+
        return;
 }
 
@@ -762,12 +762,12 @@ static void print_menu()
 static void main_menu(gchar buf)
 {
        int err = 0;
-       camera_state_e capi_state = CAMERA_STATE_NONE;
+       int interval = 0;
+       int count = 0;
 
        switch (buf) {
        case '1': /* Capture */
                hcamcorder->is_multishot = FALSE;
-               camera_get_state(hcamcorder->camera, &capi_state);
                camera_attr_set_image_quality(hcamcorder->camera, 100);
                camera_set_capture_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_JPEG);
                camera_start_capture(hcamcorder->camera, capturing_cb, capture_completed_cb, hcamcorder);
@@ -775,13 +775,12 @@ static void main_menu(gchar buf)
        case '2': /* multishot Capture */
                g_print("multishot capture");
                hcamcorder->is_multishot = TRUE;
-               int interval = 0, count = 0;
-               flush_stdin();
                g_print("\n\tinput interval(ms) : ");
                err = scanf("%d", &interval);
                flush_stdin();
                g_print("\n\tinput count : ");
                err = scanf("%d", &count);
+               flush_stdin();
                camera_attr_set_image_quality(hcamcorder->camera, 100);
                camera_set_capture_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_JPEG);
                camera_start_continuous_capture(hcamcorder->camera, count, interval, capturing_cb, NULL, NULL);
@@ -791,16 +790,15 @@ static void main_menu(gchar buf)
        case '3': /* Setting */
                hcamcorder->menu_state = MENU_STATE_SETTING;
                break;
-       case '4': /* Change device (Rear <-> Front) */
+       case '4': /* Change device (CAMERA0 <-> CAMERA1) */
                camera_set_display_reuse_hint(hcamcorder->camera, true);
 
                camera_stop_preview(hcamcorder->camera);
 
-               if (hcamcorder->type == CAMERA_DEVICE_CAMERA0) {
+               if (hcamcorder->type == CAMERA_DEVICE_CAMERA0)
                        hcamcorder->type = CAMERA_DEVICE_CAMERA1;
-               } else {
+               else
                        hcamcorder->type = CAMERA_DEVICE_CAMERA0;
-               }
 
                camera_change_device(hcamcorder->camera, hcamcorder->type);
 
@@ -824,7 +822,6 @@ static void main_menu(gchar buf)
                camera_destroy(hcamcorder->camera);
                hcamcorder->camera = NULL;
                hcamcorder->menu_state = MENU_STATE_INIT;
-               print_menu();
                break;
        default:
                g_print("\t Invalid input \n");
@@ -847,82 +844,80 @@ static void setting_menu(gchar buf)
        int y = 0;
        int width = 0;
        int height = 0;
+       int result = 0;
 
        switch (buf) {
        /* Camera setting */
        case '0':  /* Setting > Preview Resolution setting */
-               g_print("*Select the preview resolution!\n");
+               g_print("\t* Select the preview resolution!\n");
                resolution_stack resolution_list;
                resolution_list.count = 0;
 
                camera_foreach_supported_preview_resolution(hcamcorder->camera,
                        preview_resolution_cb, &resolution_list);
 
-               flush_stdin();
+               g_print("\tCommand >> ");
+
                err = scanf("%d", &idx);
-               int result = 0;
+               flush_stdin();
                if (resolution_list.count > idx && idx >= 0) {
-                       g_print("-----------------PREVIEW RESOLUTION (%dx%d)---------------------\n",
+                       g_print("\t-----------------PREVIEW RESOLUTION (%dx%d)---------------------\n",
                                resolution_list.width[idx], resolution_list.height[idx]);
 
                        result = camera_set_preview_resolution(hcamcorder->camera,
                                resolution_list.width[idx], resolution_list.height[idx]);
                } else {
-                       g_print("invalid input %d\n", idx);
+                       g_print("\tInvalid command [%d]\n", idx);
                        result = -1;
                }
                resolution_list.count = 0;
-               if (result != 0)
-                       g_print("FAIL\n");
+               if (result == CAMERA_ERROR_NONE)
+                       g_print("\tPASS\n");
                else
-                       g_print("PASS\n");
+                       g_print("\tFAIL\n");
                break;
        case '1': /* Setting > Capture Resolution setting */
-               g_print("*Select the preview resolution!\n");
-               g_print("-----------------CAPTURE RESOLUTION TEST: ---------------------\n");
+               g_print("\t* Select the preview resolution!\n");
                resolution_list.count = 0;
 
                camera_foreach_supported_capture_resolution(hcamcorder->camera,
                        capture_resolution_test_cb, &resolution_list);
 
-               flush_stdin();
+               g_print("\tCommand > ");
+
                err = scanf("%d", &idx);
+               flush_stdin();
                if (resolution_list.count > idx && idx >= 0) {
+                       g_print("\t-----------------CAPTURE RESOLUTION (%dx%d)---------------------\n",
+                               resolution_list.width[idx], resolution_list.height[idx]);
 
                        result = camera_set_capture_resolution(hcamcorder->camera,
                                resolution_list.width[idx], resolution_list.height[idx]);
-
-                       g_print("camera_set_capture_resolution with width =%d, height=%d ret=0x%x\n",
-                               resolution_list.width[idx], resolution_list.height[idx], result);
                } else {
-                       g_print("invalid input %d\n", idx);
+                       g_print("\tInvalid command [%d]\n", idx);
                        result = -1;
                }
                resolution_list.count = 0;
-               if (result != 0)
-                       g_print("FAIL\n");
+               if (result == CAMERA_ERROR_NONE)
+                       g_print("\tPASS\n");
                else
-                       g_print("PASS\n");
-
+                       g_print("\tFAIL\n");
                break;
        case '2': /* Setting > Digital zoom level */
-               g_print("*Digital zoom level  !\n");
                camera_attr_get_zoom_range(hcamcorder->camera, &min, &max);
-               if (min >= max)
-                       g_print("Not supported !! \n");
-               else {
-                       flush_stdin();
-                       g_print("\n Select  Digital zoom level min %d - max %d\n", min, max);
+               if (min > max) {
+                       g_print("\tDigital Zoom Not supported\n");
+               } else {
+                       g_print("\tDigital zoom level [%d ~ %d] > ", min, max);
                        err = scanf("%d", &idx);
+                       flush_stdin();
                        bret = camera_attr_set_zoom(hcamcorder->camera, idx);
                }
                break;
        case '3': /* Setting > AF mode */
-               g_print("*AF mode !\n");
-               g_print("\t1. AF Start !\n");
-               g_print("\t2. AF Stop !\n\n");
-               flush_stdin();
+               g_print("\tAuto Focus [1:Start, 2:Stop] > ");
                err = scanf("%d", &idx);
+               flush_stdin();
                switch (idx) {
                case 1:
                        camera_start_focusing(hcamcorder->camera, 0);
@@ -931,23 +926,24 @@ static void setting_menu(gchar buf)
                        camera_cancel_focusing(hcamcorder->camera);
                        break;
                default:
-                       g_print("Wrong Input[%d] !! \n", idx);
+                       g_print("\tInvalid command [%d]\n", idx);
                        break;
                }
                break;
        case '4': /* Setting > AF scan range */
-               g_print("*AF scan range !\n");
+               g_print("\t* AF scan range !\n");
                camera_attr_foreach_supported_af_mode(hcamcorder->camera, (camera_attr_supported_af_mode_cb)af_mode_foreach_cb, NULL);
-               flush_stdin();
+               g_print("\tCommand > ");
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_af_mode(hcamcorder->camera, idx);
                break;
        case '5': /* Setting > Exposure mode */
                g_print("* Exposure mode!\n");
                camera_attr_foreach_supported_exposure_mode(hcamcorder->camera, (camera_attr_supported_exposure_mode_cb)exposure_mode_cb, NULL);
-               flush_stdin();
                g_print("\n Select  Exposure mode \n");
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_exposure_mode(hcamcorder->camera, idx);
                break;
 
@@ -956,9 +952,9 @@ static void setting_menu(gchar buf)
                if (min >= max)
                        g_print("Not supported !! \n");
                else {
-                       flush_stdin();
                        g_print("\n Select  Exposure mode min%d -max %d\n", min, max);
                        err = scanf("%d", &idx);
+                       flush_stdin();
                        bret = camera_attr_set_exposure(hcamcorder->camera, idx);
                }
                break;
@@ -984,43 +980,43 @@ static void setting_menu(gchar buf)
        case 'i': /* Setting > ISO */
                g_print("*ISO !\n");
                camera_attr_foreach_supported_iso(hcamcorder->camera, iso_mode_cb, NULL);
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                bret =  camera_attr_set_iso(hcamcorder->camera, idx);
                break;
        case 'r': /* Setting > Rotate camera input when recording */
                g_print("*Rotate camera input\n");
                camera_attr_foreach_supported_stream_rotation(hcamcorder->camera, camera_rotation_cb, NULL);
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera));
                bret = camera_attr_set_stream_rotation(hcamcorder->camera, idx);
                CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera));
                break;
        case 'f': /* Setting > Flip camera input */
-               flush_stdin();
                g_print("*Flip camera input\n");
                g_print(" 0. Flip NONE\n");
                g_print(" 1. Flip HORIZONTAL\n");
                g_print(" 2. Flip VERTICAL\n");
                g_print(" 3. Flip BOTH\n");
                err = scanf("%d", &idx);
+               flush_stdin();
                CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera));
                camera_attr_set_stream_flip(hcamcorder->camera, idx);
                CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera));
                break;
        case 'j': /* Setting > Jpeg quality */
                g_print("*Jpeg quality !\n");
-               flush_stdin();
                g_print("\n Select  Jpeg quality \n");
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_image_quality(hcamcorder->camera, idx);
                break;
        case 'p': /* Setting > Picture format */
                g_print("* Picture format!\n");
                camera_foreach_supported_preview_format(hcamcorder->camera, preview_format_cb, NULL);
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_set_preview_format(hcamcorder->camera, idx);
                CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera));
                CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera));
@@ -1035,8 +1031,8 @@ static void setting_menu(gchar buf)
                g_print("\t 6. RIGHT_TOP\n");
                g_print("\t 7. RIGHT_BOTTOM(flipped)\n");
                g_print("\t 8. LEFT_BOTTOM\n");
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                if (idx < 1 || idx > 8)
                        g_print("Wrong INPUT[%d]!! \n", idx);
                else
@@ -1054,10 +1050,10 @@ static void setting_menu(gchar buf)
        case 'v': /* Display visible */
                g_print("* Display visible setting !\n");
                g_print("\n Select Display visible \n");
-               flush_stdin();
                for (i = 0 ; i < 2 ; i++)
                        g_print("\t %d. %s\n", i, visible_mode[i]);
                err = scanf("%d", &idx);
+               flush_stdin();
                if (idx == 0 || idx == 1)
                        bret = camera_set_display_visible(hcamcorder->camera, idx);
                else
@@ -1065,67 +1061,79 @@ static void setting_menu(gchar buf)
                break;
        case 'o': /* Setting > Display Mode */
                g_print("* Display mode!\n");
-               flush_stdin();
                for (i = 0 ; i < 5 ; i++)
                        g_print("%d. %s\n", i, display_mode[i]);
                err = scanf("%d", &idx);
+               flush_stdin();
                bret =  camera_set_display_mode(hcamcorder->camera, idx);
                break;
        case 'y': /* Setting > Rotate Display */
-               flush_stdin();
                g_print("\n Select Rotate mode\n");
                g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t3. 270\n\n");
                err = scanf("%d", &idx);
+               flush_stdin();
                CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera));
                bret = camera_set_display_rotation(hcamcorder->camera, idx);
                CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera));
                break;
        case 'Y': /* Setting > Flip Display */
-               flush_stdin();
                g_print("\n Select Rotate mode\n");
                g_print("\t0. NONE\n\t1. HORIZONTAL\n\t2. VERTICAL\n\t3. BOTH\n\n");
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_set_display_flip(hcamcorder->camera, idx);
                break;
        case 'g': /* Setting > Brightness */
                g_print("*Brightness !\n");
                camera_attr_get_brightness_range(hcamcorder->camera, &min, &max);
-               flush_stdin();
-               g_print("\n Select  brightness min (%d) -max(%d)", min, max);
+               g_print("\n Select brightness min (%d) -max(%d) > ", min, max);
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_brightness(hcamcorder->camera, idx);
                break;
        case 'c': /* Setting > Contrast */
                g_print("*Contrast !\n");
                camera_attr_get_contrast_range(hcamcorder->camera, &min, &max);
-               flush_stdin();
-               g_print("\n Select  Contrast min(%d)-max(%d)", min, max);
+               g_print("\n Select Contrast min(%d)-max(%d) > ", min, max);
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_contrast(hcamcorder->camera, idx);
                break;
+       case 'h': /* Setting > Hue */
+               g_print("*Hue !\n");
+               camera_attr_get_hue_range(hcamcorder->camera, &min, &max);
+               if (max >= min) {
+                       g_print("\n Select Hue min(%d)-max(%d) > ", min, max);
+                       err = scanf("%d", &idx);
+                       flush_stdin();
+                       bret = camera_attr_set_hue(hcamcorder->camera, idx);
+               } else {
+                       g_print("\n Hue is not supported (%d,%d)\n", min, max);
+               }
+               break;
        case 'w': /* Setting > White balance */
                g_print("*White balance !\n");
-               flush_stdin();
                g_print("\n Select White balance \n");
                camera_attr_foreach_supported_whitebalance(hcamcorder->camera, white_balance_cb, NULL);
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_whitebalance(hcamcorder->camera, idx);
                break;
        case 't': /* Setting > Color tone */
                g_print("*Color tone !\n");
                camera_attr_foreach_supported_effect(hcamcorder->camera, colortone_cb, NULL);
                g_print("\n Select Color tone \n");
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_effect(hcamcorder->camera, idx);
                break;
        case 'd': /* Setting > WDR */
                g_print("*WDR !\n");
                g_print("\n Select WDR Mode \n");
-               flush_stdin();
                for (i = 0 ; i < 2 ; i++)
                        g_print("\t %d. %s\n", i+1, wdr_mode[i]);
                err = scanf("%d", &idx);
+               flush_stdin();
                if (idx == 1)
                        bret = camera_attr_enable_auto_contrast(hcamcorder->camera, 0);
                else if (idx == 2)
@@ -1135,14 +1143,14 @@ static void setting_menu(gchar buf)
                g_print("* EV program mode!\n");
                camera_attr_foreach_supported_scene_mode(hcamcorder->camera, program_mode_cb, NULL);
                g_print("\n Select EV program mode \n");
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_scene_mode(hcamcorder->camera, idx);
                break;
        case 'R': /* Setting > Display ROI area */
                g_print("* Set display roi area. Select x y width height \n");
-               flush_stdin();
                err = scanf("%d %d %d %d", &x, &y, &width, &height);
+               flush_stdin();
                camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_CUSTOM_ROI);
                err = camera_attr_set_display_roi_area(hcamcorder->camera, x, y, width, height);
                if (CAMERA_ERROR_NONE != err)
@@ -1160,8 +1168,8 @@ static void setting_menu(gchar buf)
                g_print("*Strobe Mode\n");
                camera_attr_foreach_supported_flash_mode(hcamcorder->camera, strobe_mode_cb, NULL);
                g_print("\n Select Strobe Mode \n");
-               flush_stdin();
                err = scanf("%d", &idx);
+               flush_stdin();
                bret = camera_attr_set_flash_mode(hcamcorder->camera, idx);
                break;
        case 'S': /* Setting > flash state */
@@ -1174,9 +1182,9 @@ static void setting_menu(gchar buf)
                break;
        case 'x': /* Setting > Capture mode ,Muitishot? */
                g_print("*Select Capture mode!\n");
-               flush_stdin();
                g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n");
                err = scanf("%d", &idx);
+               flush_stdin();
 
                switch (idx) {
                case 1:
@@ -1188,10 +1196,10 @@ static void setting_menu(gchar buf)
                        g_print("HDR Capture mode selected\n");
                        hcamcorder->is_multishot = FALSE;
                        g_print("\nSelect HDR capture mode\n");
-                       flush_stdin();
                        for (i = 0 ; i < 3 ; i++)
                                g_print("\t %d. %s\n", i, hdr_mode[i]);
                        err = scanf("%d", &idx);
+                       flush_stdin();
                        if (idx >= CAMERA_ATTR_HDR_MODE_DISABLE && idx <= CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL)
                                bret = camera_attr_set_hdr_mode(hcamcorder->camera, idx);
                        else
@@ -1205,10 +1213,10 @@ static void setting_menu(gchar buf)
        case 'l': /* Setting > Face detection setting */
                if (camera_is_supported_face_detection(hcamcorder->camera)) {
                        g_print("* Face detect mode !\n");
-                       flush_stdin();
                        for (i = 0 ; i < 2 ; i++)
                                g_print("\t %d. %s \n", i, detection_mode[i]);
                        err = scanf("%d", &idx);
+                       flush_stdin();
                        if (idx == 0)
                                bret = camera_stop_face_detection(hcamcorder->camera);
                        else if (idx == 1)
@@ -1222,10 +1230,10 @@ static void setting_menu(gchar buf)
        case 'k': /* Setting > Anti-handshake */
                g_print("*Anti-handshake !\n");
                g_print("\n Select Anti-handshake mode \n");
-               flush_stdin();
                for (i = 0; i < 2; i++)
                        g_print("\t %d. %s\n", i, ahs_mode[i]);
                err = scanf("%d", &idx);
+               flush_stdin();
                if (idx == 0 || idx == 1)
                        bret = camera_attr_enable_anti_shake(hcamcorder->camera, idx);
                else
@@ -1234,11 +1242,10 @@ static void setting_menu(gchar buf)
        case 'K': /* Setting > Video-stabilization */
                g_print("*Video-stabilization !\n");
                g_print("\n Select Video-stabilization mode \n");
-               flush_stdin();
                for (i = 0 ; i < 2 ; i++)
                        g_print("\t %d. %s\n", i, vs_mode[i]);
                err = scanf("%d", &idx);
-
+               flush_stdin();
                if (idx < 0 || idx > 1) {
                        g_print("invalid input %d\n", idx);
                        break;
@@ -1247,6 +1254,7 @@ static void setting_menu(gchar buf)
                if (idx == 1) {
                        g_print("\n Restart preview with NV12 and 720p resolution\n");
                        err = camera_stop_preview(hcamcorder->camera);
+                       g_print("stop preview result 0x%x\n", err);
                        camera_set_preview_resolution(hcamcorder->camera, 1280, 720);
                        camera_set_preview_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_NV12);
                }
@@ -1261,9 +1269,9 @@ static void setting_menu(gchar buf)
                break;
        case 'u': /* Touch AF area */
                g_print("* Touch AF area !\n");
-               flush_stdin();
                g_print("\n Input x,y,width,height \n");
                err = scanf("%d,%d,%d,%d", &x, &y, &width, &height);
+               flush_stdin();
                err = camera_attr_set_af_area(hcamcorder->camera, width, height);
                if (err != 0)
                        g_print("Failed to set touch AF area.(%x)\n", err);
@@ -1272,7 +1280,6 @@ static void setting_menu(gchar buf)
                break;
        case 'n': /* file path */
                g_print("* File path !\n");
-               flush_stdin();
                g_print("\n Input file path to save captured data(string) : ");
                if (fgets(hcamcorder->file_path, sizeof(hcamcorder->file_path), stdin)) {
                        hcamcorder->file_path[strlen(hcamcorder->file_path) - 1] = '\0';
@@ -1374,24 +1381,38 @@ static gboolean mode_change(gchar buf)
 {
        int err = 0;
        camera_device_state_e device_state = CAMERA_DEVICE_STATE_NULL;
+       char camera_type = '\0';
        char display_type = '\0';
        bool check = FALSE;
 
        switch (buf) {
        case '1':
-               hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA1;
-               check = TRUE;
+               while (1) {
+                       g_print("\n\tEnter the Camera Type[0 ~ 9] : ");
+
+                       err = scanf("%c", &camera_type);
+                       flush_stdin();
+                       if (err == EOF) {
+                               g_print("\t!!!read input error!!!\n");
+                               continue;
+                       }
+
+                       if (camera_type < '0' || camera_type > '9') {
+                               g_print("\t Invalid camera type(%c)\n", camera_type);
+                               continue;
+                       }
+
+                       hcamcorder->type = cam_info = camera_type - '0';
+
+                       break;
+               }
                break;
        case '2':
-               hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA0;
-               check = TRUE;
-               break;
-       case '3':
                err = camera_add_device_state_changed_cb(_camera_device_state_changed_cb,
                        NULL, &g_camera_device_changed_cb_id);
                g_print("add result 0x%x - cb id %d\n", err, g_camera_device_changed_cb_id);
                return FALSE;
-       case '4':
+       case '3':
                if (g_camera_device_changed_cb_id > 0) {
                        err = camera_remove_device_state_changed_cb(g_camera_device_changed_cb_id);
                        g_camera_device_changed_cb_id = 0;
@@ -1400,7 +1421,7 @@ static gboolean mode_change(gchar buf)
                        g_print("invalid callback id %d\n", g_camera_device_changed_cb_id);
                }
                return FALSE;
-       case '5':
+       case '4':
                err = camera_get_device_state(CAMERA_DEVICE_CAMERA0, &device_state);
                g_print("get result 0x%x - state %d\n", err, device_state);
                return FALSE;
@@ -1428,14 +1449,11 @@ static gboolean mode_change(gchar buf)
                return -1;
        }
 
-       check = FALSE;
        while (!check) {
-               g_print("\n\tEnter the Display Type\n");
-               g_print("\t'1' OVERLAY surface\n");
-               g_print("\t'2' EVAS surface\n");
-               g_print("\t'3' NONE surface\n");
+               g_print("\n\tEnter the Display Type [1:Overlay, 2:Evas, 3:None] : ");
 
                err = scanf("%c", &display_type);
+               flush_stdin();
                if (err == EOF) {
                        g_print("\t!!!read input error!!!\n");
                        continue;
@@ -1478,8 +1496,6 @@ static gboolean mode_change(gchar buf)
 
        hcamcorder->menu_state = MENU_STATE_MAIN;
 
-       print_menu();
-
        return TRUE;
 }