Support large file for recording
[platform/core/multimedia/libmm-camcorder.git] / test / mm_camcorder_testsuite.c
index 57e7eb6..1e9566d 100644 (file)
@@ -29,64 +29,63 @@ when                who                                             what, where, why
 10/10/07       wh01.cho@samsung.com            Created
 12/30/08       jh1979.park@samsung.com         Modified
 08/31/11       sc11.lee@samsung.com            Modified (Reorganized for easy look)
+10/23/14       p.gamov@samsung.com                     Upgraded to Gstreamer 1.0
 */
 
 
-/*===========================================================================================
-|                                                                                                                                                                                      |
-|  INCLUDE FILES                                                                                                                                                       |
-|                                                                                                                                                                                      |
-========================================================================================== */
+/*=======================================================================================
+|  INCLUDE FILES                                                                        |
+=======================================================================================*/
 #include <stdio.h>
 #include <stdlib.h>
 #include <glib.h>
 #include <gst/gst.h>
 #include <sys/time.h>
-#include <mm_camcorder.h>
-#include <mm_camcorder_internal.h>
-#include <mm_camcorder_util.h>
-#include <gst/interfaces/colorbalance.h>
-#include <mm_ta.h>
-
-/*---------------------------------------------------------------------------
-|    GLOBAL VARIABLE DEFINITIONS:                                                                                      |
----------------------------------------------------------------------------*/
+#include "../src/include/mm_camcorder.h"
+#include "../src/include/mm_camcorder_internal.h"
+#include "../src/include/mm_camcorder_util.h"
+#include <gst/video/colorbalance.h>
+
+/*-----------------------------------------------------------------------
+|    GLOBAL VARIABLE DEFINITIONS:                                       |
+-----------------------------------------------------------------------*/
 #define EXPORT_API __attribute__((__visibility__("default")))
 
 #define PACKAGE "mm_camcorder_testsuite"
 
-GMainLoop      *g_loop;
+GMainLoop *g_loop;
 GIOChannel *stdin_channel;
 int resolution_set;
-int    g_current_state;
+int g_current_state;
 int src_w, src_h;
 GstCaps *filtercaps;
-bool           isMultishot;
+bool isMultishot;
 MMCamPreset cam_info;
 int mmcamcorder_state;
 int mmcamcorder_print_state;
 int multishot_num;
-static int audio_stream_cb_cnt, video_stream_cb_cnt;
+static int audio_stream_cb_cnt;
+static int video_stream_cb_cnt;
 static GTimer *timer = NULL;
 
-/*---------------------------------------------------------------------------
-|    GLOBAL CONSTANT DEFINITIONS:                                                                                      |
----------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+|    GLOBAL CONSTANT DEFINITIONS:                                       |
+-----------------------------------------------------------------------*/
 
 
-/*---------------------------------------------------------------------------
-|    IMPORTED VARIABLE DECLARATIONS:                                                                           |
----------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+|    IMPORTED VARIABLE DECLARATIONS:                                    |
+-----------------------------------------------------------------------*/
 
 
-/*---------------------------------------------------------------------------
-|    IMPORTED FUNCTION DECLARATIONS:                                                                           |
----------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+|    IMPORTED FUNCTION DECLARATIONS:                                    |
+-----------------------------------------------------------------------*/
 
 
-/*---------------------------------------------------------------------------
-|    LOCAL #defines:                                                                                                           |
----------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+|    LOCAL #defines:                                                    |
+-----------------------------------------------------------------------*/
 #define test_ffmux_mp4
 
 // FULLHD(1080P)
@@ -103,44 +102,44 @@ static GTimer *timer = NULL;
 #define SRC_H_480                                                      480
 
 //QVGA
-#define SRC_W_320                                                      320                                     // video input width 
+#define SRC_W_320                                                      320                                     // video input width
 #define SRC_H_240                                                      240                                             // video input height
 
 //QCIF
-#define SRC_W_176                                                      176                                     // video input width 
+#define SRC_W_176                                                      176                                     // video input width
 #define SRC_H_144                                                      144                                             // video input height
 
 //QQVGA
-#define SRC_W_160                                                      160                                             // video input width 
+#define SRC_W_160                                                      160                                             // video input width
 #define SRC_H_120                                                      120                                             // video input heith
 
 //special resolution
-#define SRC_W_400                                                      400                                     // video input width 
+#define SRC_W_400                                                      400                                     // video input width
 #define SRC_H_300                                                      300                                             // video input height
 
-#define SRC_W_192                                                      192                                     // video input width 
+#define SRC_W_192                                                      192                                     // video input width
 #define SRC_H_256                                                      256                                             // video input height
 
-#define SRC_W_144                                                      144                                     // video input width 
+#define SRC_W_144                                                      144                                     // video input width
 #define SRC_H_176                                                      176                                             // video input height
 
 #define SRC_W_300                                                      300
 #define SRC_W_400                                                      400
 
 
-#define DISPLAY_X_0                                                    0                                               //for direct FB 
-#define DISPLAY_Y_0                                                    0                                               //for direct FB 
+#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 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 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    500   // mili seconds
+#define IMAGE_CAPTURE_COUNT_INTERVAL    100   // mili seconds
 
 #define MAX_FILE_SIZE_FOR_MMS           (250 * 1024)
 
@@ -150,11 +149,14 @@ static GTimer *timer = NULL;
 #define EXT_AMR                         "amr"
 #define EXT_MKV                         "mkv"
 
-#define STILL_CAPTURE_FILE_PATH_NAME    "/root/StillshotCapture"
-#define MULTI_CAPTURE_FILE_PATH_NAME    "/root/MultishotCapture"
-#define TARGET_FILENAME_PATH            "/opt/media/"
-#define TARGET_FILENAME_VIDEO           "/opt/media/test_rec_video.3gp"
-#define TARGET_FILENAME_AUDIO           "/opt/media/test_rec_audio.amr"
+#define TARGET_FILENAME_PATH            "/opt/usr/media/"
+#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 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
@@ -162,8 +164,9 @@ static GTimer *timer = NULL;
 #define AUDIO_SOURCE_FORMAT             MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE
 #define AUDIO_SOURCE_CHANNEL_AAC        2
 #define AUDIO_SOURCE_CHANNEL_AMR        1
+#define VIDEO_ENCODE_BITRATE            40000000 /* bps */
 
-#define DEFAULT_CAM_DEVICE                             MM_VIDEO_DEVICE_CAMERA1
+#define DEFAULT_CAM_DEVICE              MM_VIDEO_DEVICE_CAMERA1
 
 /*
  * D E B U G   M E S S A G E
@@ -194,7 +197,7 @@ do { \
  do { \
        fprintf(stderr, MMF_DEBUG"[%s:%05d]  " fmt "\n",__func__, __LINE__, ##arg); \
  } while(0)
+
 #define err_msg_t(fmt,arg...)  \
 do { \
        fprintf(stderr, MMF_ERR"[%s:%05d]  " fmt "\n",__func__, __LINE__, ##arg); \
@@ -216,7 +219,7 @@ do { \
 
 
 GTimeVal previous;
-GTimeVal current;      
+GTimeVal current;
 GTimeVal result;
 //temp
 
@@ -224,26 +227,25 @@ GTimeVal result;
  * Enumerations for command
  */
 #define SENSOR_WHITEBALANCE_NUM                10
-#define SENSOR_COLOR_TONE_NUM                  27
-#define SENSOR_FLIP_NUM                                3
+#define SENSOR_COLOR_TONE_NUM          30
+#define SENSOR_FLIP_NUM                        3
 #define SENSOR_PROGRAM_MODE_NUM                15
-#define SENSOR_FOCUS_NUM                               5
-#define SENSOR_INPUT_ROTATION                  6
-#define SENSOR_AF_SCAN_NUM                             4
-#define SENSOR_ISO_NUM                                 8
-#define SENSOR_EXPOSURE_NUM                    9
-#define SENSOR_IMAGE_FORMAT                    9
+#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
 
 
-/*---------------------------------------------------------------------------
-|    LOCAL CONSTANT DEFINITIONS:                                                                                       |
----------------------------------------------------------------------------*/
-enum 
+/*-----------------------------------------------------------------------
+|    LOCAL CONSTANT DEFINITIONS:                                        |
+-----------------------------------------------------------------------*/
+enum
 {
-       MODE_IMAGE,             /* capture mode */
-       MODE_VIDEO,             /* recording mode */
-       MODE_AUDIO,             /* audio recording*/ 
-       MODE_NUM,               
+       MODE_VIDEO_CAPTURE,     /* recording and image capture mode */
+       MODE_AUDIO,             /* audio recording*/
+       MODE_NUM,
 };
 
 enum
@@ -253,28 +255,28 @@ enum
        MENU_STATE_NUM,
 };
 
-/*---------------------------------------------------------------------------
-|    LOCAL DATA TYPE DEFINITIONS:                                                                                      |
----------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+|    LOCAL DATA TYPE DEFINITIONS:                                      |
+-----------------------------------------------------------------------*/
 typedef struct _cam_handle
 {
        MMHandleType camcorder;
-       int mode;                                                /* image(capture)/video(recording) mode */
-       bool isMultishot;
-       int stillshot_count;                    /* total stillshot count */ 
-       int multishot_count;                    /* total multishot count */ 
-       char *stillshot_filename;               /* stored filename of  stillshot  */ 
-       char *multishot_filename;               /* stored filename of  multishot  */ 
-       int     menu_state;
-       int     fps;    
-       bool    isMute;
-       unsigned int elapsed_time;
+       int mode;                       /* image(capture)/video(recording) mode */
+       bool 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 menu_state;
+       int fps;
+       bool isMute;
+       unsigned long long elapsed_time;
 } cam_handle_t;
 
 typedef struct _cam_xypair
 {
-       char* attr_subcat_x;
-       char* attr_subcat_y;
+       const char *attr_subcat_x;
+       const char *attr_subcat_y;
        int x;
        int y;
 } cam_xypair_t;
@@ -284,12 +286,12 @@ typedef struct _cam_xypair
 ---------------------------------------------------------------------------*/
 static cam_handle_t *hcamcorder ;
 
-char *wb[SENSOR_WHITEBALANCE_NUM]={    
+const char *wb[SENSOR_WHITEBALANCE_NUM]={
        "None",
        "Auto",
        "Daylight",
        "Cloudy",
-       "Fluoroscent",  
+       "Fluoroscent",
        "Incandescent",
        "Shade",
        "Horizon",
@@ -297,7 +299,7 @@ char *wb[SENSOR_WHITEBALANCE_NUM]={
        "Custom",
 };
 
-char *ct[SENSOR_COLOR_TONE_NUM] = {
+const char *ct[SENSOR_COLOR_TONE_NUM] = {
        "NONE",
        "MONO",
        "SEPIA",
@@ -316,23 +318,27 @@ char *ct[SENSOR_COLOR_TONE_NUM] = {
        "PURPLE",
        "EMBOSS",
        "OUTLINE",
-       "SOLARIZATION_1",
-       "SOLARIZATION_2",
-       "SOLARIZATION_3",
-       "SOLARIZATION_4",
-       "SKETCH_1",
-       "SKETCH_2",
-       "SKETCH_3",
-       "SKETCH_4",
+       "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",
 };
 
-char *flip[SENSOR_FLIP_NUM] = {
+const char *flip[SENSOR_FLIP_NUM] = {
        "Horizontal",
        "Vertical",
        "Not flipped",
 };
 
-char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
+const char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
        "NORMAL",
        "PORTRAIT",
        "LANDSCAPE",
@@ -350,31 +356,30 @@ char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
        "BACKLIGHT",
 };
 
-char *focus_mode[SENSOR_FOCUS_NUM] = {
+const char *focus_mode[SENSOR_FOCUS_NUM] = {
        "None",
        "Pan",
        "Auto",
        "Manual",
        "Touch Auto",
+       "Continuous Auto",
 };
 
-char *camera_rotation[SENSOR_INPUT_ROTATION] = {
+const char *camera_rotation[SENSOR_INPUT_ROTATION] = {
        "None",
        "90",
        "180",
        "270",
-       "Flip Horizontal",
-       "Flip Vertical",
 };
 
-char *af_scan[SENSOR_AF_SCAN_NUM] = {
+const char *af_scan[SENSOR_AF_SCAN_NUM] = {
        "None",
        "Normal",
        "Macro mode",
        "Full mode",
 };
 
-char *iso_name[SENSOR_ISO_NUM] = {
+const char *iso_name[SENSOR_ISO_NUM] = {
        "ISO Auto",
        "ISO 50",
        "ISO 100",
@@ -385,19 +390,19 @@ char *iso_name[SENSOR_ISO_NUM] = {
        "ISO 3200",
 };
 
-char *exposure_mode[SENSOR_EXPOSURE_NUM] = {
+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 spot 1 mode",
+       "AE spot 2 mode",
        "AE custom 1 mode",
        "AE custom 2 mode",
 };
 
-char *image_fmt[SENSOR_IMAGE_FORMAT] = {
+const char *image_fmt[SENSOR_IMAGE_FORMAT] = {
        "NV12",
        "NV12T",
        "NV16",
@@ -409,7 +414,18 @@ char *image_fmt[SENSOR_IMAGE_FORMAT] = {
        "YV12",
 };
 
-char *output_mode[] = {
+const char *face_zoom_mode[] = {
+       "Face Zoom OFF",
+       "Face Zoom ON",
+};
+
+const char *display_mode[] = {
+       "Default",
+       "Primary Video ON and Secondary Video Full Screen",
+       "Primary Video OFF and Secondary Video Full Screen",
+};
+
+const char *output_mode[] = {
        "Letter Box mode",
        "Original Size mode",
        "Full Screen mode",
@@ -417,16 +433,20 @@ char *output_mode[] = {
        "ROI mode",
 };
 
-char *rotate_mode[] = {
+const char *capture_sound[] = {
+       "Default",
+       "Extra 01",
+       "Extra 02",
+};
+
+const char *rotate_mode[] = {
        "0",
        "90",
        "180",
        "270",
-       "Flip Horizontal",
-       "Flip Vertical",
 };
 
-char* strobe_mode[] = {
+const char* strobe_mode[] = {
        "Strobe OFF",
        "Strobe ON",
        "Strobe Auto",
@@ -437,36 +457,41 @@ char* strobe_mode[] = {
        "Strobe Permanent",
 };
 
-char *detection_mode[2] = {
+const char *detection_mode[2] = {
        "Face Detection OFF",
        "Face Detection ON",
 };
 
-char *wdr_mode[] = {
+const char *wdr_mode[] = {
        "WDR OFF",
        "WDR ON",
        "WDR AUTO",
 };
 
-char *ahs_mode[] = {
+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",
 };
 
-char *visible_mode[] = {
-       "Display OFF",
-       "Display ON", 
+const char *vs_mode[] = {
+       "Video-stabilization OFF",
+       "Video-stabilization ON",
 };
 
-char *camcorder_rotate_val[] = {
-       "0",
-       "90",
-       "180",
-       "270",
+const char *visible_mode[] = {
+       "Display OFF",
+       "Display ON",
 };
 
+
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
@@ -477,7 +502,7 @@ static gboolean cmd_input(GIOChannel *channel);
 static gboolean msg_callback(int message, void *msg_param, void *user_param);
 static gboolean init(int type);
 static gboolean mode_change();
-int camcordertest_set_attr_int(char* attr_subcategory, int value);
+int camcordertest_set_attr_int(const char* attr_subcategory, int value);
 
 
 static inline void flush_stdin()
@@ -490,7 +515,7 @@ void
 cam_utils_convert_YUYV_to_UYVY(unsigned char* dst, unsigned char* src, gint length)
 {
        int i = 0;
-       
+
        //memset dst
        memset(dst, 0x00, length);
        memcpy(dst, src + 1, length-1);
@@ -504,47 +529,102 @@ cam_utils_convert_YUYV_to_UYVY(unsigned char* dst, unsigned char* src, gint leng
        }
 }
 
+#ifdef USE_AUDIO_STREAM_CB
 static int camcordertest_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param)
 {
-       if ( (int)(stream->timestamp)/1000 == audio_stream_cb_cnt ) {
-               audio_stream_cb_cnt++;
-               printf("audio_stream cb is called ( data:%p, format:%d, channel:%d, volume_dB:%f, length:%d, timestamp:%d)\n",  stream->data, stream->format, stream->channel, stream->volume_dB, stream->length, stream->timestamp);
-       }
+       audio_stream_cb_cnt++;
+       printf("audio_stream cb is called (stream:%p, data:%p, format:%d, channel:%d, volume_dB:%f, length:%d, timestamp:%d)\n",
+              stream, stream->data, stream->format, stream->channel, stream->volume_dB, stream->length, stream->timestamp);
+
        return TRUE;
 }
+#endif /* USE_AUDIO_STREAM_CB */
 
 static int camcordertest_video_stream_cb(MMCamcorderVideoStreamDataType *stream, void *user_param)
 {
-       if ( (int)(stream->timestamp)/1000 == video_stream_cb_cnt ) {
-               video_stream_cb_cnt++;
-               printf("video_stream cb is called ( data:%p, format:%d, length:%d, width:%d, height:%d, timestamp:%d)\n",  stream->data, stream->format, stream->length, stream->width, stream->height, stream->timestamp);
-       }
+       video_stream_cb_cnt++;
+
+       printf("VIDEO STREAM CALLBACK total length :%u, size %dx%d\n", stream->length_total, stream->width, stream->height);
+
        return TRUE;
 }
 
+static void _file_write(char *path, void *data, int size)
+{
+       FILE *fp = NULL;
+
+       if (!path || !data || size <= 0) {
+               printf("ERROR %p %p %d\n", path, data, size);
+               return;
+       }
+
+       fp = fopen(path, "w");
+       if (fp == NULL) {
+               printf("open error! [%s], errno %d\n", path, errno);
+               return;
+       } else {
+               printf("open success [%s]\n", path);
+               if (fwrite(data, size, 1, fp) != 1) {
+                       printf("write error! errno %d\n", errno);
+               } else {
+                       printf("write success [%s]\n", path);
+               }
+
+               fclose(fp);
+               fp = NULL;
+       }
+}
+
+static void _file_write2(const char *path, void *data, int size)
+{
+       FILE *fp = NULL;
+
+       if (!path || !data || size <= 0) {
+               printf("ERROR %p %p %d\n", path, data, size);
+               return;
+       }
+
+       fp = fopen(path, "w");
+       if (fp == NULL) {
+               printf("open error! [%s], errno %d\n", path, errno);
+               return;
+       } else {
+               printf("open success [%s]\n", path);
+               if (fwrite(data, size, 1, fp) != 1) {
+                       printf("write error! errno %d\n", errno);
+               } else {
+                       printf("write success [%s]\n", path);
+               }
+
+               fclose(fp);
+               fp = NULL;
+       }
+}
+
+
 static int
 camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCaptureDataType *thumb, void *data)
 {
        int nret = 0;
        int scrnl_size = 0;
+       int exif_size = 0;
        char m_filename[CAPTURE_FILENAME_LEN];
-       FILE *fp = NULL;
        MMCamcorderCaptureDataType *scrnl = NULL;
-
-       debug_msg_t("hcamcorder->isMultishot=%d =>1: MULTI, 0: STILL",hcamcorder->isMultishot);
+       unsigned char *exif_data = NULL;
 
        if (main == NULL) {
                warn_msg_t("Capture callback : Main image buffer is NULL!!!");
                return FALSE;
        }
 
-       if (hcamcorder->isMultishot == TRUE) {
-               snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg",   hcamcorder->multishot_filename,hcamcorder->multishot_count++);
+       if (hcamcorder->isMultishot) {
+               snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->multishot_filename, hcamcorder->multishot_count++);
        } else {
-               snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg",   hcamcorder->stillshot_filename,hcamcorder->stillshot_count++);
+               snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->stillshot_filename, hcamcorder->stillshot_count++);
        }
 
-       debug_msg_t("filename : %s", m_filename);
+       debug_msg_t("hcamcorder->isMultishot=%d =>1: MULTI, 0: STILL, filename : %s",
+                   hcamcorder->isMultishot, m_filename);
 
        if (main->format != MM_PIXEL_FORMAT_ENCODED) {
                unsigned int dst_size = 0;
@@ -553,71 +633,24 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
                nret = _mmcamcorder_encode_jpeg(main->data, main->width, main->height, main->format,
                                                main->length, 90, &dst, &dst_size);
                if (nret) {
-                       fp = fopen(m_filename, "w+");
-                       if (fp == NULL) {
-                               printf("FileOPEN error!!\n");
-                               warn_msg_t("FileOPEN error!!");
-                               return FALSE;
-                       } else {
-                               printf("open success\n");
-                               if (fwrite(dst, dst_size, 1, fp) != 1) {
-                                       printf("File write error!!\n");
-                                       warn_msg_t("File write error!!");
-                                       fclose(fp);
-                                       return FALSE;
-                               }
-                               printf("write success\n");
-                       }
-                       fclose(fp);
-                       fp = NULL;
+                       _file_write(m_filename, dst, dst_size);
                } else {
                        printf("Failed to encode YUV(%d) -> JPEG. \n", main->format);
                }
 
                free(dst);
                dst = NULL;
-       } else {
+       } else if (!hcamcorder->isMultishot) {
+
                printf("MM_PIXEL_FORMAT_ENCODED main->data=%p main->length=%d, main->width=%d, main->heigtht=%d \n",
                       main->data, main->length, main->width, main->height);
 
                /* main image */
-               fp = fopen(m_filename, "w+");
-               if (fp == NULL) {
-                       printf("FileOPEN error!!\n");
-                       warn_msg_t("FileOPEN error!!");
-                       return FALSE;
-               } else {
-                       printf("open success\n");
-                       if (fwrite(main->data, main->length, 1, fp) != 1) {
-                               printf("File write error!!\n");
-                               warn_msg_t("File write error!!");
-                               fclose(fp);
-                               return FALSE;
-                       }
-                       printf("write success\n");
-               }
-               fclose(fp);
-               fp = NULL;
+               _file_write(m_filename, main->data, main->length);
 
                /* thumbnail */
                if (thumb != NULL) {
-                       fp = fopen("./thumbnail.jpg", "w+");
-                       if (fp == NULL) {
-                               printf("FileOPEN error!!\n");
-                               warn_msg_t("FileOPEN error!!");
-                               return FALSE;
-                       } else {
-                               printf("open success\n");
-                               if (fwrite(thumb->data, thumb->length, 1, fp) != 1) {
-                                       printf("File write error!!\n");
-                                       warn_msg_t("File write error!!");
-                                       fclose(fp);
-                                       return FALSE;
-                               }
-                               printf("write success\n");
-                       }
-                       fclose(fp);
-                       fp = NULL;
+                       _file_write2(IMAGE_CAPTURE_THUMBNAIL_PATH, thumb->data, thumb->length);
                }
 
                /* screennail */
@@ -625,30 +658,18 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
                                            "captured-screennail", &scrnl, &scrnl_size,
                                            NULL);
                if (scrnl != NULL) {
-                       fp = fopen("./screennail.yuv", "w+");
-                       if (fp == NULL) {
-                               printf("FileOPEN error!!\n");
-                               warn_msg_t("FileOPEN error!!");
-                               return FALSE;
-                       } else {
-                               printf("open success\n");
-
-                               if (fwrite(scrnl->data, scrnl->length, 1, fp) != 1) {
-                                       printf("File write error!!\n");
-                                       warn_msg_t("File write error!!");
-                                       fclose(fp);
-                                       fp = NULL;
-                                       return FALSE;
-                               }
-
-                               fclose(fp);
-                               fp = NULL;
-
-                               printf("write success\n");
-                       }
+                       _file_write2(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
                } else {
                        printf( "Screennail buffer is NULL.\n" );
                }
+
+               /* EXIF data */
+               mm_camcorder_get_attributes(hcamcorder->camcorder, NULL,
+                                           "captured-exif-raw-data", &exif_data, &exif_size,
+                                           NULL);
+               if (exif_data) {
+                       _file_write2(IMAGE_CAPTURE_EXIF_PATH, exif_data, exif_size);
+               }
        }
 
        return TRUE;
@@ -658,60 +679,47 @@ static gboolean test_idle_capture_start()
 {
        int err;
 
-       if (!hcamcorder->isMultishot)
-       {
-               camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_ENCODED);
-               camcordertest_set_attr_int(MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG);
-       }
-       else
-       {
-//             camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_I420);
-               camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_YUYV);
-       }
+       camcordertest_set_attr_int(MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED);
+       camcordertest_set_attr_int(MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG);
 
        g_timer_reset(timer);
        err = mm_camcorder_capture_start(hcamcorder->camcorder);
 
-       if (err < 0) 
-       {
-//             if(hcamcorder->isMultishot == TRUE)
-//                     hcamcorder->isMultishot = FALSE;
+       if (err < 0) {
                warn_msg_t("Multishot mm_camcorder_capture_start = %x", err);
-       }       
+       }
+
        return FALSE;
 }
 
-int camcordertest_set_attr_int(char * attr_subcategory, int value)
+int camcordertest_set_attr_int(const char * attr_subcategory, int value)
 {
        char * err_attr_name = NULL;
        int err;
 
-       if (hcamcorder)
-       {
-               if (hcamcorder->camcorder)
-               {
+       if (hcamcorder) {
+               if (hcamcorder->camcorder) {
                        debug_msg_t("camcordertest_set_attr_int(%s, %d)", attr_subcategory, value);
 
                        err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                                               attr_subcategory, value, 
-                                                                                               NULL);
-                       if (err < 0) 
-                       {
+                                                         attr_subcategory, value,
+                                                         NULL);
+                       if (err != MM_ERROR_NONE) {
                                err_msg_t("camcordertest_set_attr_int : Error(%s:%x)!!!!!!!", err_attr_name, err);
-                               SAFE_FREE (err_attr_name);
+                               SAFE_FREE(err_attr_name);
                                return FALSE;
                        }
 
                        //success
                        return TRUE;
                }
-               
+
                debug_msg_t("camcordertest_set_attr_int(!hcamcorder->camcorde)");
        }
 
        debug_msg_t("camcordertest_set_attr_int(!hcamcorder)");
-       return FALSE;   
 
+       return FALSE;
 }
 
 int camcordertest_set_attr_xypair(cam_xypair_t pair)
@@ -719,18 +727,15 @@ int camcordertest_set_attr_xypair(cam_xypair_t pair)
        char * err_attr_name = NULL;
        int err;
 
-       if (hcamcorder)
-       {
-               if (hcamcorder->camcorder)
-               {
+       if (hcamcorder) {
+               if (hcamcorder->camcorder) {
                        debug_msg_t("camcordertest_set_attr_xypair((%s, %s), (%d, %d))",  pair.attr_subcat_x, pair.attr_subcat_y, pair.x, pair.y);
 
                        err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
                                                                        pair.attr_subcat_x, pair.x,
                                                                        pair.attr_subcat_y, pair.y,
                                                                        NULL);
-                       if (err < 0) 
-                       {
+                       if (err < 0) {
                                err_msg_t("camcordertest_set_attr_xypair : Error(%s:%x)!!", err_attr_name, err);
                                SAFE_FREE (err_attr_name);
                                return FALSE;
@@ -747,7 +752,7 @@ int camcordertest_set_attr_xypair(cam_xypair_t pair)
        return FALSE;
 }
 
-int camcordertest_get_attr_valid_intarray(char * attr_name, int ** array, int *count)
+int camcordertest_get_attr_valid_intarray(const char * attr_name, int ** array, int *count)
 {
        MMCamAttrsInfo info;
        int err;
@@ -756,24 +761,21 @@ int camcordertest_get_attr_valid_intarray(char * attr_name, int ** array, int *c
        {
                if (hcamcorder->camcorder)
                {
-                       debug_msg_t("camcordertest_get_attr_valid_intarray((%s),(%p, %p))",  attr_name, array, count);
+                       debug_msg_t("camcordertest_get_attr_valid_intarray(%s)", attr_name);
 
                        err = mm_camcorder_get_attribute_info(hcamcorder->camcorder, attr_name, &info);
-
-                       if (err < 0) 
-                       {
-                               err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!",  err);
+                       if (err != MM_ERROR_NONE) {
+                               err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!", err);
                                return FALSE;
-                       }
-                       else
-                       {
-                               if (info.type == MM_CAM_ATTRS_TYPE_INT)
-                                       if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY)
-                                       {                                                               
+                       } else {
+                               if (info.type == MM_CAM_ATTRS_TYPE_INT) {
+                                       if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY) {
                                                *array = info.int_array.array;
                                                *count = info.int_array.count;
+                                               debug_msg_t("INT ARRAY - default value : %d", info.int_array.def);
                                                return TRUE;
                                        }
+                               }
 
                                err_msg_t("camcordertest_get_attr_valid_intarray : Type mismatched!!");
                                return FALSE;
@@ -788,7 +790,7 @@ int camcordertest_get_attr_valid_intarray(char * attr_name, int ** array, int *c
        return FALSE;
 }
 
-int camcordertest_get_attr_valid_intrange(char * attr_name, int *min, int *max)
+int camcordertest_get_attr_valid_intrange(const char * attr_name, int *min, int *max)
 {
        MMCamAttrsInfo info;
        int err;
@@ -797,36 +799,33 @@ int camcordertest_get_attr_valid_intrange(char * attr_name, int *min, int *max)
        {
                if (hcamcorder->camcorder)
                {
-                       debug_msg_t("camcordertest_get_attr_valid_intarray((%s),(%p, %p))",  attr_name, min, max);
+                       debug_msg_t("camcordertest_get_attr_valid_intrange(%s)", attr_name);
 
                        err = mm_camcorder_get_attribute_info(hcamcorder->camcorder, attr_name, &info);
-
-                       if (err < 0) 
-                       {
-                               err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!",  err);
+                       if (err != MM_ERROR_NONE) {
+                               err_msg_t("camcordertest_get_attr_valid_intrange : Error(%x)!!",  err);
                                return FALSE;
-                       }
-                       else
-                       {
-                               if (info.type == MM_CAM_ATTRS_TYPE_INT)
-                                       if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE)
-                                       {                                                               
+                       } else {
+                               if (info.type == MM_CAM_ATTRS_TYPE_INT) {
+                                       if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE) {
                                                *min = info.int_range.min;
                                                *max = info.int_range.max;
+                                               debug_msg_t("INT RANGE - default : %d", info.int_range.def);
                                                return TRUE;
                                        }
+                               }
 
-                               err_msg_t("camcordertest_get_attr_valid_intarray : Type mismatched!!");
+                               err_msg_t("camcordertest_get_attr_valid_intrange : Type mismatched!!");
                                return FALSE;
                        }
                        //success
 
                }
 
-               debug_msg_t("camcordertest_get_attr_valid_intarray(!hcamcorder->camcorde)");
+               debug_msg_t("camcordertest_get_attr_valid_intrange(!hcamcorder->camcorde)");
        }
 
-       debug_msg_t("camcordertest_get_attr_valid_intarray(!hcamcorder)");
+       debug_msg_t("camcordertest_get_attr_valid_intrange(!hcamcorder)");
        return FALSE;
 }
 
@@ -841,49 +840,33 @@ static void print_menu()
        switch(hcamcorder->menu_state)
        {
                case MENU_STATE_MAIN:
-                       if (hcamcorder->mode == MODE_IMAGE)
-                       {
-                               g_print("\n\t=======================================\n");
-                               if ( cam_info.videodev_type == MM_VIDEO_DEVICE_CAMERA1 )
-                                       g_print("\t   Image Capture (Front camera)\n");
-                               else if(  cam_info.videodev_type == MM_VIDEO_DEVICE_CAMERA0 )
-                                       g_print("\t   Image Capture (Rear camera)\n");
-                               g_print("\t=======================================\n");
-                               g_print("\t   '1' Take a photo\n");
-                               g_print("\t   '2' Setting\n");
-                               g_print("\t   '3' Print FPS\n");
-                               g_print("\t   'b' back\n");
-                               g_print("\t=======================================\n");
-                       }
-                       else if (hcamcorder->mode == MODE_VIDEO)
-                       {
+                       if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
                                g_print("\n\t=======================================\n");
                                if ( cam_info.videodev_type == MM_VIDEO_DEVICE_CAMERA1 )
-                                       g_print("\t   Video Recording (Front camera)\n");
+                                       g_print("\t   Video Capture (Front camera)\n");
                                else if(  cam_info.videodev_type == MM_VIDEO_DEVICE_CAMERA0 )
-                                       g_print("\t   Video Recording (Rear camera)\n");
+                                       g_print("\t   Video Capture (Rear camera)\n");
                                g_print("\t=======================================\n");
 
                                if(mmcamcorder_print_state <= MM_CAMCORDER_STATE_PREPARE) {
-                                       g_print("\t   '1' Start Recording\n");
-                                       g_print("\t   '2' Setting\n");
-                                       g_print("\t   '3' Print FPS\n");
+                                       g_print("\t   '1' Take a photo\n");
+                                       g_print("\t   '2' Start Recording\n");
+                                       g_print("\t   '3' Setting\n");
+                                       g_print("\t   '4' Print FPS\n");
                                        g_print("\t   'b' back\n");
-                               }
-                               else if(mmcamcorder_print_state == MM_CAMCORDER_STATE_RECORDING) {
+                               } else if(mmcamcorder_print_state == MM_CAMCORDER_STATE_RECORDING) {
                                        g_print("\t   'p' Pause Recording\n");
                                        g_print("\t   'c' Cancel\n");
                                        g_print("\t   's' Save\n");
-                               }
-                               else if(mmcamcorder_print_state == MM_CAMCORDER_STATE_PAUSED) {
+                                       g_print("\t   'n' Capture video snapshot\n");
+                               else if(mmcamcorder_print_state == MM_CAMCORDER_STATE_PAUSED) {
                                        g_print("\t   'r' Resume Recording\n");
                                        g_print("\t   'c' Cancel\n");
                                        g_print("\t   's' Save\n");
+                                       g_print("\t   'n' Capture video snapshot\n");
                                }
                                g_print("\t=======================================\n");
-                       }
-                       else if (hcamcorder->mode == MODE_AUDIO)
-                       {
+                       } else if (hcamcorder->mode == MODE_AUDIO) {
                                g_print("\n\t=======================================\n");
                                g_print("\t   Audio Recording\n");
                                g_print("\t=======================================\n");
@@ -906,85 +889,52 @@ static void print_menu()
                        break;
 
                case MENU_STATE_SETTING:
-                       if (hcamcorder->mode == MODE_IMAGE) {
-                               g_print("\n\t=======================================\n");
-                               g_print("\t   Image Capture > Setting\n");
-                               g_print("\t=======================================\n");
-                               g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>> [Camera]  \n");
-                               g_print("\t     '1' Capture 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     'j' Jpeg quality \n");
-                               g_print("\t     'p' Picture format \n");
-                               g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n");
-                               g_print("\t     'v' Visible \n");
-                               g_print("\t     'o' Output mode \n");
-                               g_print("\t     'y' Rotate 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     'x' Capture mode (Still/Multishot)\n");
-                               g_print("\t     'f' Face detection \n");
-                               g_print("\t     'k' Anti-handshake \n");
-                               g_print("\t     'u' Touch AF area \n");
-                               g_print("\t     'm' Stream callback function \n");
-                               g_print("\t     'b' back\n");
-                               g_print("\t=======================================\n");
-
-                       } else if (hcamcorder->mode == MODE_VIDEO) {
-                               g_print("\n\t=======================================\n");
-                               g_print("\t   Video Recording > Setting\n");
-                               g_print("\t=======================================\n");
-                               g_print("\t  >>>>>>>>>>>>>>>>>>>>>>>>>>>> [Camera]  \n");
-                               g_print("\t     '1' Recording 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     'i' ISO \n");
-                               g_print("\t     'r' Rotate camera input \n");
-                               g_print("\t     'p' FPS \n");
-                               g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n");
-                               g_print("\t     'v' Visible \n");
-                               g_print("\t     'o' Output mode \n");
-                               g_print("\t     'y' Rotate 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  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc.]\n");
-                               g_print("\t     'x' High speed recording\n");
-                               g_print("\t     'u' Mute \n");
-                               g_print("\t     'z' Strobe (Flash) \n");
-                               g_print("\t     'k' Anti-handshake \n");
-                               g_print("\t     'e' Camcorder-rotation setting \n");
-                               g_print("\t     'm' Stream callback function \n");
-                               g_print("\t     'b' back\n");
-                               g_print("\t=======================================\n");
-                       }
+                       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     '1' Capture 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     'j' Jpeg quality \n");
+                       g_print("\t     'p' Picture format \n");
+                       g_print("\t     'E' EXIF orientation \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     'x' Capture mode (Still/Multishot/HDR)\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' Stream callback function \n");
+                       g_print("\t     'M' Camcorder Motion Rate setting \n");
+                       g_print("\t     'b' back\n");
+                       g_print("\t=======================================\n");
                        break;
 
                default:
@@ -1001,93 +951,61 @@ static void main_menu(gchar buf)
        int current_fps = 0;
        int average_fps = 0;
        char *err_attr_name = NULL;
-       int width = 0, height = 0;
-
-       if (hcamcorder->mode == MODE_IMAGE) {
-               switch(buf) {
-                       case '1' : //Capture
-                               if(hcamcorder->isMultishot) {
-                                       err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                                       MMCAM_CAPTURE_WIDTH, 640,
-                                                                                       MMCAM_CAPTURE_HEIGHT, 480,
-                                                                                       MMCAM_CAPTURE_COUNT, multishot_num,
-                                                                                       MMCAM_CAPTURE_INTERVAL, IMAGE_CAPTURE_COUNT_INTERVAL,
-                                                                                       NULL);
-                                       if (err < 0) {
-                                               err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
-                                               SAFE_FREE (err_attr_name);
-                                       }       
-                               } else {
-                                       err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                                       MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
-                                                                                       NULL);
-                                       if (err < 0) {
-                                               err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
-                                               SAFE_FREE (err_attr_name);
-                                       }
-                               }
-
-                               g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)test_idle_capture_start, NULL, NULL);
-                               break;
 
-                       case '2' : // Setting
-                               hcamcorder->menu_state = MENU_STATE_SETTING;
-                               break;
-
-                       case '3' : // Print frame rate
-                               current_fps = _mmcamcorder_video_current_framerate(hcamcorder->camcorder);
-                               average_fps = _mmcamcorder_video_average_framerate(hcamcorder->camcorder);
-                               g_print("\tVideo Frame Rate[Current : %d.0 fps, Average : %d.0 fps]\n", current_fps, average_fps);
-                               break;
+       if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
+               if (mmcamcorder_state == MM_CAMCORDER_STATE_PREPARE) {
+                       switch (buf) {
+                               case '1' : //Capture
+                                       if(hcamcorder->isMultishot) {
+                                               int interval = 0;
+                                               flush_stdin();
+                                               printf("\ninput interval(ms) \n");
+                                               err = scanf("%d", &interval);
+                                               if (err == EOF) {
+                                                       printf("\nscanf error : errno %d\n", errno);
+                                                       interval = 300;
+                                               }
+                                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+                                                                                 MMCAM_CAPTURE_INTERVAL, interval,
+                                                                                 NULL);
+                                               if (err != MM_ERROR_NONE) {
+                                                       err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
+                                                       SAFE_FREE (err_attr_name);
+                                               }
+                                       } else {
+                                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+                                                                                 MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
+                                                                                 NULL);
+                                               if (err != MM_ERROR_NONE) {
+                                                       err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
+                                                       SAFE_FREE (err_attr_name);
+                                               }
+                                       }
 
-                       case 'b' : // back
-                               hcamcorder->menu_state = MENU_STATE_MAIN;
-                               mode_change();
-                               break;
+                                       g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)test_idle_capture_start, NULL, NULL);
+                                       break;
 
-                       default:
-                               g_print("\t Invalid input \n");
-                               break;                                  
-               }                       
-       }
-       else if (hcamcorder->mode == MODE_VIDEO)
-       {
-               if (mmcamcorder_state == MM_CAMCORDER_STATE_PREPARE) {
-                       switch(buf) {
-                               case '1' : // Start Recording
+                               case '2' : // Start Recording
                                        g_print("*Recording start!\n");
                                        video_stream_cb_cnt = 0;
                                        audio_stream_cb_cnt = 0;
-
-                                       mm_camcorder_get_attributes( hcamcorder->camcorder, NULL,
-                                                                               MMCAM_CAMERA_WIDTH, &width,
-                                                                               MMCAM_CAMERA_HEIGHT, &height,
-                                                                               NULL );
-
-                                       mm_camcorder_set_attributes( hcamcorder->camcorder, NULL,
-                                                                               MMCAM_CAMERA_AF_TOUCH_X, width>>1,
-                                                                               MMCAM_CAMERA_AF_TOUCH_Y, height>>1,
-                                                                               MMCAM_CAMERA_AF_TOUCH_WIDTH, 30,
-                                                                               MMCAM_CAMERA_AF_TOUCH_HEIGHT, 30,
-                                                                               NULL );
-
-                                       mm_camcorder_start_focusing(hcamcorder->camcorder);
+                                       hcamcorder->elapsed_time = 0;
 
                                        g_timer_reset(timer);
                                        err = mm_camcorder_record(hcamcorder->camcorder);
 
-                                       if (err < 0) {
-                                               warn_msg_t("Rec start mm_camcorder_record  = %x", err);
+                                       if (err != MM_ERROR_NONE) {
+                                               warn_msg_t("Rec start mm_camcorder_record 0x%x", err);
                                        }
 
                                        mmcamcorder_print_state = MM_CAMCORDER_STATE_RECORDING;
                                        break;
 
-                               case '2' : // Setting
+                               case '3' : // Setting
                                        hcamcorder->menu_state = MENU_STATE_SETTING;
                                        break;
 
-                               case '3' :
+                               case '4' : // Print frame rate
                                        current_fps = _mmcamcorder_video_current_framerate(hcamcorder->camcorder);
                                        average_fps = _mmcamcorder_video_average_framerate(hcamcorder->camcorder);
                                        g_print("\tVideo Frame Rate[Current : %d.0 fps, Average : %d.0 fps]\n", current_fps, average_fps);
@@ -1097,9 +1015,13 @@ static void main_menu(gchar buf)
                                        hcamcorder->menu_state = MENU_STATE_MAIN;
                                        mode_change();
                                        break;
+
+                               default:
+                                       g_print("\t Invalid input \n");
+                                       break;
                        }
                } else if (mmcamcorder_state == MM_CAMCORDER_STATE_RECORDING || mmcamcorder_state == MM_CAMCORDER_STATE_PAUSED) {
-                       switch(buf) {
+                       switch (buf) {
                                if (mmcamcorder_state == MM_CAMCORDER_STATE_RECORDING) {
                                        case 'p'  : // Pause Recording
                                                g_print("*Pause!\n");
@@ -1145,6 +1067,10 @@ static void main_menu(gchar buf)
                                        mmcamcorder_print_state = MM_CAMCORDER_STATE_PREPARE;
                                        break;
 
+                               case 'n' : /* Capture video snapshot */
+                                       err = mm_camcorder_capture_start(hcamcorder->camcorder);
+                                       break;
+
                                default :
                                        g_print("\t Invalid input \n");
                                        break;
@@ -1152,13 +1078,12 @@ static void main_menu(gchar buf)
                } else {
                        err_msg_t("Wrong camcorder state, check status!!");
                }
-       }
-       else if (hcamcorder->mode == MODE_AUDIO)
-       {
+       } else if (hcamcorder->mode == MODE_AUDIO) {
                if (mmcamcorder_state == MM_CAMCORDER_STATE_PREPARE) {
                        switch(buf) {
                                case '1' : //  Start Recording
                                        g_print("*Recording start!\n");
+                                       hcamcorder->elapsed_time = 0;
                                        g_timer_reset(timer);
                                        err = mm_camcorder_record(hcamcorder->camcorder);
 
@@ -1240,35 +1165,83 @@ static void main_menu(gchar buf)
 static void setting_menu(gchar buf)
 {
        gboolean bret = FALSE;
-       int index=0;
+       int idx = 0;
        int min = 0;
        int max = 0;
        int width_count = 0;
-       int heigh_count = 0;
+       int height_count = 0;
        int i=0;
        int count = 0;
        int value = 0;
        int* array = NULL;
        int *width_array = NULL;
-       int *heigh_array = NULL;
+       int *height_array = NULL;
        char *err_attr_name = NULL;
        cam_xypair_t input_pair;
        int err = MM_ERROR_NONE;
        int x = 0, y = 0, width = 0, height = 0;
-       double new_volume = 0.0;
        gint error_num=0;
 
-       if (hcamcorder->mode == MODE_IMAGE)
-       {
-               switch(buf) {
-       /* Camera setting */
+       if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
+               switch (buf) {
+                       /* Camera setting */
+                       case '0':  // Setting > Preview Resolution setting
+                               g_print("*Select the preview resolution!\n");
+                               camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_WIDTH, &width_array, &width_count);
+                               camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_HEIGHT, &height_array, &height_count);
+
+                               if(width_count != height_count) {
+                                       err_msg_t("System has wrong information!!\n");
+                               } else if (width_count == 0) {
+                                       g_print("Not supported!!\n");
+                               } else {
+                                       flush_stdin();
+
+                                       for ( i = 0; i < width_count; i++) {
+                                               g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]);
+                                       }
+                                       err = scanf("%d",&idx);
+                                       if (err == EOF) {
+                                               printf("\nscanf error : errno %d\n", errno);
+                                       } else {
+                                               if( idx > 0 && idx <= width_count ) {
+                                                       //Set capture size first
+                                                       input_pair.attr_subcat_x = MMCAM_CAMERA_WIDTH;
+                                                       input_pair.attr_subcat_y = MMCAM_CAMERA_HEIGHT;
+                                                       input_pair.x = width_array[idx-1];
+                                                       input_pair.y = height_array[idx-1];
+                                                       bret = camcordertest_set_attr_xypair(input_pair);
+                                               }
+                                       }
+                               }
+                               break;
                        case '1' : // Setting > Capture Resolution setting
+                               /* check recommend preview resolution */
+                               camcordertest_get_attr_valid_intarray(MMCAM_RECOMMEND_CAMERA_WIDTH, &width_array, &width_count);
+                               camcordertest_get_attr_valid_intarray(MMCAM_RECOMMEND_CAMERA_HEIGHT, &height_array, &height_count);
+                               if(width_count != height_count) {
+                                       err_msg_t("System has wrong information!!\n");
+                               } else if (width_count == 0) {
+                                       g_print("MMCAM_RECOMMEND_CAMERA_WIDTH/HEIGHT Not supported!!\n");
+                               } else {
+                                       g_print("\n - MMCAM_RECOMMEND_CAMERA_WIDTH and HEIGHT (count %d) -\n", width_count);
+                                       if (width_count > 0) {
+                                               g_print("\t NORMAL ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL], height_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL]);
+                                       }
+                                       if (width_count > 1) {
+                                               g_print("\t WIDE ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE], height_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE]);
+                                       }
+                                       if (width_count > 2) {
+                                               g_print("\t SQUARE ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_SQUARE], height_array[MM_CAMCORDER_PREVIEW_TYPE_SQUARE]);
+                                       }
+                               }
+
                                g_print("*Select the resolution!\n");
                                camcordertest_get_attr_valid_intarray("capture-width", &width_array, &width_count);
-                               camcordertest_get_attr_valid_intarray("capture-height", &heigh_array, &heigh_count);
+                               camcordertest_get_attr_valid_intarray("capture-height", &height_array, &height_count);
 
-                               if(width_count != heigh_count) {
-                                       err_msg_t("System has wrong information!!");
+                               if(width_count != height_count) {
+                                       err_msg_t("System has wrong information!!\n");
                                } else if (width_count == 0) {
                                        g_print("Not supported!!\n");
                                } else {
@@ -1276,17 +1249,20 @@ static void setting_menu(gchar buf)
                                        flush_stdin();
 
                                        for ( i = 0; i < width_count; i++) {
-                                               g_print("\t %d. %d*%d\n", i+1, width_array[i], heigh_array[i]);
+                                               g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]);
                                        }
-                                       scanf("%d",&index);
-
-                                       if( index > 0 && index <= width_count ) {
-                               //Set capture size first
-                                               input_pair.attr_subcat_x = "capture-width";
-                                               input_pair.attr_subcat_y = "capture-height";
-                                               input_pair.x = width_array[index-1];
-                                               input_pair.y = heigh_array[index-1];
-                                               bret = camcordertest_set_attr_xypair(input_pair);
+                                       err = scanf("%d",&idx);
+                                       if (err == EOF) {
+                                               printf("\nscanf error : errno %d\n", errno);
+                                       } else {
+                                               if( idx > 0 && idx <= width_count ) {
+                                                       //Set capture size first
+                                                       input_pair.attr_subcat_x = "capture-width";
+                                                       input_pair.attr_subcat_y = "capture-height";
+                                                       input_pair.x = width_array[idx-1];
+                                                       input_pair.y = height_array[idx-1];
+                                                       bret = camcordertest_set_attr_xypair(input_pair);
+                                               }
                                        }
                                }
                                break;
@@ -1300,8 +1276,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Digital zoom level (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-digital-zoom", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-digital-zoom", idx);
                                }
                                break;
 
@@ -1314,25 +1290,47 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Optical zoom level (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-optical-zoom", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-optical-zoom", idx);
                                }
                                break;
 
                        case '4' : // Setting > AF mode
-                               g_print("*Focus mode !\n");
-                               camcordertest_get_attr_valid_intarray("camera-focus-mode", &array, &count);
+                               g_print("\t0. AF Mode setting !\n");
+                               g_print("\t1. AF Start !\n");
+                               g_print("\t2. AF Stop !\n\n");
 
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Focus mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], focus_mode[array[i]]);
+                               flush_stdin();
+                               err = scanf("%d", &idx);
+
+                               switch (idx) {
+                               case 0:
+                               {
+                                       g_print("*Focus mode !\n");
+                                       camcordertest_get_attr_valid_intarray("camera-focus-mode", &array, &count);
+
+                                       if(count <= 0) {
+                                               g_print("Not supported !! \n");
+                                       } else {
+                                               g_print("\n Select Focus mode \n");
+                                               flush_stdin();
+                                               for (i = 0 ; i < count ; i++) {
+                                                       g_print("\t %d. %s\n", array[i], focus_mode[array[i]]);
+                                               }
+                                               err = scanf("%d",&idx);
+                                               bret = camcordertest_set_attr_int("camera-focus-mode", idx);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-focus-mode", index);
+                               }
+                                       break;
+                               case 1:
+                                       mm_camcorder_start_focusing(hcamcorder->camcorder);
+                                       break;
+                               case 2:
+                                       mm_camcorder_stop_focusing(hcamcorder->camcorder);
+                                       break;
+                               default:
+                                       g_print("Wrong Input[%d] !! \n", idx);
+                                       break;
                                }
                                break;
 
@@ -1348,12 +1346,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], af_scan[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-af-scan-range", index);
-
-                                       if( bret ) {
-                                               mm_camcorder_start_focusing(hcamcorder->camcorder);
-                                       }
+                                       err = scanf("%d",&idx);
+                                       camcordertest_set_attr_int("camera-af-scan-range", idx);
                                }
                                break;
 
@@ -1369,8 +1363,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], exposure_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-exposure-mode", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-exposure-mode", idx);
                                }
                                break;
 
@@ -1383,8 +1377,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Exposure value(%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-exposure-value", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-exposure-value", idx);
                                }
                                break;
 
@@ -1404,10 +1398,10 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %d \n", i+1, array[i]);
                                        }
-                                       scanf("%d",&index);
+                                       err = scanf("%d",&idx);
 
-                                       if( index > 0 && index <= count ) {
-                                               bret = camcordertest_set_attr_int("camera-shutter-speed", array[index-1]);
+                                       if( idx > 0 && idx <= count ) {
+                                               bret = camcordertest_set_attr_int("camera-shutter-speed", array[idx-1]);
                                        }
                                }
                                break;
@@ -1424,43 +1418,59 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], iso_name[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-iso", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-iso", idx);
                                }
                                break;
 
                        case 'r' : // Setting > Rotate camera input when recording
-                               g_print("*Rotate camera input when recording !\n");
+                               g_print("*Rotate camera input\n");
                                camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_ROTATION, &array, &count);
 
                                if(count <= 0) {
                                        g_print("Not supported !! \n");
                                } else {
-                                       g_print("\n Select Rotate angle of camera \n");
                                        flush_stdin();
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], camera_rotation[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index);
+                                       err = scanf("%d",&idx);
                                        CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
+                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, idx);
                                        CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
                                }
                                break;
 
-                       case 'j' : // Setting > Jpeg quality
-                               g_print("*Jpeg quality !\n");
-                               camcordertest_get_attr_valid_intrange("image-encoder-quality", &min, &max);
+                       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(mm_camcorder_stop(hcamcorder->camcorder));
+                               CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
+
+                               camcordertest_set_attr_int(MMCAM_CAMERA_FLIP, idx);
+
+                               CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
+                               CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
+                               break;
+
+                       case 'j' : // Setting > Jpeg quality
+                               g_print("*Jpeg quality !\n");
+                               camcordertest_get_attr_valid_intrange("image-encoder-quality", &min, &max);
 
                                if(min >= max) {
                                        g_print("Not supported !! \n");
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Jpeg quality (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("image-encoder-quality", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("image-encoder-quality", idx);
                                }
                                break;
 
@@ -1476,8 +1486,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], image_fmt[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-format", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-format", idx);
                                        CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
                                        CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
                                        CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
@@ -1485,7 +1495,30 @@ static void setting_menu(gchar buf)
                                }
                                break;
 
-               /* Display / Filter setting */
+                       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 {
+                                       camcordertest_set_attr_int(MMCAM_TAG_ORIENTATION, idx);
+                               }
+
+                               break;
+
+                       /* Display / Filter setting */
                        case 'v' : // Display visible
                                g_print("* Display visible setting !\n");
                                camcordertest_get_attr_valid_intarray( "display-visible", &array, &count );
@@ -1498,11 +1531,28 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], visible_mode[array[i]]);
                                        }
-                                       scanf("%d",&value);
+                                       err = scanf("%d",&value);
                                        bret = camcordertest_set_attr_int( "display-visible", value );
                                }
                                break;
 
+                       case 'n' : //  Setting > Display mode
+                               g_print("* Display mode!\n");
+                               camcordertest_get_attr_valid_intarray(MMCAM_DISPLAY_MODE, &array, &count);
+
+                               if (count <= 0 || count > 255) {
+                                       g_print("Not supported !! \n");
+                               } else {
+                                       flush_stdin();
+                                       g_print("\n Select Display mode\n");
+                                       for (i = 0 ; i < count ; i++) {
+                                               g_print("\t %d. %s\n", array[i], display_mode[array[i]]);
+                                       }
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, idx);
+                               }
+                               break;
+
                        case 'o' : //  Setting > Output mode
                                g_print("* Output mode!\n");
                                camcordertest_get_attr_valid_intrange("display-geometry-method", &min, &max);
@@ -1515,27 +1565,33 @@ static void setting_menu(gchar buf)
                                        for( i = min ; i <= max ; i++ ) {
                                                g_print( "%d. %s\n", i, output_mode[i] );
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("display-geometry-method", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("display-geometry-method", idx);
                                }
                                break;
 
                        case 'y' : // Setting > Rotate Display
-                               camcordertest_get_attr_valid_intarray( MMCAM_DISPLAY_ROTATION, &array, &count );
+                               camcordertest_get_attr_valid_intrange(MMCAM_DISPLAY_ROTATION, &min, &max);
 
-                               if( count <= 0 || count > 256 ) {
+                               if( min > max ) {
                                        g_print("Not supported !! \n");
                                } else {
                                        flush_stdin();
-                                       g_print("\n Select Rotation mode\n");
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], rotate_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int( MMCAM_DISPLAY_ROTATION, index );
+                                       g_print("\n Select Rotate mode(%d ~ %d)\n", min, max);
+                                       g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t3. 270\n\n");
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, idx);
                                }
                                break;
 
+                       case 'Y' : // Setting > Flip Display
+                               flush_stdin();
+                               g_print("\n Select Rotate mode(%d ~ %d)\n", min, max);
+                               g_print("\t0. NONE\n\t1. HORIZONTAL\n\t2. VERTICAL\n\t3. BOTH\n\n");
+                               err = scanf("%d",&idx);
+                               camcordertest_set_attr_int(MMCAM_DISPLAY_FLIP, idx);
+                               break;
+
                        case 'g' : // Setting > Brightness
                                g_print("*Brightness !\n");
                                camcordertest_get_attr_valid_intrange("filter-brightness", &min, &max);
@@ -1545,8 +1601,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  brightness (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-brightness", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-brightness", idx);
                                }
                                break;
 
@@ -1559,8 +1615,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Contrast (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-contrast", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-contrast", idx);
                                }
                                break;
 
@@ -1573,8 +1629,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Saturation (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-saturation", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-saturation", idx);
                                }
                                break;
 
@@ -1587,8 +1643,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Hue (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-hue", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-hue", idx);
                                }
                                break;
 
@@ -1601,8 +1657,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Sharpness (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-sharpness", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-sharpness", idx);
                                }
                                break;
 
@@ -1618,8 +1674,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], wb[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-wb", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-wb", idx);
                                }
                                break;
 
@@ -1635,8 +1691,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], ct[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-color-tone", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-color-tone", idx);
                                }
                                break;
 
@@ -1653,8 +1709,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], wdr_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-wdr", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-wdr", idx);
                                }
                                break;
 
@@ -1670,12 +1726,12 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], program_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-scene-mode", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-scene-mode", idx);
                                }
                                break;
 
-               /* ext. setting */
+                       /* ext. setting */
                        case 'z' : // Setting > Strobe setting
                                g_print("*Strobe Mode\n");
                                camcordertest_get_attr_valid_intarray("strobe-mode", &array, &count);
@@ -1687,24 +1743,29 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], strobe_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("strobe-mode", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("strobe-mode", idx);
                                }
                                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");
-                               scanf("%d",&index);
+                               g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n");
+                               err = scanf("%d",&idx);
 
-                               if(index == 1) {
+                               switch (idx) {
+                               case 1:
                                        g_print("stillshot mode selected and capture callback is set!!!!\n");
                                        hcamcorder->isMultishot = FALSE;
-                               } else if (index == 2) {
+                                       camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0);
+                                       break;
+                               case 2:
                                        g_print("Multilshot mode selected!!\n");
 
-                                       index = 0;
+                                       camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0);
+
+                                       idx = 0;
                                        min = 0;
                                        max = 0;
 
@@ -1715,20 +1776,42 @@ static void setting_menu(gchar buf)
                                                flush_stdin();
                                                //g_print("\n Check Point!!! [Change resolution to 800x480]\n");
                                                g_print("Select  mulitshot number (%d ~ %d)\n", min, max);
-                                               scanf("%d",&index);
-                                               if( index >= min && index <= max ) {
-                                                       multishot_num = index;
+                                               err = scanf("%d",&idx);
+                                               if( idx >= min && idx <= max ) {
+                                                       multishot_num = idx;
+                                                       mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+                                                                                   MMCAM_CAPTURE_COUNT, multishot_num,
+                                                                                   NULL);
                                                        hcamcorder->isMultishot = TRUE;
                                                } else {
                                                        g_print("Wrong input value, Multishot setting failed!!\n");
                                                }
                                        }
-                               } else {
+                                       break;
+                               case 3:
+                                       g_print("HDR Capture mode selected\n");
+                                       hcamcorder->isMultishot = FALSE;
+
+                                       camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_HDR_CAPTURE, &array, &count);
+                                       if(count <= 0) {
+                                               g_print("Not supported !! \n");
+                                       } else {
+                                               g_print("\nSelect HDR capture mode\n");
+                                               flush_stdin();
+                                               for ( i = 0; i < count; i++) {
+                                                       g_print("\t %d. %s\n", array[i], hdr_mode[array[i]]);
+                                               }
+                                               err = scanf("%d",&idx);
+                                               bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, idx);
+                                       }
+                                       break;
+                               default:
                                        g_print("Wrong input, select again!!\n");
+                                       break;
                                }
                                break;
 
-                       case 'f' : // Setting > Face detection setting
+                       case 'l' : // Setting > Face detection setting
                                //hcamcorder->menu_state = MENU_STATE_SETTING_DETECTION;
                                g_print("* Face detect mode !\n");
 
@@ -1741,10 +1824,10 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s \n", array[i], detection_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
+                                       err = scanf("%d",&idx);
 
-                                       if( index >= 0 && index < count ) {
-                                               bret = camcordertest_set_attr_int("detect-mode", array[index]);
+                                       if( idx >= 0 && idx < count ) {
+                                               bret = camcordertest_set_attr_int("detect-mode", array[idx]);
                                        } else {
                                                g_print("Wrong input value. Try again!!\n");
                                                bret = FALSE;
@@ -1752,614 +1835,118 @@ static void setting_menu(gchar buf)
                                }
                                break;
 
-                       case 'k' : // Setting > Anti-handshake
-                               g_print("*Anti-handshake !\n");
-                               camcordertest_get_attr_valid_intarray("camera-anti-handshake", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Anti-handshake mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], ahs_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-anti-handshake", index);
-                               }
-                               break;
-
-                       case 'u': // Touch AF area
-                               g_print("* Touch AF area !\n");
-                               camcordertest_get_attr_valid_intrange("camera-af-touch-x", &min, &max);
-                               if( max < min ) {
-                                       g_print( "Not Supported camera-af-touch-x !!\n" );
-                                       break;
-                               }
-                               camcordertest_get_attr_valid_intrange("camera-af-touch-y", &min, &max);
-                               if( max < min ) {
-                                       g_print( "Not Supported camera-af-touch-y !!\n" );
-                                       break;
-                               }
-                               camcordertest_get_attr_valid_intrange("camera-af-touch-width", &min, &max);
-                               if( max < min ) {
-                                       g_print( "Not Supported camera-af-touch-width !!\n" );
-                                       break;
-                               }
-                               camcordertest_get_attr_valid_intrange("camera-af-touch-height", &min, &max);
-                               if( max < min ) {
-                                       g_print( "Not Supported camera-af-touch-height!!\n" );
-                                       break;
-                               }
-
-                               flush_stdin();
-                               g_print( "\n Input x,y,width,height \n" );
-                               scanf( "%d,%d,%d,%d", &x, &y, &width, &height );
-                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                                               MMCAM_CAMERA_AF_TOUCH_X, x,
-                                                                                               MMCAM_CAMERA_AF_TOUCH_Y, y,
-                                                                                               MMCAM_CAMERA_AF_TOUCH_WIDTH, width,
-                                                                                               MMCAM_CAMERA_AF_TOUCH_HEIGHT, height,
-                                                                                               NULL);
-
-                               if( err != MM_ERROR_NONE ) {
-                                       g_print( "Failed to set touch AF area.(%x)(%s)\n", err, err_attr_name );
-                                       free( err_attr_name );
-                                       err_attr_name = NULL;
-                               } else {
-                                       g_print( "Succeed to set touch AF area.\n" );
-                               }
-                               break;
-
-                       case 'm' : // Setting > Stream callback function
-                               g_print("Not supported !! \n");
-                               break;
-
-                       case 'b' : // back
-                               hcamcorder->menu_state = MENU_STATE_MAIN;
-                               break;
-
-                       default :
-                               g_print("\t Invalid input \n");
-                               break;
-               }
-       }
-       else if(hcamcorder->mode == MODE_VIDEO)
-       {
-               switch(buf)
-               {
-               /* Camera setting */
-                       case '1' : // Setting > Recording Resolution
-                               g_print("*Select resolution!\n");
-
-                               camcordertest_get_attr_valid_intarray("camera-width", &width_array, &width_count);
-                               camcordertest_get_attr_valid_intarray("camera-height", &heigh_array, &heigh_count);
-
-                               if(width_count != heigh_count) {
-                                       err_msg_t("System has wrong information!!");
-                               } else if(width_count == 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select  the resolution \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < width_count; i++) {
-                                               g_print("\t %d. %d*%d\n", i+1, width_array[i], heigh_array[i]);
-                                       }
-                                       scanf("%d",&index);
-
-                                       if( index > 0 && index <= width_count ) {
-                                               g_timer_reset(timer);
-                                               CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                               CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
-
-                                               //Set source size
-                                               input_pair.attr_subcat_x = "camera-width";
-                                               input_pair.attr_subcat_y = "camera-height";
-                                               input_pair.x = width_array[index-1];
-                                               input_pair.y = heigh_array[index-1];
-
-                                               bret = camcordertest_set_attr_xypair(input_pair);
-
-                                               CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
-                                               CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
-                                               time_msg_t("Resolution change  : %12.6lf s", g_timer_elapsed(timer, NULL));
-                                       } else {
-                                               warn_msg_t( "Out of index" );
-                                       }
-                               }
-                       break;
-
-                       case '2' : // Setting > Digital zoom level
-                               g_print("*Digital zoom level  !\n");
-                               camcordertest_get_attr_valid_intrange("camera-digital-zoom", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Digital zoom level (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-digital-zoom", index);
-                               }
-                               break;
-
-                       case '3' : // Setting > Optical zoom level
-                               g_print("*Optical zoom level  !\n");
-                               camcordertest_get_attr_valid_intrange("camera-optical-zoom", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Optical zoom level (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-optical-zoom", index);
-                               }
-                               break;
-
-                       case '4' : // Setting > AF mode
-                               g_print("*Focus mode !\n");
-                               camcordertest_get_attr_valid_intarray("camera-focus-mode", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Focus mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], focus_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-focus-mode", index);
-                               }
-                               break;
-
-                       case '5' : // Setting > AF scan range
-                               g_print("*AF scan range !\n");
-                               camcordertest_get_attr_valid_intarray("camera-af-scan-range", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select AF scan range \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], af_scan[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-af-scan-range", index);
-
-                                       if( bret ) {
-                                               mm_camcorder_start_focusing(hcamcorder->camcorder);
-                                       }
-                               }
-                               break;
-
-                       case '6' : // Setting > Exposure mode
-                               g_print("* Exposure mode!\n");
-                               camcordertest_get_attr_valid_intarray("camera-exposure-mode", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select  Exposure mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], exposure_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-exposure-mode", index);
-                               }
-                               break;
-
-                       case '7' :  // Setting > Exposure value
-                               g_print("*Exposure value  !\n");
-                               camcordertest_get_attr_valid_intrange("camera-exposure-value", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Exposure value(%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-exposure-value", index);
-                               }
-                               break;
-
-                       case '8' : // Setting > F number
-                               g_print("Not supported !! \n");
-                               break;
-
-                       case 'i' : // Setting > ISO
-                               g_print("*ISO !\n");
-                               camcordertest_get_attr_valid_intarray("camera-iso", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select ISO \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], iso_name[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-iso", index);
-                               }
-                               break;
-
-                       case 'r' : // Setting > Rotate camera input when recording
-                               g_print("*Rotate camera input !\n");
-                               camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_ROTATION, &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Rotate angle of camera (Do Not use it for recording test !!) \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], camera_rotation[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-
-                                       CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
-
-                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index);
-
-                                       CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
-                               }
-                               break;
-
-                       case 'p' : // Setting > FPS
-                               g_print("* FPS !\n");
-
-                               camcordertest_get_attr_valid_intarray("camera-fps", &array, &count);
-
-                               if(count <= 0 || count > 256)
-                               { 
-                                       g_print("Not supported !! \n");
-                               }
-                               else
-                               {
-                                       g_print("\n Select  FPS \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++)
-                                       {
-                                               g_print("\t %d. %d \n", i+1, array[i]);
-                                       }                                       
-                                       scanf("%d",&index);
-
-                                       if( index > 0 && index <= count )
-                                       {
-                                               bret = camcordertest_set_attr_int("camera-fps", array[index-1]);
-                                               hcamcorder->fps = array[index-1];
-                                       }
-                                       else
-                                       {
-                                               bret = FALSE;
-                                               g_print("\n Out of index \n");
-                                       }
-                               }
-                               break;
-
-               /* Display / Filter setting */
-                       case 'v' : // Setting > Display visible
-                               g_print("* Display visible setting !\n");
-                               camcordertest_get_attr_valid_intarray( "display-visible", &array, &count );
-
-                               if( count < 1 ) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Display visible \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], visible_mode[array[i]]);
-                                       }
-                                       scanf("%d",&value);
-                                       bret = camcordertest_set_attr_int( "display-visible", value );
-                               }
-                               break;
-
-                       case 'o' : // Setting > Output mode
-                               g_print("* Output mode!\n");
-                               camcordertest_get_attr_valid_intrange("display-geometry-method", &min, &max);
-
-                               if( min > max ) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select Output mode(%d ~ %d)\n", min, max);
-                                       for( i = min ; i <= max ; i++ ) {
-                                               g_print( "%d. %s\n", i, output_mode[i] );
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("display-geometry-method", index);
-                               }
-                               break;
-
-                       case 'y' : // Setting > Rotate Display
-                               camcordertest_get_attr_valid_intarray( MMCAM_DISPLAY_ROTATION, &array, &count );
-
-                               if( count <= 0 || count > 256 ) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select Rotation mode\n");
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], rotate_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int( MMCAM_DISPLAY_ROTATION, index );
-                               }
-                               break;
-
-                       case 'g' : // Setting > Brightness
-                               g_print("*Brightness !\n");
-                               camcordertest_get_attr_valid_intrange("filter-brightness", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  brightness (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-brightness", index);
-                               }
-                               break;
-
-                       case 'c' : // Setting > Contrast
-                               g_print("*Contrast !\n");
-                               camcordertest_get_attr_valid_intrange("filter-contrast", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Contrast (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-contrast", index);
-                               }
-                               break;
-
-                       case 's' : // Setting > Saturation
-                               g_print("*Saturation !\n");
-                               camcordertest_get_attr_valid_intrange("filter-saturation", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Saturation (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-saturation", index);
-                               }
-                               break;
-
-                       case 'h' : // Setting > Hue
-                               g_print("*Hue !\n");
-                               camcordertest_get_attr_valid_intrange("filter-hue", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Hue (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-hue", index);
-                               }
-                               break;
-
-                       case 'a' : // Setting > Sharpness
-                               g_print("*Sharpness !\n");
-                               camcordertest_get_attr_valid_intrange("filter-sharpness", &min, &max);
-
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select  Sharpness (%d ~ %d)\n", min, max);
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-sharpness", index);
-                               }
-                               break;
-
-                       case 'w' : // Setting > White balance
-                               g_print("*White balance !\n");
-                               camcordertest_get_attr_valid_intarray("filter-wb", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       flush_stdin();
-                                       g_print("\n Select White balance \n");
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], wb[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-wb", index);
-                               }
-                               break;
-
-                       case 't' : // Setting > Color tone
-                               g_print("*Color tone !\n");
-                               camcordertest_get_attr_valid_intarray("filter-color-tone", &array, &count);
+                       case 'k' : // Setting > Anti-handshake
+                               g_print("*Anti-handshake !\n");
+                               camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_ANTI_HANDSHAKE, &array, &count);
 
                                if(count <= 0) {
                                        g_print("Not supported !! \n");
                                } else {
-                                       g_print("\n Select Color tone \n");
+                                       g_print("\n Select Anti-handshake mode \n");
                                        flush_stdin();
                                        for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], ct[array[i]]);
+                                               g_print("\t %d. %s\n", array[i], ahs_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-color-tone", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ANTI_HANDSHAKE, idx);
                                }
                                break;
 
-                       case 'd' : // Setting > WDR
-                               g_print("*WDR !\n");
-                               camcordertest_get_attr_valid_intarray("camera-wdr", &array, &count);
+                       case 'K' : // Setting > Video-stabilization
+                               g_print("*Video-stabilization !\n");
+                               camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_VIDEO_STABILIZATION, &array, &count);
 
                                if(count <= 0) {
                                        g_print("Not supported !! \n");
-                               }
-                               else {
-                                       g_print("\n Select WDR Mode \n");
+                               } else {
+                                       g_print("\n Select Video-stabilization mode \n");
                                        flush_stdin();
                                        for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], wdr_mode[array[i]]);
+                                               g_print("\t %d. %s\n", array[i], vs_mode[array[i]]);
                                        }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-wdr", index);
-                               }
-                               break;
-
-               /* ext. setting */
-                       case 'x' : // Setting > High Speed
-                       {
-                               static int backup_width = 0;
-                               static int backup_height = 0;
-
-                               g_print("\n Select High Speed Recording mode\n");
-                               g_print("\t 1. High Speed Recording mode ON\n");
-                               g_print("\t 2. High Speed Recording mode OFF \n");
-
-                               flush_stdin();
-                               scanf("%d",&index);
-                               if (index == 1) {
-                                       mm_camcorder_get_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                   MMCAM_CAMERA_WIDTH, &backup_width,
-                                                                   MMCAM_CAMERA_HEIGHT, &backup_height,
-                                                                   NULL);
+                                       err = scanf("%d",&idx);
 
-                                       CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
-
-                                       err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                         MMCAM_CAMERA_WIDTH, 320,
-                                                                         MMCAM_CAMERA_HEIGHT, 240,
-                                                                         MMCAM_CAMERA_FPS, 120,
-                                                                         "camera-slow-motion-fps", 30,
-                                                                         NULL);
-                                       if (err != MM_ERROR_NONE) {
-                                               warn_msg_t("High speed recording. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err);
-                                               SAFE_FREE(err_attr_name);
-                                       }
+                                       if (idx == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
+                                               g_print("\n Restart preview with NV12 and 720p resolution\n");
 
-                                       CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
+                                               err = mm_camcorder_stop(hcamcorder->camcorder);
+                                               if (err == MM_ERROR_NONE) {
+                                                       err = mm_camcorder_unrealize(hcamcorder->camcorder);
+                                               }
 
-                               } else if(index == 2) {
-                                       CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
+                                               input_pair.attr_subcat_x = MMCAM_CAMERA_WIDTH;
+                                               input_pair.attr_subcat_y = MMCAM_CAMERA_HEIGHT;
+                                               input_pair.x = 1280;
+                                               input_pair.y = 720;
+                                               camcordertest_set_attr_xypair(input_pair);
+                                               camcordertest_set_attr_int(MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_NV12);
+                                               camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
+
+                                               if (err == MM_ERROR_NONE) {
+                                                       err = mm_camcorder_realize(hcamcorder->camcorder);
+                                                       if (err == MM_ERROR_NONE) {
+                                                               err = mm_camcorder_start(hcamcorder->camcorder);
+                                                       }
+                                               }
 
-                                       if (backup_width && backup_height) {
-                                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                                 MMCAM_CAMERA_WIDTH, backup_width,
-                                                                                 MMCAM_CAMERA_HEIGHT, backup_height,
-                                                                                 NULL);
                                                if (err != MM_ERROR_NONE) {
-                                                       warn_msg_t("get_attributes fail. (%s:%x)", err_attr_name, err);
-                                                       SAFE_FREE (err_attr_name);
+                                                       g_print("\n Restart FAILED! %x\n", err);
                                                }
+                                       } else {
+                                               camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
                                        }
-
-                                       err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                         MMCAM_CAMERA_FPS, SRC_VIDEO_FRAME_RATE_30,
-                                                                         "camera-slow-motion-fps", 0,
-                                                                         NULL);
-                                       if (err != MM_ERROR_NONE) {
-                                               warn_msg_t("Normal speed recording. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err);
-                                               SAFE_FREE (err_attr_name);
-                                       }
-
-                                       CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
-                                       CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
-                               } else {
-                                       g_print("Wrong input, Try again!!\n");
                                }
                                break;
-                       }
-                       case 'u' : // Setting > Mute
-                               g_print("*Mute!(%d)\n", hcamcorder->isMute);
 
-                               if (hcamcorder->isMute) {
-                                       new_volume = 0.0;
-                               } else {
-                                       new_volume = 1.0;
+                       case 'u': // Touch AF area
+                               g_print("* Touch AF area !\n");
+                               camcordertest_get_attr_valid_intrange("camera-af-touch-x", &min, &max);
+                               if( max < min ) {
+                                       g_print( "Not Supported camera-af-touch-x !!\n" );
+                                       break;
                                }
-
-                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
-                                                                               MMCAM_AUDIO_VOLUME, new_volume,
-                                                                               NULL);
-                               if (err < 0) {
-                                       warn_msg_t("Can' Mute. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err);
-                                       SAFE_FREE (err_attr_name);
+                               camcordertest_get_attr_valid_intrange("camera-af-touch-y", &min, &max);
+                               if( max < min ) {
+                                       g_print( "Not Supported camera-af-touch-y !!\n" );
+                                       break;
                                }
-
-                               hcamcorder->isMute = !(hcamcorder->isMute);
-                               break;
-
-                       case 'z' : // Setting > Strobe setting
-                               g_print("*Strobe Mode\n");
-                               camcordertest_get_attr_valid_intarray("strobe-mode", &array, &count);
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Strobe Mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], strobe_mode[array[i]]);
-                                       }                                       
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("strobe-mode", index);
+                               camcordertest_get_attr_valid_intrange("camera-af-touch-width", &min, &max);
+                               if( max < min ) {
+                                       g_print( "Not Supported camera-af-touch-width !!\n" );
+                                       break;
                                }
-                               break;
-
-                       case 'k' : //  Setting > Anti-handshake
-                               g_print("*Anti-handshake !\n");
-                               camcordertest_get_attr_valid_intarray("camera-anti-handshake", &array, &count);
-
-                               if(count <= 0) {
-                                       g_print("Not supported !! \n");
-                               } else {
-                                       g_print("\n Select Anti-handshake mode \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < count; i++) {
-                                               g_print("\t %d. %s\n", array[i], ahs_mode[array[i]]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-anti-handshake", index);
+                               camcordertest_get_attr_valid_intrange("camera-af-touch-height", &min, &max);
+                               if( max < min ) {
+                                       g_print( "Not Supported camera-af-touch-height!!\n" );
+                                       break;
                                }
-                               break;
 
-                       case 'e' : //  Setting > Camcorder-rotation setting
-                               g_print("*Camcorder-rotation setting!\n");
-                               camcordertest_get_attr_valid_intrange("camcorder-rotation", &min, &max);
+                               flush_stdin();
+                               g_print( "\n Input x,y,width,height \n" );
+                               err = scanf( "%d,%d,%d,%d", &x, &y, &width, &height );
+                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+                                                                                               MMCAM_CAMERA_AF_TOUCH_X, x,
+                                                                                               MMCAM_CAMERA_AF_TOUCH_Y, y,
+                                                                                               MMCAM_CAMERA_AF_TOUCH_WIDTH, width,
+                                                                                               MMCAM_CAMERA_AF_TOUCH_HEIGHT, height,
+                                                                                               NULL);
 
-                               if(min >= max) {
-                                       g_print("Not supported !! \n");
+                               if( err != MM_ERROR_NONE ) {
+                                       g_print( "Failed to set touch AF area.(%x)(%s)\n", err, err_attr_name );
+                                       free( err_attr_name );
+                                       err_attr_name = NULL;
                                } else {
-                                       g_print("\n Select camcorder-rotation value \n");
-                                       flush_stdin();
-                                       for ( i = 0; i < (max-min+1); i++) {
-                                               g_print("\t %d. %s\n", i, camcorder_rotate_val[i]);
-                                       }
-                                       scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camcorder-rotation", index);
+                                       g_print( "Succeed to set touch AF area.\n" );
                                }
                                break;
 
                        case 'm' : // Setting > Stream callback function
                                g_print("\n Select Stream Callback Function\n");
                                g_print("\t 1. Set Video Stream Callback \n");
-                               g_print("\t 2. Set Audio Stream Callback \n");
-                               g_print("\t 3. Unset Stream Callback \n");
+                               g_print("\t 2. Unset Video Stream Callback \n");
                                flush_stdin();
-                               scanf("%d", &index);
-                               if(index == 1) {
+                               err = scanf("%d", &idx);
+                               if(idx == 1) {
                                        video_stream_cb_cnt = 0;
                                        error_num = mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, (mm_camcorder_video_stream_callback)camcordertest_video_stream_cb, (void*)hcamcorder->camcorder);
                                        if( error_num == MM_ERROR_NONE ) {
@@ -2367,27 +1954,39 @@ static void setting_menu(gchar buf)
                                        } else {
                                                g_print("\n Setting Failure\n");
                                        }
-                               } else if(index == 2) {
-                                       audio_stream_cb_cnt = 0;
-                                       error_num = mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder);
-                                       if( error_num == MM_ERROR_NONE ) {
-                                               g_print("\n Setting Success\n");
-                                       } else {
-                                               g_print("\n Setting Failure\n");
-                                       }
-                               } else if(index == 3) {
+                               } else if(idx == 2) {
                                        mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, NULL, (void*)hcamcorder->camcorder);
-                                       mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, NULL, (void*)hcamcorder->camcorder);
                                        video_stream_cb_cnt = 0;
                                        audio_stream_cb_cnt = 0;
                                        g_print("\n Unset stream callback success\n");
                                } else {
                                        g_print("\t Invalid input \n");
                                }
-                               //g_print("Not supported !! \n");
                                break;
 
-                       case 'b' : //  back
+                       case 'M':
+                       {
+                               float motion_rate = 0.0;
+
+                               flush_stdin();
+
+                               g_print("*Camcorder Motion Rate setting! (should be bigger than zero)\n");
+
+                               err = scanf("%f", &motion_rate);
+                               err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+                                                                 MMCAM_CAMERA_RECORDING_MOTION_RATE, motion_rate,
+                                                                 NULL);
+                               if (err != MM_ERROR_NONE) {
+                                       g_print("Failed to set Camcorder Motion Rate %f [err:0x%x]\n", motion_rate, err);
+                                       free( err_attr_name );
+                                       err_attr_name = NULL;
+                               } else {
+                                       g_print("Succeed to set Motion Rate %f\n", motion_rate);
+                               }
+                       }
+                               break;
+
+                       case 'b' : // back
                                hcamcorder->menu_state = MENU_STATE_MAIN;
                                break;
 
@@ -2395,12 +1994,17 @@ static void setting_menu(gchar buf)
                                g_print("\t Invalid input \n");
                                break;
                }
-       }
-       else 
-       {
+       } else {
                g_print("\t Invalid mode, back to upper menu \n");
                hcamcorder->menu_state = MENU_STATE_MAIN;
        }
+
+       if(err_attr_name){
+               free( err_attr_name );
+               err_attr_name = NULL;
+       }
+
+       g_print("\t bret : 0x%x \n", bret);
 }
 
 
@@ -2411,32 +2015,47 @@ static void setting_menu(gchar buf)
  *
  * @return     This function returns TRUE/FALSE
  * @remark
- * @see                
+ * @see
  */
 static gboolean cmd_input(GIOChannel *channel)
 {
-       gchar buf[256];
-       gsize read;
+       gchar *buf = NULL;
+       gsize read_size;
+       GError *g_error = NULL;
 
        debug_msg_t("ENTER");
 
-       g_io_channel_read(channel, buf, CAPTURE_FILENAME_LEN, &read);
-       buf[read] = '\0';
-       g_strstrip(buf);
+       g_io_channel_read_line(channel, &buf, &read_size, NULL, &g_error);
+       if (g_error) {
+               debug_msg_t("g_io_channel_read_chars error");
+               g_error_free(g_error);
+               g_error = NULL;
+       }
 
-       debug_msg_t("Menu Status : %d", hcamcorder->menu_state);
-       switch(hcamcorder->menu_state)
-       {
-               case MENU_STATE_MAIN:
-                       main_menu(buf[0]);
-                       break;
-               case MENU_STATE_SETTING:
-                       setting_menu(buf[0]);
-                       break;
-               default:
-                       break;
+       if (buf) {
+               g_strstrip(buf);
+
+               debug_msg_t("Menu Status : %d", hcamcorder->menu_state);
+               switch(hcamcorder->menu_state)
+               {
+                       case MENU_STATE_MAIN:
+                               main_menu(buf[0]);
+                               break;
+                       case MENU_STATE_SETTING:
+                               setting_menu(buf[0]);
+                               break;
+                       default:
+                               break;
+               }
+
+               g_free(buf);
+               buf = NULL;
+
+               print_menu();
+       } else {
+               debug_msg_t("No read input");
        }
-       print_menu();
+
        return TRUE;
 }
 
@@ -2481,30 +2100,36 @@ static gboolean init(int type)
        int err;
        int size;
        int preview_format = MM_PIXEL_FORMAT_NV12;
+       int support_zero_copy_format = 0;
+       int support_media_packet_preview_cb = 0;
        MMHandleType cam_handle = 0;
-       
+
        char *err_attr_name = NULL;
 
        if (!hcamcorder)
                return FALSE;
-       
+
        if(!hcamcorder->camcorder)
                return FALSE;
 
        cam_handle = (MMHandleType)(hcamcorder->camcorder);
-       
+
        /*================================================================================
-               image mode
+               Video capture mode
        *=================================================================================*/
-       if (type == MODE_IMAGE)
-       {
+       if (type == MODE_VIDEO_CAPTURE) {
                mm_camcorder_get_attributes((MMHandleType)cam_handle, NULL,
                                            MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format,
+                                           MMCAM_SUPPORT_ZERO_COPY_FORMAT, &support_zero_copy_format,
+                                           MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &support_media_packet_preview_cb,
                                            NULL);
 
+               warn_msg_t("MMCAM_SUPPORT_ZERO_COPY_FORMAT %d", support_zero_copy_format);
+               warn_msg_t("MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB %d", support_media_packet_preview_cb);
+
                /* camcorder attribute setting */
                err = mm_camcorder_set_attributes( (MMHandleType)cam_handle, &err_attr_name,
-                                                  MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE,
+                                                  MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO_CAPTURE,
                                                   MMCAM_CAMERA_FORMAT, preview_format,
                                                   "camera-delay-attr-setting", TRUE,
                                                   MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG,
@@ -2513,80 +2138,40 @@ static gboolean init(int type)
                                                   MMCAM_TAG_LATITUDE, 35.3036944,
                                                   MMCAM_TAG_LONGITUDE, 176.67837,
                                                   MMCAM_TAG_ALTITUDE, 190.3455,
-                                                  MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
                                                   MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X,
-                                                  MMCAM_DISPLAY_RECT_X, DISPLAY_X_0,
-                                                  MMCAM_DISPLAY_RECT_Y, DISPLAY_Y_0,
-                                                  MMCAM_DISPLAY_RECT_WIDTH, 480,
-                                                  MMCAM_DISPLAY_RECT_HEIGHT, 640,
-                                                  MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
                                                   MMCAM_DISPLAY_GEOMETRY_METHOD, MM_DISPLAY_METHOD_LETTER_BOX,
                                                   MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
-                                                  "capture-thumbnail", TRUE,
+                                                  MMCAM_TAG_GPS_ENABLE, TRUE,
                                                   "tag-gps-time-stamp", 72815.5436243543,
                                                   "tag-gps-date-stamp", "2010:09:20", 10,
                                                   "tag-gps-processing-method", "GPS NETWORK HYBRID ARE ALL FINE.", 32,
-                                                  "capture-sound-enable", TRUE,
-                                                  NULL );
-
-               if (err != MM_ERROR_NONE) {
-                       warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
-                       SAFE_FREE (err_attr_name);
-                       goto ERROR;
-               }
-
-               mm_camcorder_set_video_capture_callback(hcamcorder->camcorder, (mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, hcamcorder);
-       }
-       /*================================================================================
-               video mode
-       *=================================================================================*/
-       else if (type == MODE_VIDEO)
-       {
-               mm_camcorder_get_attributes((MMHandleType)cam_handle, NULL,
-                                           MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, &preview_format,
-                                           NULL);
-
-               size = strlen(TARGET_FILENAME_VIDEO)+1;
-
-               /* camcorder attribute setting */
-               err = mm_camcorder_set_attributes( (MMHandleType)cam_handle, &err_attr_name,
-                                                  MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO,
                                                   MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
-                                                  MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR,
-                                                  MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_H264,
-                                                  MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
-                                                  MMCAM_CAMERA_FORMAT, preview_format,
+                                                  MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
+                                                  MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_MPEG4,
+                                                  MMCAM_VIDEO_ENCODER_BITRATE, VIDEO_ENCODE_BITRATE,
+                                                  MMCAM_FILE_FORMAT, MM_FILE_FORMAT_MP4,
                                                   MMCAM_CAMERA_FPS, SRC_VIDEO_FRAME_RATE_30,
                                                   MMCAM_CAMERA_FPS_AUTO, 0,
-                                                  "camera-delay-attr-setting", TRUE,
                                                   MMCAM_CAMERA_ROTATION, MM_VIDEO_INPUT_ROTATION_NONE,
-                                                  MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AMR,
+                                                  MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AAC,
                                                   MMCAM_AUDIO_FORMAT, AUDIO_SOURCE_FORMAT,
-                                                  MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AMR,
-                                                  MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL,
-                                                  MMCAM_TAG_ENABLE, 1,
-                                                  MMCAM_TAG_LATITUDE, 37.25796666,
-                                                  MMCAM_TAG_LONGITUDE, 127.05332222,
-                                                  MMCAM_TAG_ALTITUDE, 45.0000,
-                                                  MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
-                                                  MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X,
-                                                  MMCAM_DISPLAY_RECT_X, DISPLAY_X_0,
-                                                  MMCAM_DISPLAY_RECT_Y, DISPLAY_Y_0,
-                                                  MMCAM_DISPLAY_RECT_WIDTH, 480,
-                                                  MMCAM_DISPLAY_RECT_HEIGHT, 640,
-                                                  MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
-                                                  MMCAM_TARGET_FILENAME, TARGET_FILENAME_VIDEO, size,
-                                                  "capture-sound-enable", TRUE,
+                                                  MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AAC,
+                                                  //MMCAM_AUDIO_DISABLE, TRUE,
+                                                  MMCAM_TARGET_FILENAME, TARGET_FILENAME_VIDEO, strlen(TARGET_FILENAME_VIDEO),
+                                                  //MMCAM_TARGET_TIME_LIMIT, 360000,
+                                                  //MMCAM_TARGET_MAX_SIZE, 102400,
+                                                  MMCAM_RECORDER_TAG_ENABLE, 1,
+                                                  MMCAM_TAG_VIDEO_ORIENTATION, 1,
                                                   NULL );
 
                if (err != MM_ERROR_NONE) {
-                       fprintf(stderr, "video mode init fail. [%s][%x)", err_attr_name, err);
+                       warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
                        SAFE_FREE (err_attr_name);
                        goto ERROR;
                }
-//             mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder);
-       }
 
+               mm_camcorder_set_video_capture_callback(hcamcorder->camcorder, (mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, hcamcorder);
+       }
        /*================================================================================
                Audio mode
        *=================================================================================*/
@@ -2598,30 +2183,32 @@ static gboolean init(int type)
                err = mm_camcorder_set_attributes( hcamcorder->camcorder, &err_attr_name,
                                                   MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
                                                   MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
-                                                  MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR,
-                                                  MMCAM_FILE_FORMAT, MM_FILE_FORMAT_AMR,
-                                                  MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AMR,
+                                                  MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
+                                                  MMCAM_FILE_FORMAT, MM_FILE_FORMAT_MP4,
+                                                  MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AAC,
                                                   MMCAM_AUDIO_FORMAT, AUDIO_SOURCE_FORMAT,
-                                                  MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AMR,
-                                                  MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL,
+                                                  MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AAC,
                                                   MMCAM_TARGET_FILENAME, TARGET_FILENAME_AUDIO, size,
                                                   MMCAM_TARGET_TIME_LIMIT, 360000,
+                                                  MMCAM_AUDIO_ENCODER_BITRATE, 128000,
+                                                  MMCAM_TARGET_MAX_SIZE, 300,
                                                   NULL);
-       
-               if (err < 0) 
-               {
+
+               if (err < 0) {
                        warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
                        SAFE_FREE (err_attr_name);
                        goto ERROR;
                }
 
-//             mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder);
+#ifdef USE_AUDIO_STREAM_CB
+               mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder);
+#endif /* USE_AUDIO_STREAM_CB */
        }
 
        debug_msg_t("Init DONE.");
 
        return TRUE;
-       
+
 ERROR:
        err_msg_t("init failed.");
        return FALSE;
@@ -2630,7 +2217,7 @@ ERROR:
 /**
  * This function is to represent messagecallback
  *
- * @param      message [in]    Specifies the message 
+ * @param      message [in]    Specifies the message
  * @param      param   [in]    Specifies the message type
  * @param      user_param      [in]    Specifies the user poiner for passing to callback function
  * @return     This function returns TRUE/FALSE
@@ -2641,7 +2228,7 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
 {
 
        MMMessageParamType *param = (MMMessageParamType *) msg_param;
-       
+
        switch (message) {
                case MM_MESSAGE_CAMCORDER_ERROR:
                        g_print("MM_MESSAGE_ERROR : code = %x", param->code);
@@ -2655,7 +2242,7 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                                        debug_msg_t("Camcorder State is [NULL]");
                                        break;
                                case MM_CAMCORDER_STATE_READY :
-                                       mmcamcorder_state = MM_CAMCORDER_STATE_READY;                                   
+                                       mmcamcorder_state = MM_CAMCORDER_STATE_READY;
                                        debug_msg_t("Camcorder State is [READY]");
                                        break;
                                case MM_CAMCORDER_STATE_PREPARE :
@@ -2675,61 +2262,48 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                                        mmcamcorder_state = MM_CAMCORDER_STATE_PAUSED;
                                        debug_msg_t("Camcorder State is [PAUSED]");
                                        break;
+                               default:
+                                       debug_msg_t("Unknown State [%d]", g_current_state);
+                                       break;
                        }
                        break;
 
                case MM_MESSAGE_CAMCORDER_CAPTURED:
-               {
-                       if (hcamcorder->mode == MODE_IMAGE)
-                       {
-                               time_msg_t("Stillshot capture  : %12.6lf s", g_timer_elapsed(timer, NULL));     
-                               
-                               g_print("*******************************************************\n");
-                               g_print("[Camcorder Testsuite] Camcorder Stillshot Captured!!\n");
-                               g_print("*******************************************************\n");
-
-                               if (hcamcorder->isMultishot)            //multishot
-                               {
-                                       g_print("[CamcorderApp] Camcorder Captured(Capture Count=%d)\n", param->code);
-                                       
-                                       if (param->code >= multishot_num)
-                                       {
-                                               get_me_out();
-//                                             g_timeout_add (100, (GSourceFunc)get_me_out, NULL);
-//                                             hcamcorder->isMultishot = FALSE;
-                                       }
-                               }
-                               else            //singleshot
-                               {
+                       time_msg_t("Stillshot capture  : %12.6lf s", g_timer_elapsed(timer, NULL));
+                       if (hcamcorder->isMultishot) {
+                               //g_print("[CamcorderApp] Camcorder Captured(Capture Count=%d)\n", param->code);
+                               if (param->code >= multishot_num) {
                                        get_me_out();
-//                                     g_timeout_add (1000, (GSourceFunc)get_me_out, NULL);
+//                                     g_timeout_add (100, (GSourceFunc)get_me_out, NULL);
+//                                     hcamcorder->isMultishot = FALSE;
                                }
-
+                       } else {
+                               get_me_out();
+//                             g_timeout_add (1000, (GSourceFunc)get_me_out, NULL);
                        }
-                       else
-                       {
-                               MMCamRecordingReport* report ;
-                               
-                               time_msg_t("Recording commit time : %12.6lf s", g_timer_elapsed(timer, NULL));
+                       break;
+               case MM_MESSAGE_CAMCORDER_VIDEO_CAPTURED:
+               case MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED:
+               {
+                       MMCamRecordingReport* report ;
 
-                               if (param)
-                                       report = (MMCamRecordingReport*)(param->data);
-                               else
-                                       return FALSE;
+                       time_msg_t("Recording commit time : %12.6lf s", g_timer_elapsed(timer, NULL));
 
-                               if( report != NULL )
-                               {
-                                       g_print("*******************************************************\n");
-                                       g_print("[Camcorder Testsuite] Camcorder Captured(filename=%s)\n", report->recording_filename);
-                                       g_print("*******************************************************\n");
+                       if (param) {
+                               report = (MMCamRecordingReport*)(param->data);
+                       } else {
+                               return FALSE;
+                       }
 
-                                       SAFE_FREE (report->recording_filename);
-                                       SAFE_FREE (report);
-                               }
-                               else
-                               {
-                                       g_print( "[Camcorder Testsuite] report is NULL.\n" );
-                               }
+                       if (report != NULL) {
+                               g_print("*******************************************************\n");
+                               g_print("[Camcorder Testsuite] Camcorder Captured(filename=%s)\n", report->recording_filename);
+                               g_print("*******************************************************\n");
+
+                               SAFE_FREE (report->recording_filename);
+                               SAFE_FREE (report);
+                       } else {
+                               g_print( "[Camcorder Testsuite] report is NULL.\n" );
                        }
                }
                        break;
@@ -2740,29 +2314,30 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                        break;
                case MM_MESSAGE_CAMCORDER_RECORDING_STATUS:
                {
-                       unsigned int elapsed;
+                       unsigned long long elapsed;
                        elapsed = param->recording_status.elapsed / 1000;
                        if (hcamcorder->elapsed_time != elapsed) {
-                               unsigned int temp_time;
-                               int hour, minute, second;
+                               unsigned long temp_time;
+                               unsigned long long hour, minute, second;
                                hcamcorder->elapsed_time = elapsed;
                                temp_time = elapsed;
                                hour = temp_time / 3600;
                                temp_time = elapsed % 3600;
                                minute = temp_time / 60;
                                second = temp_time % 60;
-                               debug_msg_t("Current Time - %d:%d:%d", hour, minute, second);
+                               debug_msg_t("Current Time - %lld:%lld:%lld, remained %lld ms, filesize %lld KB",
+                                            hour, minute, second, param->recording_status.remained_time, param->recording_status.filesize);
                        }
                }
-                       break;                  
-               case MM_MESSAGE_CAMCORDER_MAX_SIZE:     
-               {       
+                       break;
+               case MM_MESSAGE_CAMCORDER_MAX_SIZE:
+               {
                        int err;
                        g_print("*Save Recording because receives message : MM_MESSAGE_CAMCORDER_MAX_SIZE\n");
                        g_timer_reset(timer);
                        err = mm_camcorder_commit(hcamcorder->camcorder);
 
-                       if (err < 0) 
+                       if (err < 0)
                        {
                                warn_msg_t("Save recording mm_camcorder_commit  = %x", err);
 //                                     goto ERROR;
@@ -2772,13 +2347,13 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                case MM_MESSAGE_CAMCORDER_CURRENT_VOLUME:
                        break;
                case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE:
-               {       
+               {
                        int err;
                        g_print("*Save Recording because receives message : MM_MESSAGE_CAMCORDER_NO_FREE_SPACE\n");
                        g_timer_reset(timer);
                        err = mm_camcorder_commit(hcamcorder->camcorder);
 
-                       if (err < 0) 
+                       if (err < 0)
                        {
                                warn_msg_t("Save recording mm_camcorder_commit  = %x", err);
 //                                     goto ERROR;
@@ -2790,6 +2365,29 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                        g_print( "Focus State changed. State:[%d]\n", param->code );
                }
                        break;
+               case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO:
+               {
+                       MMCamFaceDetectInfo *cam_fd_info = NULL;
+
+                       cam_fd_info = (MMCamFaceDetectInfo *)(param->data);
+
+                       if (cam_fd_info) {
+                               int i = 0;
+
+                               g_print("\tface detect num %d, pointer %p\n", cam_fd_info->num_of_faces, cam_fd_info);
+
+                               for (i = 0 ; i < cam_fd_info->num_of_faces ; i++) {
+                                       g_print("\t\t[%2d][score %d] position %d,%d %dx%d\n",
+                                               cam_fd_info->face_info[i].id,
+                                               cam_fd_info->face_info[i].score,
+                                               cam_fd_info->face_info[i].rect.x,
+                                               cam_fd_info->face_info[i].rect.y,
+                                               cam_fd_info->face_info[i].rect.width,
+                                               cam_fd_info->face_info[i].rect.height);
+                               }
+                       }
+               }
+                       break;
                default:
                        g_print("Message %x received\n", message);
                        break;
@@ -2800,16 +2398,16 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
 
 static gboolean init_handle()
 {
-       hcamcorder->mode = MODE_IMAGE;                                           /* image(capture)/video(recording) mode */
+       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->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->menu_state = MENU_STATE_MAIN;
-       hcamcorder->isMute = FALSE;     
+       hcamcorder->isMute = FALSE;
        hcamcorder->elapsed_time = 0;
-       hcamcorder->fps = SRC_VIDEO_FRAME_RATE_15; //SRC_VIDEO_FRAME_RATE_30;
+       hcamcorder->fps = SRC_VIDEO_FRAME_RATE_15; /*SRC_VIDEO_FRAME_RATE_30;*/
        multishot_num = IMAGE_CAPTURE_COUNT_MULTI;
 
        return TRUE;
@@ -2826,8 +2424,12 @@ static gboolean init_handle()
 static gboolean mode_change()
 {
        int err = MM_ERROR_NONE;
-       int state;
+       int state = MM_CAMCORDER_STATE_NONE;
+       int name_size = 0;
+       int device_count = 0;
+       int facing_direction = 0;
        char media_type = '\0';
+       char *evassink_name = NULL;
        bool check= FALSE;
 
        debug_msg_t("MMCamcorder State : %d", mmcamcorder_state);
@@ -2841,7 +2443,7 @@ static gboolean mode_change()
                        debug_msg_t("mm_camcorder_cancel");
                        err = mm_camcorder_cancel(hcamcorder->camcorder);
 
-                       if (err < 0) 
+                       if (err < 0)
                        {
                                warn_msg_t("exit mm_camcorder_cancel  = %x", err);
                                return FALSE;
@@ -2852,7 +2454,7 @@ static gboolean mode_change()
                        debug_msg_t("mm_camcorder_capture_stop");
                        err = mm_camcorder_capture_stop(hcamcorder->camcorder);
 
-                       if (err < 0) 
+                       if (err < 0)
                        {
                                warn_msg_t("exit mmcamcorder_capture_stop  = %x", err);
                                return FALSE;
@@ -2865,81 +2467,73 @@ static gboolean mode_change()
                        debug_msg_t("mm_camcorder_stop");
                        mm_camcorder_stop(hcamcorder->camcorder);
                }
-               
+
                err = mm_camcorder_get_state(hcamcorder->camcorder, (MMCamcorderStateType *)&state);
                if(state == MM_CAMCORDER_STATE_READY)
                {
                        debug_msg_t("mm_camcorder_unrealize");
                        mm_camcorder_unrealize(hcamcorder->camcorder);
                }
-               
+
                err = mm_camcorder_get_state(hcamcorder->camcorder, (MMCamcorderStateType *)&state);
                if(state == MM_CAMCORDER_STATE_NULL)
-               {       
+               {
                        debug_msg_t("mm_camcorder_destroy");
                        mm_camcorder_destroy(hcamcorder->camcorder);
 
                        mmcamcorder_state = MM_CAMCORDER_STATE_NONE;
                }
        }
-       
+
        init_handle();
        mmcamcorder_print_state = MM_CAMCORDER_STATE_PREPARE;
        while(!check) {
                g_print("\n\t=======================================\n");
                g_print("\t   MM_CAMCORDER_TESTSUIT\n");
                g_print("\t=======================================\n");
-               g_print("\t   '1' Image Capture - Front Camera\n");
-               g_print("\t   '2' Image Capture - Rear Camera\n");
-               g_print("\t   '3' Video Recording - Front Camera\n");
-               g_print("\t   '4' Video Recording - Rear Camera\n");
-               g_print("\t   '5' Audio Recording\n");
+               g_print("\t   '1' Video Capture - Front Camera\n");
+               g_print("\t   '2' Video Capture - Rear Camera\n");
+               g_print("\t   '3' Audio Recording\n");
                g_print("\t   'q' Exit\n");
                g_print("\t=======================================\n");
 
-               g_print("\t  Enter the media type:\n\t");       
+               g_print("\t  Enter the media type:\n\t");
 
-               while ((media_type=getchar()) == '\n');
-               
-               switch(media_type) {
-                       case '1':
-                               hcamcorder->mode= MODE_IMAGE;
-                               cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA1;
-                               check = TRUE;
-                               break;
-                       case '2':
-                               hcamcorder->mode= MODE_IMAGE;
-                               cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
-                               check = TRUE;
-                               break;
-                       case '3':
-                               hcamcorder->mode= MODE_VIDEO;
-                               cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA1;
-                               check = TRUE;
-                               break;
-                       case '4':
-                               hcamcorder->mode= MODE_VIDEO;
-                               cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
-                               check = TRUE;
-                               break;
-                       case '5':
-                               hcamcorder->mode= MODE_AUDIO;
-                               cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
-                               check = TRUE;
-                               break;
-                       case 'q':
-                               g_print("\t Quit Camcorder Testsuite!!\n");
-                               hcamcorder->mode = -1;
-                               if(g_main_loop_is_running(g_loop)) {
-                                       g_main_loop_quit(g_loop);
-                               }
-                               return FALSE;
-                       default:
-                               g_print("\t Invalid media type(%d)\n", media_type);
-                               continue;
+               err = scanf("%c", &media_type);
+               if (err == EOF) {
+                       g_print("\t!!!read input error!!!\n");
+                       continue;
+               }
+
+               switch (media_type) {
+               case '1':
+                       hcamcorder->mode= MODE_VIDEO_CAPTURE;
+                       cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA1;
+                       check = TRUE;
+                       break;
+               case '2':
+                       hcamcorder->mode= MODE_VIDEO_CAPTURE;
+                       cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
+                       check = TRUE;
+                       break;
+               case '3':
+                       hcamcorder->mode= MODE_AUDIO;
+                       cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
+                       check = TRUE;
+                       break;
+               case 'q':
+                       g_print("\t Quit Camcorder Testsuite!!\n");
+                       hcamcorder->mode = -1;
+                       if(g_main_loop_is_running(g_loop)) {
+                               g_main_loop_quit(g_loop);
+                       }
+                       return FALSE;
+               default:
+                       g_print("\t Invalid media type(%d)\n", media_type);
+                       continue;
                }
        }
-       
+
        debug_msg_t("mm_camcorder_create");
        g_get_current_time(&previous);
        g_timer_reset(timer);
@@ -2954,6 +2548,15 @@ static gboolean mode_change()
                mmcamcorder_state = MM_CAMCORDER_STATE_NULL;
        }
 
+       /* get evassink name */
+       mm_camcorder_get_attributes(hcamcorder->camcorder, NULL,
+                                   MMCAM_DISPLAY_EVAS_SURFACE_SINK, &evassink_name, &name_size,
+                                   MMCAM_CAMERA_DEVICE_COUNT, &device_count,
+                                   MMCAM_CAMERA_FACING_DIRECTION, &facing_direction,
+                                   NULL);
+       debug_msg_t("evassink name[%s], device count[%d], facing direction[%d]",
+                   evassink_name, device_count, facing_direction);
+
        mm_camcorder_set_message_callback(hcamcorder->camcorder, (MMMessageCallback)msg_callback, hcamcorder);
 
        if (!init(hcamcorder->mode)) {
@@ -2985,7 +2588,7 @@ static gboolean mode_change()
                return -1;
        }
 
-       g_get_current_time(&current);
+       g_get_current_time(&current);
        timersub(&current, &previous, &result);
        time_msg_t("Camera Starting Time  : %ld.%lds", result.tv_sec, result.tv_usec);
 
@@ -2996,7 +2599,7 @@ static gboolean mode_change()
 /**
  * This function is the example main function for mmcamcorder API.
  *
- * @param      
+ * @param
  *
  * @return     This function returns 0.
  * @remark
@@ -3006,9 +2609,6 @@ int main(int argc, char **argv)
 {
        int bret;
 
-       if (!g_thread_supported())
-               g_thread_init (NULL);
-
        timer = g_timer_new();
 
        gst_init(&argc, &argv);