summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2018-01-05 14:53:59 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2018-01-08 11:39:09 +0900
commitedf0e298479c0f1378c28a0caf75d5e5831b7b8a (patch)
tree874b5baa6bce05e9516bfafc3e1a4fc6f4ac57ed /test
parentb92ea117ad886fcb3ac2306f6323aeca0d790a07 (diff)
downloadcamera-edf0e298479c0f1378c28a0caf75d5e5831b7b8a.tar.gz
camera-edf0e298479c0f1378c28a0caf75d5e5831b7b8a.tar.bz2
camera-edf0e298479c0f1378c28a0caf75d5e5831b7b8a.zip
- Change command layout - Remove duplicated menu print - Fix command input bug [Version] 0.4.3 [Profile] Common [Issue Type] Update [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20180104.2] Change-Id: Id88d4c4604bbeb574592a90ee67521285d3e96e5 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
Diffstat (limited to 'test')
-rw-r--r--test/camera_test.c212
1 files changed, 102 insertions, 110 deletions
diff --git a/test/camera_test.c b/test/camera_test.c
index 9674880..6dbb868 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -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;
}
@@ -684,17 +688,11 @@ static void print_menu()
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");
@@ -752,9 +750,11 @@ static void print_menu()
break;
default:
g_print("\n\tunknow menu state !!\n");
- break;
+ return;
}
+ g_print("\tCommand >> ");
+
return;
}
@@ -777,12 +777,12 @@ static void main_menu(gchar buf)
case '2': /* multishot Capture */
g_print("multishot capture");
hcamcorder->is_multishot = TRUE;
- 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);
@@ -797,11 +797,10 @@ static void main_menu(gchar buf)
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);
@@ -825,7 +824,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");
@@ -853,77 +851,75 @@ static void setting_menu(gchar buf)
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);
+ 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);
@@ -932,23 +928,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;
@@ -957,9 +954,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;
@@ -985,43 +982,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));
@@ -1036,8 +1033,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
@@ -1055,10 +1052,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
@@ -1066,51 +1063,51 @@ 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) {
- flush_stdin();
- g_print("\n Select Hue min(%d)-max(%d)", min, max);
+ 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);
@@ -1118,27 +1115,27 @@ static void setting_menu(gchar buf)
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)
@@ -1148,14 +1145,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)
@@ -1173,8 +1170,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 */
@@ -1187,9 +1184,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:
@@ -1201,10 +1198,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
@@ -1218,10 +1215,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)
@@ -1235,10 +1232,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
@@ -1247,11 +1244,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;
@@ -1275,9 +1271,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);
@@ -1286,7 +1282,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';
@@ -1395,9 +1390,10 @@ static gboolean mode_change(gchar buf)
switch (buf) {
case '1':
while (1) {
- g_print("\n\tEnter the Camera Type[0 ~ 9]\n");
+ 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;
@@ -1456,12 +1452,10 @@ static gboolean mode_change(gchar buf)
}
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;
@@ -1504,8 +1498,6 @@ static gboolean mode_change(gchar buf)
hcamcorder->menu_state = MENU_STATE_MAIN;
- print_menu();
-
return TRUE;
}