diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2016-12-14 16:07:03 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2016-12-14 16:07:03 +0900 |
commit | e4430ec88174c5a6316507667da043c897104d26 (patch) | |
tree | ea7d6d82158649d616252a4aebed59d02c293a26 | |
parent | 7c2d80a0c3aa9b064e5f7ea92b9ac2e8c7beac90 (diff) | |
download | camera-e4430ec88174c5a6316507667da043c897104d26.tar.gz camera-e4430ec88174c5a6316507667da043c897104d26.tar.bz2 camera-e4430ec88174c5a6316507667da043c897104d26.zip |
Update camera_test
1. Add new menu to set file path for captured data
2. Remove unused code
[Version] 0.2.90
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20161213.3]
Change-Id: I614239b293563315be65b90777e0355ddde02810
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | test/camera_test.c | 1022 |
2 files changed, 491 insertions, 533 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 85f05b0..260c2de 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.89 +Version: 0.2.90 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/camera_test.c b/test/camera_test.c index 88211eb..7cb2630 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -62,19 +62,12 @@ struct appcore_ops ops = { appdata ad; GIOChannel *stdin_channel; camera_device_e cam_info; -int resolution_set; -int g_current_state; -int src_w, src_h; -int isMultishot; -int camera_state; -int camera_print_state; -int multishot_num; -static GTimer *timer = NULL; +static GTimer *timer; static int g_camera_device_changed_cb_id; GTimeVal previous_time; GTimeVal current_time; -GTimeVal res; +GTimeVal result_time; /*----------------------------------------------------------------------- | GLOBAL CONSTANT DEFINITIONS: | @@ -94,37 +87,9 @@ GTimeVal res; /*----------------------------------------------------------------------- | LOCAL #defines: | -----------------------------------------------------------------------*/ -#define test_ffmux_mp4 - - -#define DISPLAY_X_0 0 /* for direct FB */ -#define DISPLAY_Y_0 0 /* for direct FB */ - -#define DISPLAY_W_320 320 /* for direct FB */ -#define DISPLAY_H_240 240 /* for direct FB */ - - -#define IMAGE_ENC_QUALITY 85 /* quality of jpeg */ -#define IMAGE_CAPTURE_COUNT_STILL 1 /* the number of still-shot */ -#define IMAGE_CAPTURE_COUNT_MULTI 3 /* default the number of multi-shot */ -#define IMAGE_CAPTURE_COUNT_INTERVAL 100 /* millisecond */ - -#define MAX_FILE_SIZE_FOR_MMS (250 * 1024) - -#define EXT_JPEG "jpg" -#define EXT_MP4 "mp4" -#define EXT_3GP "3gp" -#define EXT_AMR "amr" -#define EXT_MKV "mkv" - -#define TARGET_FILENAME_PATH "/home/owner/content/" -#define STILL_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"StillshotCapture" -#define MULTI_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"MultishotCapture" -#define IMAGE_CAPTURE_THUMBNAIL_PATH TARGET_FILENAME_PATH"thumbnail.jpg" -#define IMAGE_CAPTURE_SCREENNAIL_PATH TARGET_FILENAME_PATH"screennail.yuv" -#define IMAGE_CAPTURE_EXIF_PATH TARGET_FILENAME_PATH"exif.raw" -#define CAPTURE_FILENAME_LEN 256 -#define MAX_STILLSHOT_CAPTURE_RESOLUTION_SUPPORTED 2 +#define DEFAULT_FILE_PATH "/home/owner/media" +#define MAX_FILE_NAME_LENGTH 256 +#define MAX_FILE_PATH_LENGTH (MAX_FILE_NAME_LENGTH - 20) #define CHECK_MM_ERROR(expr) \ do {\ @@ -179,14 +144,11 @@ enum { typedef struct _cam_handle { camera_h camera; int type; - int mode; /* image(capture)/video(recording) mode */ - int isMultishot; /* flag for multishot mode */ - int stillshot_count; /* total stillshot count */ - int multishot_count; /* total multishot count */ - const char *stillshot_filename; /* stored filename of stillshot */ - const char *multishot_filename; /* stored filename of multishot */ + int is_multishot; /* flag for multishot mode */ + int stillshot_count; /* stillshot count */ + int multishot_count; /* multishot count */ + char file_path[MAX_FILE_PATH_LENGTH]; /* file path for captured data */ int menu_state; - int isMute; unsigned long long elapsed_time; } cam_handle_t; @@ -484,7 +446,8 @@ static void _camera_device_state_changed_cb(camera_device_e device, camera_devic 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 %d\n", policy); + g_print("\ncamera interrupted callback called[state %d -> %d, policy %d]\n", + previous, current, policy); return; } @@ -639,16 +602,20 @@ static void _file_write(char *path, void *data, int size) static void capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data) { - char m_filename[CAPTURE_FILENAME_LEN]; - - if (!hcamcorder->isMultishot) - snprintf(m_filename, CAPTURE_FILENAME_LEN, "/opt/usr/media/Stillshot%03d.jpg", hcamcorder->multishot_count++); - else - snprintf(m_filename, CAPTURE_FILENAME_LEN, "/opt/usr/media/Multishot%03d.jpg", hcamcorder->stillshot_count++); + char m_filename[MAX_FILE_NAME_LENGTH]; /* main image */ - if (image) + if (image) { + if (hcamcorder->is_multishot) { + snprintf(m_filename, MAX_FILE_NAME_LENGTH, "%s/multishot%03d.jpg", + hcamcorder->file_path, hcamcorder->multishot_count++); + } else { + snprintf(m_filename, MAX_FILE_NAME_LENGTH, "%s/stillshot%03d.jpg", + hcamcorder->file_path, hcamcorder->stillshot_count++); + } + _file_write(m_filename, image->data, image->size); + } return; } @@ -680,21 +647,19 @@ static void print_menu() g_print("\t Enter the media type:\n\t"); break; case MENU_STATE_MAIN: - if (hcamcorder->mode == MODE_VIDEO_CAPTURE) { - 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=======================================\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 'b' back\n"); - g_print("\t=======================================\n"); - } + 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=======================================\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 'b' back\n"); + g_print("\t=======================================\n"); break; case MENU_STATE_SETTING: g_print("\n\t=======================================\n"); @@ -737,7 +702,7 @@ static void print_menu() g_print("\t 'k' Anti-handshake \n"); g_print("\t 'K' Video-stabilization \n"); g_print("\t 'u' Touch AF area \n"); - + g_print("\t 'n' Set file path to write captured image\n"); g_print("\t 'b' back\n"); g_print("\t=======================================\n"); break; @@ -753,71 +718,66 @@ static void print_menu() static void main_menu(gchar buf) { int err = 0; - camera_state_e capi_state; - if (hcamcorder->mode == MODE_VIDEO_CAPTURE) { - switch (buf) { - case '1': /* Capture */ - hcamcorder->isMultishot = 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); - break; - case '2': /* multishot Capture */ - g_print("multishot capture"); - hcamcorder->isMultishot = TRUE; - int interval = 0, count = 0; - flush_stdin(); - g_print("\ninput interval(ms)\n"); - err = scanf("%d", &interval); - flush_stdin(); - g_print("\ninput count(ms) \n"); - err = scanf("%d", &count); - 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); - sleep(3); - camera_start_preview(hcamcorder->camera); - break; - case '3': /* Setting */ - hcamcorder->menu_state = MENU_STATE_SETTING; - break; - case '4': /* Change device (Rear <-> Front) */ - camera_set_display_reuse_hint(hcamcorder->camera, true); + camera_state_e capi_state = CAMERA_STATE_NONE; + + 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); + break; + 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); + 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); + sleep(3); + camera_start_preview(hcamcorder->camera); + break; + case '3': /* Setting */ + hcamcorder->menu_state = MENU_STATE_SETTING; + break; + case '4': /* Change device (Rear <-> Front) */ + camera_set_display_reuse_hint(hcamcorder->camera, true); - camera_stop_preview(hcamcorder->camera); + camera_stop_preview(hcamcorder->camera); - if (hcamcorder->type == CAMERA_DEVICE_CAMERA0) { - hcamcorder->type = CAMERA_DEVICE_CAMERA1; - } else { - hcamcorder->type = CAMERA_DEVICE_CAMERA0; - } + if (hcamcorder->type == CAMERA_DEVICE_CAMERA0) { + hcamcorder->type = CAMERA_DEVICE_CAMERA1; + } else { + hcamcorder->type = CAMERA_DEVICE_CAMERA0; + } - camera_change_device(hcamcorder->camera, hcamcorder->type); + camera_change_device(hcamcorder->camera, hcamcorder->type); - camera_set_error_cb(hcamcorder->camera, _camera_error_cb, NULL); - camera_set_state_changed_cb(hcamcorder->camera, _camera_state_changed_cb, NULL); - camera_set_interrupted_cb(hcamcorder->camera, _camera_interrupted_cb, NULL); + camera_set_error_cb(hcamcorder->camera, _camera_error_cb, NULL); + camera_set_state_changed_cb(hcamcorder->camera, _camera_state_changed_cb, NULL); + camera_set_interrupted_cb(hcamcorder->camera, _camera_interrupted_cb, NULL); - camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX); + camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX); - camera_start_preview(hcamcorder->camera); - break; - case 'b': /* back */ - camera_stop_preview(hcamcorder->camera); - camera_destroy(hcamcorder->camera); - hcamcorder->camera = NULL; - hcamcorder->menu_state = MENU_STATE_INIT; - print_menu(); - break; - default: - g_print("\t Invalid input \n"); - break; - } - } else { - g_print("\t Invalid mode, back to upper menu \n"); + camera_start_preview(hcamcorder->camera); + break; + case 'b': /* back */ + camera_stop_preview(hcamcorder->camera); + camera_destroy(hcamcorder->camera); + hcamcorder->camera = NULL; hcamcorder->menu_state = MENU_STATE_INIT; print_menu(); + break; + default: + g_print("\t Invalid input \n"); + break; } return; @@ -833,419 +793,428 @@ static void setting_menu(gchar buf) int i = 0; int value = 0; int err = 0; - int x = 0, y = 0, width = 0, height = 0; - - if (hcamcorder->mode == MODE_VIDEO_CAPTURE) { - switch (buf) { - /* Camera setting */ - case '0': /* Setting > Preview Resolution setting */ - g_print("*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); + int x = 0; + int y = 0; + int width = 0; + int height = 0; - flush_stdin(); - err = scanf("%d", &idx); - int result = 0; - if (resolution_list.count > idx && idx >= 0) { - g_print("-----------------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); - result = -1; - } - resolution_list.count = 0; - if (result != 0) - g_print("FAIL\n"); - else - g_print("PASS\n"); - break; - case '1': /* Setting > Capture Resolution setting */ - g_print("*Select the preview resolution!\n"); - g_print("-----------------CAPTURE RESOLUTION TEST: ---------------------\n"); - resolution_list.count = 0; - - camera_foreach_supported_capture_resolution(hcamcorder->camera, - capture_resolution_test_cb, &resolution_list); + switch (buf) { + /* Camera setting */ + case '0': /* Setting > Preview Resolution setting */ + g_print("*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(); + err = scanf("%d", &idx); + int result = 0; + if (resolution_list.count > idx && idx >= 0) { + g_print("-----------------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); + result = -1; + } + resolution_list.count = 0; + if (result != 0) + g_print("FAIL\n"); + else + g_print("PASS\n"); + break; + case '1': /* Setting > Capture Resolution setting */ + g_print("*Select the preview resolution!\n"); + g_print("-----------------CAPTURE RESOLUTION TEST: ---------------------\n"); + resolution_list.count = 0; - flush_stdin(); - err = scanf("%d", &idx); - if (resolution_list.count > idx && idx >= 0) { + camera_foreach_supported_capture_resolution(hcamcorder->camera, + capture_resolution_test_cb, &resolution_list); - result = camera_set_capture_resolution(hcamcorder->camera, - resolution_list.width[idx], resolution_list.height[idx]); + flush_stdin(); + err = scanf("%d", &idx); + if (resolution_list.count > idx && idx >= 0) { - 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); - result = -1; - } - resolution_list.count = 0; - if (result != 0) - g_print("FAIL\n"); - else - g_print("PASS\n"); + result = camera_set_capture_resolution(hcamcorder->camera, + resolution_list.width[idx], resolution_list.height[idx]); - 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); - err = scanf("%d", &idx); - 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(); - err = scanf("%d", &idx); - switch (idx) { - case 1: - camera_start_focusing(hcamcorder->camera, 0); - break; - case 2: - camera_cancel_focusing(hcamcorder->camera); - break; - default: - g_print("Wrong Input[%d] !! \n", idx); - break; - } - break; - case '4': /* Setting > AF scan range */ - g_print("*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(); - err = scanf("%d", &idx); - 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); - bret = camera_attr_set_exposure_mode(hcamcorder->camera, idx); - break; + 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); + result = -1; + } + resolution_list.count = 0; + if (result != 0) + g_print("FAIL\n"); + else + g_print("PASS\n"); - case '6': /* Setting > Exposure value */ - camera_attr_get_exposure_range(hcamcorder->camera, &min, &max); - 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); - bret = camera_attr_set_exposure(hcamcorder->camera, idx); - } - break; - case '7': /* Setting > F number */ + 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"); - break; - case '8': /* Setting > Display reuse hint */ - { - bool reuse_hint = false; - - err = camera_get_display_reuse_hint(hcamcorder->camera, &reuse_hint); - if (err != CAMERA_ERROR_NONE) { - g_print("failed to get display reuse hint 0x%x\n", err); - break; - } - - g_print("*Display reuse hint : current %d -> set %d\n", reuse_hint, !reuse_hint); - reuse_hint = !reuse_hint; - err = camera_set_display_reuse_hint(hcamcorder->camera, reuse_hint); - g_print("set display reuse hint result : 0x%x\n", err); - } - break; - 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); - 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); - 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); - 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); - 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); - bret = camera_set_preview_format(hcamcorder->camera, idx); - CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera)); - CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera)); - break; - case 'E': /* Setting > EXIF orientation */ - g_print("* EXIF Orientation\n"); - g_print("\t 1. TOP_LEFT\n"); - g_print("\t 2. TOP_RIGHT(flipped)\n"); - g_print("\t 3. BOTTOM_RIGHT\n"); - g_print("\t 4. BOTTOM_LEFT(flipped)\n"); - g_print("\t 5. LEFT_TOP(flipped)\n"); - 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); - if (idx < 1 || idx > 8) - g_print("Wrong INPUT[%d]!! \n", idx); - else - camera_attr_set_tag_orientation(hcamcorder->camera, idx); - break; - case 'F': /* Getting > Get Facing direction */ - g_print("* Get facing direction of camera module\n"); - err = camera_get_facing_direction(hcamcorder->camera, (camera_facing_direction_e *)&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"); - g_print("\n Select Display visible \n"); - flush_stdin(); - for (i = 0 ; i < 2 ; i++) - g_print("\t %d. %s\n", i+1, visible_mode[i]); - err = scanf("%d", &value); - bret = camera_set_display_visible(hcamcorder->camera, idx-1); - 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); - 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); - 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); - 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); - err = scanf("%d", &idx); - 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); - err = scanf("%d", &idx); - bret = camera_attr_set_contrast(hcamcorder->camera, idx); - 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); - 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); - bret = camera_attr_set_effect(hcamcorder->camera, idx); - break; - case 'd': /* Setting > WDR */ - g_print("*WDR !\n"); - g_print("\n Select WDR Mode \n"); + else { flush_stdin(); - for (i = 0 ; i < 2 ; i++) - g_print("\t %d. %s\n", i+1, wdr_mode[i]); + g_print("\n Select Digital zoom level min %d - max %d\n", min, max); err = scanf("%d", &idx); - if (idx == 1) - bret = camera_attr_enable_auto_contrast(hcamcorder->camera, 0); - else if (idx == 2) - bret = camera_attr_enable_auto_contrast(hcamcorder->camera, 1); + 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(); + err = scanf("%d", &idx); + switch (idx) { + case 1: + camera_start_focusing(hcamcorder->camera, 0); break; - case 'e': /* Setting > EV program mode */ - 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); - bret = camera_attr_set_scene_mode(hcamcorder->camera, idx); + case 2: + camera_cancel_focusing(hcamcorder->camera); 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); - 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) - g_print("* Error : %d\n", err); - - err = camera_attr_get_display_roi_area(hcamcorder->camera, &x, &y, &width, &height); - if (CAMERA_ERROR_NONE == err) - g_print("Current display roi area : x %d, y %d, width %d, height %d\n", x, y, width, height); - else - g_print("* Error : %d\n", err); + default: + g_print("Wrong Input[%d] !! \n", idx); break; + } + break; + case '4': /* Setting > AF scan range */ + g_print("*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(); + err = scanf("%d", &idx); + 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); + bret = camera_attr_set_exposure_mode(hcamcorder->camera, idx); + break; - /* ext. setting */ - case 'z': /* Setting > Strobe setting */ - 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); - bret = camera_attr_set_flash_mode(hcamcorder->camera, idx); - break; - case 'S': /* Setting > flash state */ - g_print("*flash state\n"); - err = camera_get_flash_state(cam_info, (camera_flash_state_e *)&idx); - if (CAMERA_ERROR_NONE == err) - g_print("Current flash state = %s\n", idx ? "ON" : "OFF"); - else - g_print("* Error : %d\n", err); - break; - case 'x': /* Setting > Capture mode ,Muitishot? */ - g_print("*Select Capture mode!\n"); + case '6': /* Setting > Exposure value */ + camera_attr_get_exposure_range(hcamcorder->camera, &min, &max); + if (min >= max) + g_print("Not supported !! \n"); + else { flush_stdin(); - g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n"); + g_print("\n Select Exposure mode min%d -max %d\n", min, max); err = scanf("%d", &idx); + bret = camera_attr_set_exposure(hcamcorder->camera, idx); + } + break; + case '7': /* Setting > F number */ + g_print("Not supported !! \n"); + break; + case '8': /* Setting > Display reuse hint */ + { + bool reuse_hint = false; - switch (idx) { - case 1: - g_print("stillshot mode selected and capture callback is set!!!!\n"); - hcamcorder->isMultishot = FALSE; - camera_attr_set_hdr_mode(hcamcorder->camera, 0); - break; - case 2: - g_print("HDR Capture mode selected\n"); - hcamcorder->isMultishot = FALSE; - g_print("\nSelect HDR capture mode\n"); - flush_stdin(); - for (i = 0 ; i < 3 ; i++) - g_print("\t %d. %s\n", i+1, hdr_mode[i]); - err = scanf("%d", &idx); - bret = camera_attr_set_hdr_mode(hcamcorder->camera, idx-1); - break; - default: - g_print("Wrong input, select again!!\n"); + err = camera_get_display_reuse_hint(hcamcorder->camera, &reuse_hint); + if (err != CAMERA_ERROR_NONE) { + g_print("failed to get display reuse hint 0x%x\n", err); break; } + + g_print("*Display reuse hint : current %d -> set %d\n", reuse_hint, !reuse_hint); + reuse_hint = !reuse_hint; + err = camera_set_display_reuse_hint(hcamcorder->camera, reuse_hint); + g_print("set display reuse hint result : 0x%x\n", err); + } + break; + 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); + 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); + 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); + 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); + 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); + bret = camera_set_preview_format(hcamcorder->camera, idx); + CHECK_MM_ERROR(camera_stop_preview(hcamcorder->camera)); + CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera)); + break; + case 'E': /* Setting > EXIF orientation */ + g_print("* EXIF Orientation\n"); + g_print("\t 1. TOP_LEFT\n"); + g_print("\t 2. TOP_RIGHT(flipped)\n"); + g_print("\t 3. BOTTOM_RIGHT\n"); + g_print("\t 4. BOTTOM_LEFT(flipped)\n"); + g_print("\t 5. LEFT_TOP(flipped)\n"); + 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); + if (idx < 1 || idx > 8) + g_print("Wrong INPUT[%d]!! \n", idx); + else + camera_attr_set_tag_orientation(hcamcorder->camera, idx); + break; + case 'F': /* Getting > Get Facing direction */ + g_print("* Get facing direction of camera module\n"); + err = camera_get_facing_direction(hcamcorder->camera, (camera_facing_direction_e *)&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"); + g_print("\n Select Display visible \n"); + flush_stdin(); + for (i = 0 ; i < 2 ; i++) + g_print("\t %d. %s\n", i+1, visible_mode[i]); + err = scanf("%d", &value); + bret = camera_set_display_visible(hcamcorder->camera, idx-1); + 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); + 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); + 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); + 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); + err = scanf("%d", &idx); + 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); + err = scanf("%d", &idx); + bret = camera_attr_set_contrast(hcamcorder->camera, idx); + 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); + 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); + 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); + if (idx == 1) + bret = camera_attr_enable_auto_contrast(hcamcorder->camera, 0); + else if (idx == 2) + bret = camera_attr_enable_auto_contrast(hcamcorder->camera, 1); + break; + case 'e': /* Setting > EV program mode */ + 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); + 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); + 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) + g_print("* Error : %d\n", err); + + err = camera_attr_get_display_roi_area(hcamcorder->camera, &x, &y, &width, &height); + if (CAMERA_ERROR_NONE == err) + g_print("Current display roi area : x %d, y %d, width %d, height %d\n", x, y, width, height); + else + g_print("* Error : %d\n", err); + break; + + /* ext. setting */ + case 'z': /* Setting > Strobe setting */ + 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); + bret = camera_attr_set_flash_mode(hcamcorder->camera, idx); + break; + case 'S': /* Setting > flash state */ + g_print("*flash state\n"); + err = camera_get_flash_state(cam_info, (camera_flash_state_e *)&idx); + if (CAMERA_ERROR_NONE == err) + g_print("Current flash state = %s\n", idx ? "ON" : "OFF"); + else + g_print("* Error : %d\n", err); + 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); + + switch (idx) { + case 1: + g_print("stillshot mode selected and capture callback is set!!!!\n"); + hcamcorder->is_multishot = FALSE; + camera_attr_set_hdr_mode(hcamcorder->camera, 0); break; - case 'l': /* Setting > Face detection setting */ - g_print("* Face detect mode !\n"); - flush_stdin(); - for (i = 0 ; i < 2 ; i++) - g_print("\t %d. %s \n", i+1, detection_mode[i]); - err = scanf("%d", &idx); - if (camera_is_supported_face_detection(hcamcorder->camera)) { - if (idx >= 0 && idx < 2) - bret = camera_start_face_detection(hcamcorder->camera, _face_detected, NULL); - } else - g_print("face detection_not supported"); - break; - 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+1, ahs_mode[i]); - err = scanf("%d", &idx); - bret = camera_attr_enable_anti_shake(hcamcorder->camera, idx-1); - break; - case 'K': /* Setting > Video-stabilization */ - g_print("*Video-stabilization !\n"); - g_print("\n Select Video-stabilization mode \n"); + case 2: + g_print("HDR Capture mode selected\n"); + hcamcorder->is_multishot = FALSE; + g_print("\nSelect HDR capture mode\n"); flush_stdin(); - for (i = 0 ; i < 2 ; i++) - g_print("\t %d. %s\n", i+1, vs_mode[i]); + for (i = 0 ; i < 3 ; i++) + g_print("\t %d. %s\n", i+1, hdr_mode[i]); err = scanf("%d", &idx); - if (idx == 1) { - g_print("\n Restart preview with NV12 and 720p resolution\n"); - err = camera_stop_preview(hcamcorder->camera); - camera_set_preview_resolution(hcamcorder->camera, 1280, 720); - camera_set_preview_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_NV12); - camera_attr_enable_video_stabilization(hcamcorder->camera, idx-1); - if (err == 0) { - err = camera_start_preview(hcamcorder->camera); - if (err != 0) - g_print("\n Restart FAILED! %x\n", err); - } - } - 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); - err = camera_attr_set_af_area(hcamcorder->camera, width, height); - if (err != 0) - g_print("Failed to set touch AF area.(%x)\n", err); - else - g_print("Succeed to set touch AF area.\n"); - break; - case 'b': /* back */ - hcamcorder->menu_state = MENU_STATE_MAIN; + bret = camera_attr_set_hdr_mode(hcamcorder->camera, idx-1); break; default: - g_print("\t Invalid input \n"); + g_print("Wrong input, select again!!\n"); break; } - } else { - g_print("\t Invalid mode, back to upper menu \n"); + break; + case 'l': /* Setting > Face detection setting */ + g_print("* Face detect mode !\n"); + flush_stdin(); + for (i = 0 ; i < 2 ; i++) + g_print("\t %d. %s \n", i+1, detection_mode[i]); + err = scanf("%d", &idx); + if (camera_is_supported_face_detection(hcamcorder->camera)) { + if (idx >= 0 && idx < 2) + bret = camera_start_face_detection(hcamcorder->camera, _face_detected, NULL); + } else + g_print("face detection_not supported"); + break; + 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+1, ahs_mode[i]); + err = scanf("%d", &idx); + bret = camera_attr_enable_anti_shake(hcamcorder->camera, idx-1); + break; + 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+1, vs_mode[i]); + err = scanf("%d", &idx); + if (idx == 1) { + g_print("\n Restart preview with NV12 and 720p resolution\n"); + err = camera_stop_preview(hcamcorder->camera); + camera_set_preview_resolution(hcamcorder->camera, 1280, 720); + camera_set_preview_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_NV12); + camera_attr_enable_video_stabilization(hcamcorder->camera, idx-1); + if (err == 0) { + err = camera_start_preview(hcamcorder->camera); + if (err != 0) + g_print("\n Restart FAILED! %x\n", err); + } + } + 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); + err = camera_attr_set_af_area(hcamcorder->camera, width, height); + if (err != 0) + g_print("Failed to set touch AF area.(%x)\n", err); + else + g_print("Succeed to set touch AF area.\n"); + 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'; + g_print("\ncaptured data will be saved in [%s]\n", hcamcorder->file_path); + } else { + g_print("\nset file path failed\n"); + } + break; + case 'b': /* back */ hcamcorder->menu_state = MENU_STATE_MAIN; + break; + default: + g_print("\t Invalid input \n"); + break; } g_print("\t bret : 0x%x \n", bret); @@ -1309,16 +1278,12 @@ static gboolean cmd_input(GIOChannel *channel) static gboolean init_handle() { - hcamcorder->mode = MODE_VIDEO_CAPTURE; /* image(capture)/video(recording) mode */ - hcamcorder->isMultishot = FALSE; - hcamcorder->stillshot_count = 0; /* total stillshot count */ - hcamcorder->multishot_count = 0; /* total multishot count */ - hcamcorder->stillshot_filename = STILL_CAPTURE_FILE_PATH_NAME; /* stored filename of stillshot */ - hcamcorder->multishot_filename = MULTI_CAPTURE_FILE_PATH_NAME; /* stored filename of multishot */ + hcamcorder->is_multishot = FALSE; + hcamcorder->stillshot_count = 0; + hcamcorder->multishot_count = 0; + snprintf(hcamcorder->file_path, MAX_FILE_PATH_LENGTH, DEFAULT_FILE_PATH); hcamcorder->menu_state = MENU_STATE_INIT; - hcamcorder->isMute = FALSE; hcamcorder->elapsed_time = 0; - multishot_num = IMAGE_CAPTURE_COUNT_MULTI; return TRUE; } @@ -1376,12 +1341,10 @@ static gboolean mode_change(gchar buf) switch (buf) { case '1': - hcamcorder->mode = MODE_VIDEO_CAPTURE; hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA1; check = TRUE; break; case '2': - hcamcorder->mode = MODE_VIDEO_CAPTURE; hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA0; check = TRUE; break; @@ -1405,7 +1368,6 @@ static gboolean mode_change(gchar buf) return FALSE; case 'q': g_print("\t Quit Camcorder Testsuite!!\n"); - hcamcorder->mode = -1; elm_exit(); return FALSE; default: @@ -1428,8 +1390,6 @@ static gboolean mode_change(gchar buf) return -1; } - camera_print_state = CAMERA_STATE_CREATED; - check = FALSE; while (!check) { g_print("\n\tEnter the Display Type\n"); @@ -1473,11 +1433,10 @@ static gboolean mode_change(gchar buf) camera_start_preview(hcamcorder->camera); g_get_current_time(¤t_time); - timersub(¤t_time, &previous_time, &res); + timersub(¤t_time, &previous_time, &result_time); - g_print("\n\tCamera Starting Time : %ld.%lds\n", res.tv_sec, res.tv_usec); + g_print("\n\tCamera Starting Time : %ld.%lds\n", result_time.tv_sec, result_time.tv_usec); - camera_print_state = CAMERA_STATE_PREVIEW; hcamcorder->menu_state = MENU_STATE_MAIN; print_menu(); @@ -1596,7 +1555,6 @@ int main(int argc, char **argv) int bret; hcamcorder = (cam_handle_t *) g_malloc0(sizeof(cam_handle_t)); - camera_state = CAMERA_STATE_NONE; stdin_channel = g_io_channel_unix_new(fileno(stdin));/* read from stdin */ g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)cmd_input, NULL); |