Add recorder setting menu and clean-up unnecessary code 43/98143/4 accepted/tizen/common/20161122.192906 accepted/tizen/ivi/20161122.235930 accepted/tizen/mobile/20161122.235722 accepted/tizen/tv/20161122.235807 accepted/tizen/wearable/20161122.235845 submit/tizen/20161122.044017
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 16 Nov 2016 08:26:49 +0000 (17:26 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 21 Nov 2016 09:22:49 +0000 (18:22 +0900)
[Version] 0.2.45-1
[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_20161115.1]

Change-Id: I92f9b60e8cdbdec5ff39e6bac2f819aad31ddb8c
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-recorder.spec
test/recorder_test.c

index 97e6e35..622e176 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-media-recorder
 Summary:    A Recorder API
 Version:    0.2.45
-Release:    0
+Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 0b81fa6..7a2040c 100644 (file)
@@ -94,29 +94,12 @@ static int g_recorder_device_changed_cb_id;
 /*-----------------------------------------------------------------------
   |    LOCAL #defines:                                                    |
   -----------------------------------------------------------------------*/
-
-
-#define DISPLAY_W_320                       320                 /* for direct FB */
-#define DISPLAY_H_240                       240                 /* for direct FB */
-
-
 #define SRC_VIDEO_FRAME_RATE_15         15    /* video input frame rate */
 #define SRC_VIDEO_FRAME_RATE_30         30    /* video input frame rate */
-#define IMAGE_ENC_QUALITY               85    /* quality of jpeg */
-
-#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            "/opt/usr/home/owner/media/Sounds/"
-#define IMAGE_CAPTURE_EXIF_PATH         TARGET_FILENAME_PATH"exif.raw"
 #define TARGET_FILENAME_VIDEO           TARGET_FILENAME_PATH"test_rec_video.mp4"
 #define TARGET_FILENAME_AUDIO           TARGET_FILENAME_PATH"test_rec_audio.m4a"
-#define CAPTURE_FILENAME_LEN            256
 
 #define AUDIO_SOURCE_SAMPLERATE_AAC     44100
 #define AUDIO_SOURCE_SAMPLERATE_AMR     8000
@@ -134,7 +117,6 @@ static int g_recorder_device_changed_cb_id;
                } \
        } while (0)
 
-
 #ifndef SAFE_FREE
 #define SAFE_FREE(x)       if (x) { g_free(x); x = NULL; }
 #endif
@@ -143,21 +125,6 @@ static int g_recorder_device_changed_cb_id;
 GTimeVal previous;
 GTimeVal current;
 GTimeVal res;
-/* temp */
-
-/**
- * Enumerations for command
- */
-#define SENSOR_WHITEBALANCE_NUM     10
-#define SENSOR_COLOR_TONE_NUM       31
-#define SENSOR_FLIP_NUM         3
-#define SENSOR_PROGRAM_MODE_NUM     15
-#define SENSOR_FOCUS_NUM        6
-#define SENSOR_INPUT_ROTATION       4
-#define SENSOR_AF_SCAN_NUM      4
-#define SENSOR_ISO_NUM          8
-#define SENSOR_EXPOSURE_NUM     9
-#define SENSOR_IMAGE_FORMAT     9
 
 
 /*-----------------------------------------------------------------------
@@ -189,246 +156,68 @@ typedef struct _cam_handle {
        unsigned long long elapsed_time;
 } cam_handle_t;
 
-typedef struct _cam_xypair {
-       const char *attr_subcat_x;
-       const char *attr_subcat_y;
-       int x;
-       int y;
-} cam_xypair_t;
-
 typedef struct {
-       int width[100];
-       int height[100];
+       int width[20];
+       int height[20];
        int count;
 } resolution_stack;
 
-typedef struct {
-       camera_attr_exposure_mode_e mode;
-       int count;
-} exposure_stack;
-
-typedef struct {
-       camera_attr_iso_e mode;
-       int count;
-} iso_stack;
-
-typedef struct {
-       camera_rotation_e mode;
-       int count;
-} camera_rotation_stack;
 
 /*---------------------------------------------------------------------------
   |    LOCAL VARIABLE DEFINITIONS:                                            |
   ---------------------------------------------------------------------------*/
-static cam_handle_t *hcamcorder ;
-
-const char *wb[SENSOR_WHITEBALANCE_NUM] = {
-       "None",
-       "Auto",
-       "Daylight",
-       "Cloudy",
-       "Fluoroscent",
-       "Incandescent",
-       "Shade",
-       "Horizon",
-       "Flash",
-       "Custom",
-};
-
-const char *ct[SENSOR_COLOR_TONE_NUM] = {
-       "NONE",
-       "MONO",
-       "SEPIA",
-       "NEGATIVE",
-       "BLUE",
-       "GREEN",
-       "AQUA",
-       "VIOLET",
-       "ORANGE",
-       "GRAY",
-       "RED",
-       "ANTIQUE",
-       "WARM",
-       "PINK",
-       "YELLOW",
-       "PURPLE",
-       "EMBOSS",
-       "OUTLINE",
-       "SOLARIZATION",
-       "SKETCH",
-       "WASHED",
-       "VINTAGE_WARM",
-       "VINTAGE_COLD",
-       "POSTERIZATION",
-       "CARTOON",
-       "SELECTVE_COLOR_RED",
-       "SELECTVE_COLOR_GREEN",
-       "SELECTVE_COLOR_BLUE",
-       "SELECTVE_COLOR_YELLOW",
-       "SELECTVE_COLOR_RED_YELLOW",
-       "GRAPHICS"
-};
-
-const char *flip[SENSOR_FLIP_NUM] = {
-       "Horizontal",
-       "Vertical",
-       "Not flipped",
-};
-
-const char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
-       "NORMAL",
-       "PORTRAIT",
-       "LANDSCAPE",
-       "SPORTS",
-       "PARTY_N_INDOOR",
-       "BEACH_N_INDOOR",
-       "SUNSET",
-       "DUSK_N_DAWN",
-       "FALL_COLOR",
-       "NIGHT_SCENE",
-       "FIREWORK",
-       "TEXT",
-       "SHOW_WINDOW",
-       "CANDLE_LIGHT",
-       "BACKLIGHT",
-};
-
-const char *focus_mode[SENSOR_FOCUS_NUM] = {
-       "None",
-       "Pan",
-       "Auto",
-       "Manual",
-       "Touch Auto",
-       "Continuous Auto",
-};
-
-const char *camera_rotation[SENSOR_INPUT_ROTATION] = {
-       "None",
-       "90",
-       "180",
-       "270",
-};
-
-const char *af_scan[SENSOR_AF_SCAN_NUM] = {
-       "None",
-       "Normal",
-       "Macro mode",
-       "Full mode",
-};
-
-const char *iso_mode[SENSOR_ISO_NUM] = {
-       "ISO Auto",
-       "ISO 50",
-       "ISO 100",
-       "ISO 200",
-       "ISO 400",
-       "ISO 800",
-       "ISO 1600",
-       "ISO 3200",
-};
-
-const char *exposure_mode[SENSOR_EXPOSURE_NUM] = {
-       "AE off",
-       "AE all mode",
-       "AE center 1 mode",
-       "AE center 2 mode",
-       "AE center 3 mode",
-       "AE spot 1 mode",
-       "AE spot 2 mode",
-       "AE custom 1 mode",
-       "AE custom 2 mode",
-};
+static cam_handle_t *hcamcorder;
 
-const char *image_fmt[SENSOR_IMAGE_FORMAT] = {
-       "NV12",
-       "NV12T",
-       "NV16",
-       "NV21",
-       "YUYV",
-       "UYVY",
-       "422P",
-       "I420",
-       "YV12",
+const char *video_codec[4] = {
+       "H.263",
+       "H.264",
+       "MPEG4",
+       "THEORA"
 };
 
-const char *face_zoom_mode[] = {
-       "Face Zoom OFF",
-       "Face Zoom ON",
+const char *audio_codec[5] = {
+       "AMR",
+       "AAC",
+       "VORBIS",
+       "PCM",
+       "MP3"
 };
 
-const char *display_mode[] = {
-       "Default",
-       "Primary Video ON and Secondary Video Full Screen",
-       "Primary Video OFF and Secondary Video Full Screen",
+const char *file_format[7] = {
+       "3GP",
+       "MP4",
+       "AMR",
+       "ADTS",
+       "WAV",
+       "OGG",
+       "M2TS"
 };
 
-const char *output_mode[] = {
+const char *display_mode[6] = {
        "Letter Box mode",
        "Original Size mode",
        "Full Screen mode",
        "Cropped Full Screen mode",
-       "ROI mode",
-};
-
-const char *capture_sound[] = {
-       "Default",
-       "Extra 01",
-       "Extra 02",
-};
-
-const char *rotate_mode[] = {
-       "0",
-       "90",
-       "180",
-       "270",
+       "Original size or Letter Box mode",
+       "ROI mode"
 };
 
 const char* strobe_mode[] = {
-       "Strobe OFF",
-       "Strobe ON",
-       "Strobe Auto",
-       "Strobe RedEyeReduction",
-       "Strobe SlowSync",
-       "Strobe FrontCurtain",
-       "Strobe RearCurtain",
-       "Strobe Permanent",
-};
-
-const char *detection_mode[2] = {
-       "Face Detection OFF",
-       "Face Detection ON",
-};
-
-const char *wdr_mode[] = {
-       "WDR OFF",
-       "WDR ON",
-       "WDR AUTO",
-};
-
-const char *hdr_mode[] = {
-       "HDR OFF",
-       "HDR ON",
-       "HDR ON and Original",
-};
-
-const char *ahs_mode[] = {
-       "Anti-handshake OFF",
-       "Anti-handshake ON",
-       "Anti-handshake AUTO",
-       "Anti-handshake MOVIE",
+       "OFF",
+       "ON",
+       "Auto",
+       "RedEyeReduction",
+       "SlowSync",
+       "FrontCurtain",
+       "RearCurtain",
+       "Permanent",
 };
 
 const char *vs_mode[] = {
-       "Video-stabilization OFF",
-       "Video-stabilization ON",
+       "OFF",
+       "ON",
 };
 
-const char *visible_mode[] = {
-       "Display OFF",
-       "Display ON",
-};
-
-
 /*---------------------------------------------------------------------------
   |    LOCAL FUNCTION PROTOTYPES:                                             |
   ---------------------------------------------------------------------------*/
@@ -438,7 +227,7 @@ static gboolean init(int type);
 static gboolean mode_change(gchar buf);
 
 
-static bool preview_resolution_cb(int width, int height, void *user_data)
+static bool resolution_cb(int width, int height, void *user_data)
 {
        resolution_stack *data = (resolution_stack*)user_data;
 
@@ -457,65 +246,21 @@ static bool preview_resolution_cb(int width, int height, void *user_data)
        return true;
 }
 
-static bool af_mode_foreach_cb(camera_attr_iso_e mode , void *user_data)
-{
-       g_print("%d.%s\n", mode, af_scan[mode]);
-       return true;
-}
-
-static bool exposure_mode_cb(camera_attr_af_mode_e mode , void *user_data)
-{
-       exposure_stack *data = (exposure_stack*)user_data;
-
-       if (data == NULL) {
-               g_print("NULL data\n");
-               return false;
-       }
-
-       data->mode = mode;
-       data->count++;
-
-       g_print("%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]);
-       return true;
-}
-
-static bool camera_rotation_cb(camera_rotation_e mode , void *user_data)
-{
-       camera_rotation_stack *data = (camera_rotation_stack*)user_data;
-
-       if (data == NULL) {
-               g_print("NULL data\n");
-               return false;
-       }
-
-       data->mode = mode;
-       data->count++;
-
-       g_print("%d.%s\n", mode, camera_rotation[mode]);
-       return true;
-}
-
-static bool white_balance_cb(camera_attr_whitebalance_e mode , void *user_data)
+static bool video_codec_cb(recorder_video_codec_e codec, void *user_data)
 {
-       g_print("%d.%s\n", mode, wb[mode]);
+       g_print("%d. %s\n", codec, video_codec[codec]);
        return true;
 }
 
-static bool colortone_cb(camera_attr_effect_mode_e mode , void *user_data)
+static bool audio_codec_cb(recorder_audio_codec_e codec, void *user_data)
 {
-       g_print("%d.%s\n", mode, ct[mode]);
+       g_print("%d. %s\n", codec, audio_codec[codec]);
        return true;
 }
 
-static bool program_mode_cb(camera_attr_scene_mode_e mode , void *user_data)
+static bool file_format_cb(recorder_file_format_e format, void *user_data)
 {
-       g_print("%d.%s\n", mode, program_mode[mode]);
+       g_print("%d. %s\n", format, file_format[format]);
        return true;
 }
 
@@ -525,18 +270,6 @@ static bool strobe_mode_cb(camera_attr_flash_mode_e mode , void *user_data)
        return true;
 }
 
-static void _face_detected(camera_detected_face_s *faces, int count, void *user_data)
-{
-       int i;
-
-       g_print("face detected!!\n");
-
-       for (i = 0 ; i < count ; i++)
-               g_print("%d) - %dx%d\n", faces[i].id, faces[i].x, faces[i].y);
-
-       return;
-}
-
 static void _state_changed_cb(recorder_state_e previous_state, recorder_state_e current_state, bool by_policy, void *user_data)
 {
        g_print("\n\tstate changed[by_policy:%d] : %d -> %d\n\n", by_policy, previous_state, current_state);
@@ -640,6 +373,8 @@ static void print_menu()
        case MENU_STATE_MAIN:
                if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
                        g_print("\n\t=======================================\n");
+                       g_print("\t   Video + Audio Recording\n");
+                       g_print("\t=======================================\n");
                        if (recorder_state <= RECORDER_STATE_NONE) {
                                g_print("\t   '1' Start Recording\n");
                                g_print("\t   '2' Setting\n");
@@ -654,12 +389,13 @@ static void print_menu()
                                g_print("\t   's' Save\n");
                        }
                        g_print("\t=======================================\n");
-               } else if (hcamcorder->mode == MODE_AUDIO) {
+               } else {
                        g_print("\n\t=======================================\n");
                        g_print("\t   Audio Recording\n");
                        g_print("\t=======================================\n");
                        if (recorder_state <= RECORDER_STATE_NONE) {
                                g_print("\t   '1' Start Recording\n");
+                               g_print("\t   '2' Setting\n");
                                g_print("\t   'b' back\n");
                        } else if (recorder_state == RECORDER_STATE_RECORDING) {
                                g_print("\t   'p' Pause Recording\n");
@@ -675,46 +411,46 @@ static void print_menu()
                break;
 
        case MENU_STATE_SETTING:
-               g_print("\n\t=======================================\n");
-               g_print("\t   Video Capture > Setting\n");
-               g_print("\t=======================================\n");
-               g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>> [Camera]  \n");
-               g_print("\t     '0' Preview resolution \n");
-               g_print("\t     '2' Digital zoom level \n");
-               g_print("\t     '3' Optical zoom level \n");
-               g_print("\t     '4' AF mode \n");
-               g_print("\t     '5' AF scan range \n");
-               g_print("\t     '6' Exposure mode \n");
-               g_print("\t     '7' Exposure value \n");
-               g_print("\t     '8' F number \n");
-               g_print("\t     '9' Shutter speed \n");
-               g_print("\t     'i' ISO \n");
-               g_print("\t     'r' Rotate camera input \n");
-               g_print("\t     'f' Flip camera input \n");
-               g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n");
-               g_print("\t     'v' Visible \n");
-               g_print("\t     'n' Display mode \n");
-               g_print("\t     'o' Output mode \n");
-               g_print("\t     'y' Rotate display \n");
-               g_print("\t     'Y' Flip display \n");
-               g_print("\t     'g' Brightness \n");
-               g_print("\t     'c' Contrast \n");
-               g_print("\t     's' Saturation \n");
-               g_print("\t     'h' Hue \n");
-               g_print("\t     'a' Sharpness \n");
-               g_print("\t     'w' White balance \n");
-               g_print("\t     't' Color tone \n");
-               g_print("\t     'd' WDR \n");
-               g_print("\t     'e' EV program mode \n");
-               g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc.]\n");
-               g_print("\t     'z' Strobe (Flash) \n");
-               g_print("\t     'l' Face detection \n");
-               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     'M' Camcorder Motion Rate setting \n");
-               g_print("\t     'b' back\n");
-               g_print("\t=======================================\n");
+               if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
+                       g_print("\n\t=======================================\n");
+                       g_print("\t   Video + Audio recording > Setting\n");
+                       g_print("\t=======================================\n");
+                       g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>> [Camera/Recorder]  \n");
+                       g_print("\t     '0' Preview resolution \n");
+                       g_print("\t     '1' Video resolution \n");
+                       g_print("\t     '2' Video codec \n");
+                       g_print("\t     '3' Audio codec \n");
+                       g_print("\t     '4' File format \n");
+                       g_print("\t     '5' Size limit \n");
+                       g_print("\t     '6' Time limit \n");
+                       g_print("\t     '7' Samplerate \n");
+                       g_print("\t     '8' Channel \n");
+                       g_print("\t     '9' Encoder bitrate \n");
+                       g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display]\n");
+                       g_print("\t     'v' Display visible \n");
+                       g_print("\t     'd' Display mode \n");
+                       g_print("\t     'r' Display rotation \n");
+                       g_print("\t     'f' Display flip\n");
+                       g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc]\n");
+                       g_print("\t     's' Strobe (Flash) \n");
+                       g_print("\t     'z' Video-stabilization \n");
+                       g_print("\t     'm' Camcorder Motion Rate setting \n");
+                       g_print("\t     'b' back\n");
+                       g_print("\t=======================================\n");
+               } else {
+                       g_print("\n\t=======================================\n");
+                       g_print("\t   Audio recording > Setting\n");
+                       g_print("\t=======================================\n");
+                       g_print("\t     '1' Audio codec \n");
+                       g_print("\t     '2' File format \n");
+                       g_print("\t     '3' Size limit \n");
+                       g_print("\t     '4' Time limit \n");
+                       g_print("\t     '5' Samplerate \n");
+                       g_print("\t     '6' Channel \n");
+                       g_print("\t     '7' Encoder bitrate \n");
+                       g_print("\t     'b' back\n");
+                       g_print("\t=======================================\n");
+               }
                break;
 
        default:
@@ -760,7 +496,6 @@ static void main_menu(gchar buf)
                                }
 
                                hcamcorder->menu_state = MENU_STATE_INIT;
-                               print_menu();
                                break;
 
                        default:
@@ -833,13 +568,16 @@ static void main_menu(gchar buf)
                                recorder_state = RECORDER_STATE_RECORDING;
                                break;
 
+                       case '2': /* Setting */
+                               hcamcorder->menu_state = MENU_STATE_SETTING;
+                               break;
+
                        case 'b': /* back */
                                recorder_unprepare(hcamcorder->recorder);
                                recorder_destroy(hcamcorder->recorder);
                                hcamcorder->recorder = NULL;
 
                                hcamcorder->menu_state = MENU_STATE_INIT;
-                               print_menu();
                                break;
 
                        default:
@@ -898,40 +636,44 @@ static void main_menu(gchar buf)
        } else {
                g_print("\t Invalid mode, back to upper menu \n");
                hcamcorder->menu_state = MENU_STATE_INIT;
-               print_menu();
        }
+
+       return;
 }
 
 
 static void setting_menu(gchar buf)
 {
-       gboolean bret = FALSE;
        int idx = 0;
-       int min = 0;
-       int max = 0;
-       int value = 0;
        int err = 0;
-       int x = 0, y = 0, width = 0, height = 0;
+       int result = 0;
+       int bitrate = 0;
 
        if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
+               int x = 0;
+               int y = 0;
+               int width = 0;
+               int height = 0;
+               float motion_rate = 0.0;
+               resolution_stack resolution_list;
+
                switch (buf) {
-               /* Camera setting */
+               /* Camera/Recorder setting */
                case '0':  /* Setting > Preview Resolution setting */
-                       g_print("*Select the preview resolution!\n");
-                       resolution_stack resolution_list;
+                       g_print("* Preview resolution\n");
                        resolution_list.count = 0;
 
-                       recorder_foreach_supported_video_resolution(hcamcorder->recorder,
-                               preview_resolution_cb, &resolution_list);
-
                        flush_stdin();
+
+                       camera_foreach_supported_preview_resolution(hcamcorder->camera,
+                               resolution_cb, &resolution_list);
+
                        err = scanf("%d", &idx);
-                       int result = 0;
                        if (resolution_list.count > idx && idx >= 0) {
-                               g_print("-----------------PREVIEW RESOLUTION (%dx%d)---------------------\n",
+                               g_print("----------------- SET %dx%d ---------------------\n",
                                        resolution_list.width[idx], resolution_list.height[idx]);
 
-                               result = recorder_set_video_resolution(hcamcorder->recorder,
+                               result = camera_set_preview_resolution(hcamcorder->camera,
                                        resolution_list.width[idx], resolution_list.height[idx]);
                        } else {
                                g_print("invalid input %d\n", idx);
@@ -939,346 +681,338 @@ static void setting_menu(gchar buf)
                        }
 
                        resolution_list.count = 0;
-
-                       if (result != 0)
-                               g_print("FAIL\n");
-                       else
-                               g_print("PASS\n");
                        break;
 
-               case '2': /* Setting > Digital zoom level */
-                       g_print("*Digital zoom level  !\n");
+               case '1':  /* Setting > Video Resolution setting */
+                       g_print("* Video resolution\n");
+                       resolution_list.count = 0;
+
+                       flush_stdin();
+
+                       recorder_foreach_supported_video_resolution(hcamcorder->recorder,
+                               resolution_cb, &resolution_list);
 
-                       camera_attr_get_zoom_range(hcamcorder->camera, &min, &max);
-                       if (min >= max) {
-                               g_print("Not supported !! \n");
+                       err = scanf("%d", &idx);
+                       if (resolution_list.count > idx && idx >= 0) {
+                               g_print("----------------- SET %dx%d ---------------------\n",
+                                       resolution_list.width[idx], resolution_list.height[idx]);
+
+                               result = recorder_set_video_resolution(hcamcorder->recorder,
+                                       resolution_list.width[idx], resolution_list.height[idx]);
                        } 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);
+                               g_print("invalid input %d\n", idx);
+                               result = -1;
                        }
+
+                       resolution_list.count = 0;
                        break;
 
+               case '2': /* Setting > Video codec */
+                       g_print("* Video codec\n");
 
-               case '3': /* Setting > AF mode */
+                       flush_stdin();
 
-                       g_print("*AF mode !\n");
-                       g_print("\t1. AF Start !\n");
-                       g_print("\t2. AF Stop !\n\n");
+                       recorder_foreach_supported_video_encoder(hcamcorder->recorder, video_codec_cb, (void *)hcamcorder);
 
-                       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;
-                       }
 
+                       result = recorder_set_video_encoder(hcamcorder->recorder, idx);
                        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);
+               case '3': /* Setting > Audio codec */
+                       g_print("* Audio codec\n");
 
                        flush_stdin();
+
+                       g_print("-1. DISABLE\n");
+                       recorder_foreach_supported_audio_encoder(hcamcorder->recorder, audio_codec_cb, (void *)hcamcorder);
+
                        err = scanf("%d", &idx);
-                       bret = camera_attr_set_af_mode(hcamcorder->camera, idx);
-                       break;
 
-               case '5': /* Setting > Exposure mode */
-                       g_print("* Exposure mode!\n");
+                       result = recorder_set_audio_encoder(hcamcorder->recorder, idx);
+                       break;
 
-                       camera_attr_foreach_supported_exposure_mode(hcamcorder->camera,
-                               (camera_attr_supported_exposure_mode_cb)exposure_mode_cb, NULL);
+               case '4': /* Setting > File format */
+                       g_print("* File format\n");
 
                        flush_stdin();
 
-                       g_print("\n Select  Exposure mode \n");
+                       recorder_foreach_supported_file_format(hcamcorder->recorder, file_format_cb, (void *)hcamcorder);
+
                        err = scanf("%d", &idx);
-                       bret = camera_attr_set_exposure_mode(hcamcorder->camera, idx);
 
+                       result = recorder_set_file_format(hcamcorder->recorder, idx);
                        break;
 
-               case '6':  /* Setting > Exposure value */
-                       camera_attr_get_exposure_range(hcamcorder->camera, &min, &max);
-                       if (min >= max) {
-                               g_print("Not supported !! \n");
-                       } else {
+               case '5': /* Setting > Size limit */
+                       g_print("* Size limit\n");
 
-                               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;
+                       flush_stdin();
+
+                       g_print("[KByte] : ");
+
+                       err = scanf("%d", &idx);
 
-               case '7': /* Setting > F number */
-                       g_print("Not supported !! \n");
+                       result = recorder_attr_set_size_limit(hcamcorder->recorder, idx);
                        break;
 
-               case 'i': /* Setting > ISO */
-                       g_print("*ISO !\n");
-                       camera_attr_foreach_supported_iso(hcamcorder->camera, iso_mode_cb, NULL);
+               case '6': /* Setting > Time limit */
+                       g_print("* Time limit\n");
 
                        flush_stdin();
 
+                       g_print("[Second] : ");
+
                        err = scanf("%d", &idx);
-                       bret =  camera_attr_set_iso(hcamcorder->camera, idx);
+
+                       result = recorder_attr_set_time_limit(hcamcorder->recorder, 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);
+               case '7': /* Setting > Samplerate */
+                       g_print("* Samplerate\n");
 
                        flush_stdin();
+
+                       g_print("[Hz] : ");
+
                        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));
+
+                       result = recorder_attr_set_audio_samplerate(hcamcorder->recorder, idx);
                        break;
 
-               case 'f': /* Setting > Flip camera input */
+               case '8': /* Setting > Channel */
+                       g_print("* Channel\n");
+
                        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");
+
+                       g_print("[1 or 2] : ");
 
                        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));
+                       result = recorder_attr_set_audio_channel(hcamcorder->recorder, idx);
                        break;
 
-                       /* Display / Filter setting */
-               case 'v': /* Display visible */
-                       g_print("* Display visible setting !\n");
+               case '9': /* Setting > Bitrate */
+                       g_print("* Bitrate\n");
 
-                       g_print("\n Select Display visible \n");
                        flush_stdin();
-                       int i;
-                       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);
+                       g_print("[type(1:Audio,2:Video) bps] : ");
 
-                       break;
+                       err = scanf("%d %d", &idx, &bitrate);
 
+                       switch (idx) {
+                       case 1:
+                               result = recorder_attr_set_audio_encoder_bitrate(hcamcorder->recorder, bitrate);
+                               break;
+                       case 2:
+                               result = recorder_attr_set_video_encoder_bitrate(hcamcorder->recorder, bitrate);
+                               break;
+                       default:
+                               g_print("invalid type [%d]", idx);
+                               result = -1;
+                               break;
+                       }
+                       break;
 
-               case 'o': /*  Setting > Display MODe */
-                       g_print("* Display mode!\n");
+                       /* Display setting */
+               case 'v': /* Display visible */
+                       g_print("* Display visible\n");
 
                        flush_stdin();
-                       for (i = 1 ; i <= 2  ; i++)
-                               g_print("%d. %s\n", i, display_mode[i]);
+
+                       g_print("\t 0. OFF\n");
+                       g_print("\t 1. ON\n");
 
                        err = scanf("%d", &idx);
-                       bret =  camera_set_display_mode(hcamcorder->camera, idx-1);
+
+                       result = camera_set_display_visible(hcamcorder->camera, idx);
                        break;
 
-               case 'y': /* Setting > Rotate Display */
+               case 'd': /*  Setting > Display mode */
+                       g_print("* Display mode\n");
 
                        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;
+                       for (idx = 0 ; idx < 6  ; idx++)
+                               g_print("%d. %s\n", idx, display_mode[idx]);
 
-               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);
+                       if (idx == CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
+                               g_print("ROI area [x y width height] : ");
+                               err = scanf("%d %d %d %d", &x, &y, &width, &height);
+                       }
 
-                       flush_stdin();
-                       g_print("\n Select  brightness min (%d) -max(%d)\n", min, max);
-                       err = scanf("%d", &idx);
-                       bret = camera_attr_set_brightness(hcamcorder->camera, idx);
+                       result = camera_set_display_mode(hcamcorder->camera, idx - 1);
+
+                       if (idx == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
+                               result |= camera_attr_set_display_roi_area(hcamcorder->camera, x, y, width, height);
                        break;
 
-               case 'c': /* Setting > Contrast */
-                       g_print("*Contrast !\n");
-                       camera_attr_get_contrast_range(hcamcorder->camera, &min, &max);
+               case 'r': /* Setting > Display Rotate */
+                       g_print("* Display rotation\n");
 
                        flush_stdin();
-                       g_print("\n Select  Contrast min(%d)-max(%d)\n", min, max);
+
+                       g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t3. 270\n\n");
+
                        err = scanf("%d", &idx);
-                       bret = camera_attr_set_contrast(hcamcorder->camera, idx);
+
+                       result = camera_set_display_rotation(hcamcorder->camera, idx);
                        break;
 
+               case 'f': /* Setting > Display Flip */
+                       g_print("* Display flip\n");
 
+                       flush_stdin();
 
-               case 'w': /* Setting > White balance */
-                       g_print("*White balance !\n");
+                       g_print("\t0. NONE\n\t1. HORIZONTAL\n\t2. VERTICAL\n\t3. BOTH\n\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);
+
+                       result = camera_set_display_flip(hcamcorder->camera, idx);
                        break;
 
-               case 't': /* Setting > Color tone */
-                       g_print("*Color tone !\n");
-                       camera_attr_foreach_supported_effect(hcamcorder->camera, colortone_cb, NULL);
+                       /* ext. setting */
+               case 's': /* Setting > Strobe setting */
+                       g_print("* Strobe Mode\n");
 
-                       g_print("\n Select Color tone \n");
                        flush_stdin();
+
+                       camera_attr_foreach_supported_flash_mode(hcamcorder->camera, strobe_mode_cb, NULL);
+
                        err = scanf("%d", &idx);
-                       bret = camera_attr_set_effect(hcamcorder->camera, idx);
 
+                       result = camera_attr_set_flash_mode(hcamcorder->camera, idx);
                        break;
 
-               case 'd': /* Setting > WDR */
-                       g_print("*WDR !\n");
+               case 'z': /* Setting > Video-stabilization */
+                       g_print("* Video stabilization\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]);
+
+                       for (idx = 0 ; idx < 2 ; idx++)
+                               g_print("\t %d. %s\n", idx + 1, vs_mode[idx]);
 
                        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);
 
+                       if (idx == 2) {
+                               g_print("\n Restart preview with NV12 and 720p resolution\n");
+
+                               result = camera_stop_preview(hcamcorder->camera);
+                               result |= camera_set_preview_resolution(hcamcorder->camera, 1280, 720);
+                               result |= camera_set_preview_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_NV12);
+
+                               result |= camera_attr_enable_video_stabilization(hcamcorder->camera, idx-1);
+
+                               if (result == 0)
+                                       result |= camera_start_preview(hcamcorder->camera);
+                       }
                        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);
+               case 'M':
+                       g_print("*Camcorder Motion Rate setting! (should be bigger than zero)\n");
 
-                       g_print("\n Select EV program mode \n");
                        flush_stdin();
-                       err = scanf("%d", &idx);
-                       bret = camera_attr_set_scene_mode(hcamcorder->camera, idx);
 
+                       err = scanf("%f", &motion_rate);
+
+                       result = recorder_attr_set_recording_motion_rate(hcamcorder->recorder, motion_rate);
                        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");
+               case 'b': /* back */
+                       hcamcorder->menu_state = MENU_STATE_MAIN;
+                       break;
+
+               default:
+                       g_print("\t Invalid input \n");
+                       break;
+               }
+       } else {
+               switch (buf) {
+               case '1': /* Setting > Audio codec */
+                       g_print("* Audio codec\n");
+
                        flush_stdin();
+
+                       g_print("-1. DISABLE\n");
+                       recorder_foreach_supported_audio_encoder(hcamcorder->recorder, audio_codec_cb, (void *)hcamcorder);
+
                        err = scanf("%d", &idx);
-                       bret = camera_attr_set_flash_mode(hcamcorder->camera, idx);
 
+                       result = recorder_set_audio_encoder(hcamcorder->recorder, idx);
                        break;
 
-               case 'l': /* Setting > Face detection setting */
-                       /* hcamcorder->menu_state = MENU_STATE_SETTING_DETECTION; */
-                       g_print("* Face detect mode !\n");
-
+               case '2': /* Setting > File format */
+                       g_print("* File format\n");
 
                        flush_stdin();
-                       for (i = 0; i < 2; i++)
-                               g_print("\t %d. %s \n", i+1, detection_mode[i]);
+
+                       recorder_foreach_supported_file_format(hcamcorder->recorder, file_format_cb, (void *)hcamcorder);
 
                        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\n");
-                       }
 
+                       result = recorder_set_file_format(hcamcorder->recorder, idx);
                        break;
 
-               case 'k': /* Setting > Anti-handshake */
-                       g_print("*Anti-handshake !\n");
+               case '3': /* Setting > Size limit */
+                       g_print("* Size limit\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]);
+
+                       g_print("[KByte] : ");
 
                        err = scanf("%d", &idx);
-                       bret = camera_attr_enable_anti_shake(hcamcorder->camera, idx-1);
 
+                       result = recorder_attr_set_size_limit(hcamcorder->recorder, idx);
                        break;
 
-               case 'K': /* Setting > Video-stabilization */
-                       g_print("*Video-stabilization !\n");
+               case '4': /* Setting > Time limit */
+                       g_print("* Time limit\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]);
+
+                       g_print("[Second] : ");
 
                        err = scanf("%d", &idx);
 
-                       if (idx == 2) {
-                               g_print("\n Restart preview with NV12 and 720p resolution\n");
+                       result = recorder_attr_set_time_limit(hcamcorder->recorder, idx);
+                       break;
 
-                               err = camera_stop_preview(hcamcorder->camera);
+               case '5': /* Setting > Samplerate */
+                       g_print("* Samplerate\n");
 
-                               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);
+                       flush_stdin();
 
-                               if (err == 0) {
-                                       err = camera_start_preview(hcamcorder->camera);
+                       g_print("[Hz] : ");
 
-                                       if (err != 0)
-                                               g_print("\n Restart FAILED! %x\n", err);
-                               }
-                       }
+                       err = scanf("%d", &idx);
+
+                       result = recorder_attr_set_audio_samplerate(hcamcorder->recorder, idx);
                        break;
 
-               case 'u': /* Touch AF area */
-                       g_print("* Touch AF area !\n");
+               case '6': /* Setting > Channel */
+                       g_print("* Channel\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");
+                       g_print("[1 or 2] : ");
 
+                       err = scanf("%d", &idx);
+
+                       result = recorder_attr_set_audio_channel(hcamcorder->recorder, idx);
                        break;
 
+               case '7': /* Setting > Bitrate */
+                       g_print("* Bitrate\n");
 
-               case 'M':
-                       {
-                               float motion_rate = 0.0;
+                       flush_stdin();
 
-                               flush_stdin();
+                       g_print("[bps] : ");
 
-                               g_print("*Camcorder Motion Rate setting! (should be bigger than zero)\n");
+                       err = scanf("%d", &bitrate);
 
-                               err = scanf("%f", &motion_rate);
-                               err = recorder_attr_set_recording_motion_rate(hcamcorder->recorder, motion_rate);
-                               if (err != 0)
-                                       g_print("Failed to set Camcorder Motion Rate %f [err:0x%x]\n", motion_rate, err);
-                               else
-                                       g_print("Succeed to set Motion Rate %f\n", motion_rate);
-                       }
+                       result = recorder_attr_set_audio_encoder_bitrate(hcamcorder->recorder, bitrate);
                        break;
 
                case 'b': /* back */
@@ -1289,12 +1023,16 @@ static void setting_menu(gchar buf)
                        g_print("\t Invalid input \n");
                        break;
                }
-       } else {
-               g_print("\t Invalid mode, back to upper menu \n");
-               hcamcorder->menu_state = MENU_STATE_MAIN;
        }
 
-       g_print("\t bret : 0x%x \n", bret);
+       if (buf != 'b') {
+               if (result == 0) /* CAMERA_ERROR_NONE or RECORDER_ERROR_NONE */
+                       g_print("\n===== SET OK =====\n");
+               else
+                       g_print("\n===== SET FAIL 0x%x =====\n", result);
+       }
+
+       return;
 }