1. Seperate preview pipeline and encoding pipeline 38/33638/4 accepted/tizen/common/20150115.180940 accepted/tizen/mobile/20150119.023401 accepted/tizen/tv/20150116.010653 accepted/tizen/wearable/20150116.010320 submit/tizen/20150115.085052 submit/tizen_mobile/20150119.020413
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 13 Jan 2015 11:11:07 +0000 (20:11 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 15 Jan 2015 03:28:21 +0000 (12:28 +0900)
2. Remove async command related code
3. Add new attributes and remove unsed attributes
4. Remove ASM related code
5. Remove unused sound file
6. Fix build error on x64 build

Change-Id: I08befc1955535985e3e549d4c28eae0df53b6409
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
33 files changed:
configure.ac
mm-camcorder.pc.in
packaging/libmm-camcorder.spec
sounds/af_fail.wav [deleted file]
sounds/af_succeed.wav [deleted file]
sounds/no_sound.wav [deleted file]
src/Makefile.am
src/include/mm_camcorder.h
src/include/mm_camcorder_attribute.h
src/include/mm_camcorder_configure.h
src/include/mm_camcorder_exifinfo.h
src/include/mm_camcorder_gstcommon.h
src/include/mm_camcorder_internal.h
src/include/mm_camcorder_platform.h
src/include/mm_camcorder_sound.h
src/include/mm_camcorder_stillshot.h
src/include/mm_camcorder_util.h
src/include/mm_camcorder_videorec.h
src/mm_camcorder.c
src/mm_camcorder_attribute.c
src/mm_camcorder_audiorec.c
src/mm_camcorder_configure.c
src/mm_camcorder_exifinfo.c
src/mm_camcorder_gstcommon.c
src/mm_camcorder_internal.c
src/mm_camcorder_platform.c
src/mm_camcorder_sound.c
src/mm_camcorder_stillshot.c
src/mm_camcorder_util.c
src/mm_camcorder_videorec.c
symbols [deleted file]
test/Makefile.am
test/mm_camcorder_testsuite.c

index ac59835..24b79a2 100644 (file)
@@ -35,9 +35,9 @@ PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-1.0 >= 1.2.0)
 AC_SUBST(GST_VIDEO_CFLAGS)
 AC_SUBST(GST_VIDEO_LIBS)
 
-#PKG_CHECK_MODULES(GTK, gtk+-2.0)
-#AC_SUBST(GTK_CFLAGS)
-#AC_SUBST(GTK_LIBS)
+PKG_CHECK_MODULES(GST_APP, gstreamer-app-1.0 >= 1.2.0)
+AC_SUBST(GST_APP_CFLAGS)
+AC_SUBST(GST_APP_LIBS)
 
 PKG_CHECK_MODULES(MM_COMMON, mm-common)
 AC_SUBST(MM_COMMON_CFLAGS)
@@ -47,22 +47,10 @@ PKG_CHECK_MODULES(MM_LOG, mm-log)
 AC_SUBST(MM_LOG_CFLAGS)
 AC_SUBST(MM_LOG_LIBS)
 
-PKG_CHECK_MODULES(MMTA, mm-ta)
-AC_SUBST(MMTA_CFLAGS)
-AC_SUBST(MMTA_LIBS)
-
 PKG_CHECK_MODULES(MM_SOUND, mm-sound)
 AC_SUBST(MM_SOUND_CFLAGS)
 AC_SUBST(MM_SOUND_LIBS)
 
-PKG_CHECK_MODULES(AVSYSTEM, avsysaudio)
-AC_SUBST(AVSYSTEM_CFLAGS)
-AC_SUBST(AVSYSTEM_LIBS)
-
-#PKG_CHECK_MODULES(INIPARSER, iniparser)
-#AC_SUBST(INIPARSER_CFLAGS)
-#AC_SUBST(INIPARSER_LIBS)
-
 PKG_CHECK_MODULES(EXIF, libexif)
 AC_SUBST(EXIF_CFLAGS)
 AC_SUBST(EXIF_LIBS)
@@ -71,14 +59,6 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-PKG_CHECK_MODULES(MMSESSION, mm-session)
-AC_SUBST(MMSESSION_CFLAGS)
-AC_SUBST(MMSESSION_LIBS)
-
-PKG_CHECK_MODULES(AUDIOSESSIONMGR, audio-session-mgr)
-AC_SUBST(AUDIOSESSIONMGR_CFLAGS)
-AC_SUBST(AUDIOSESSIONMGR_LIBS)
-
 PKG_CHECK_MODULES(MMSOUND, mm-sound)
 AC_SUBST(MMSOUND_CFLAGS)
 AC_SUBST(MMSOUND_LIBS)
@@ -99,6 +79,10 @@ PKG_CHECK_MODULES(VCONF, vconf)
 AC_SUBST(VCONF_CFLAGS)
 AC_SUBST(VCONF_LIBS)
 
+PKG_CHECK_MODULES(SYSTEMINFO, capi-system-info)
+AC_SUBST(SYSTEMINFO_CFLAGS)
+AC_SUBST(SYSTEMINFO_LIBS)
+
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h])
index 5300a65..eb5870c 100644 (file)
@@ -5,7 +5,7 @@ includedir=@includedir@
 
 Name: mm-camcorder
 Description: Multimedia Framework Camcorder Library
-Requires: gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0 mm-common mm-log libexif mm-ta
-Version: @VERSION@
-Libs: -L${libdir} -lmmfcamcorder 
+Requires: gstreamer-1.0 gstreamer-base-1.0 mm-common mm-log libexif
+Version: $VERSION
+Libs: -L${libdir} -lmmfcamcorder
 Cflags: -I${includedir}/ -I${includedir}/mmf
index c6452c2..4fa8ebf 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.7.16
+Version:    0.9.0
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -8,20 +8,19 @@ Source0:    %{name}-%{version}.tar.gz
 Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
+BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(mm-common)
 BuildRequires:  pkgconfig(mm-sound)
-BuildRequires:  pkgconfig(avsystem)
 BuildRequires:  pkgconfig(libexif)
 BuildRequires:  pkgconfig(mmutil-imgp)
 BuildRequires:  pkgconfig(mm-log)
-BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
-BuildRequires:  pkgconfig(mm-ta)
+BuildRequires:  pkgconfig(gstreamer-base-1.0)
 BuildRequires:  pkgconfig(sndfile)
-BuildRequires:  pkgconfig(mm-session)
-BuildRequires:  pkgconfig(audio-session-mgr)
 BuildRequires:  pkgconfig(camsrcjpegenc)
 BuildRequires:  pkgconfig(libpulse)
 BuildRequires:  pkgconfig(vconf)
+BuildRequires:  gst-plugins-base-devel
+BuildRequires:  gstreamer-devel
 
 %description
 Camera and recorder library.
@@ -33,16 +32,15 @@ Group:      libdevel
 Version:    %{version}
 Requires:   %{name} = %{version}-%{release}
 
-%description devel 
+%description devel
 Camera and recorder development library.
 
 
 %prep
-%setup -q 
+%setup -q
 
 
 %build
-export CFLAGS+=" -DGST_EXT_TIME_ANALYSIS"
 ./autogen.sh
 %configure --disable-static
 make %{?jobs:-j%jobs}
@@ -70,7 +68,6 @@ vconftool set -t int file/camera/shutter_sound_policy 0 -u 5000
 %{_datadir}/license/%{name}
 
 %files devel
-%manifest libmm-camcorder.manifest
 %defattr(-,root,root,-)
 %{_includedir}/mmf/mm_camcorder.h
 %{_libdir}/pkgconfig/mm-camcorder.pc
diff --git a/sounds/af_fail.wav b/sounds/af_fail.wav
deleted file mode 100644 (file)
index ab94bcc..0000000
Binary files a/sounds/af_fail.wav and /dev/null differ
diff --git a/sounds/af_succeed.wav b/sounds/af_succeed.wav
deleted file mode 100644 (file)
index 0618933..0000000
Binary files a/sounds/af_succeed.wav and /dev/null differ
diff --git a/sounds/no_sound.wav b/sounds/no_sound.wav
deleted file mode 100644 (file)
index 61fb691..0000000
Binary files a/sounds/no_sound.wav and /dev/null differ
index aa9e918..740e536 100644 (file)
@@ -35,41 +35,37 @@ libmmfcamcorder_la_SOURCES = mm_camcorder.c \
 libmmfcamcorder_la_CFLAGS = -I$(srcdir)/include \
                             $(GST_CFLAGS) \
                             $(GST_PLUGIN_BASE_CFLAGS) \
-                             $(GST_VIDEO_CFLAGS) \
+                            $(GST_VIDEO_CFLAGS) \
+                            $(GST_APP_CFLAGS) \
                             $(MM_LOG_CFLAGS) \
-                            $(MMTA_CFLAGS) \
                             $(EXIF_CFLAGS) \
                             $(MM_COMMON_CFLAGS) \
-                            $(MMSESSION_CFLAGS) \
                             $(MMSOUND_CFLAGS) \
-                            $(AVSYSTEM_CFLAGS) \
                             $(SNDFILE_CFLAGS) \
                             $(CAMSRCJPEGENC_CFLAGS) \
                             $(VCONF_CFLAGS) \
                             $(MMUTIL_IMGP_CFLAGS) \
-                            $(AUDIOSESSIONMGR_CFLAGS)
+                            $(SYSTEMINFO_CFLAGS)
 
 libmmfcamcorder_la_LIBADD = \
                            $(GST_LIBS) \
                            $(GST_PLUGIN_BASE_LIBS) \
-                            $(GST_VIDEO_LIBS) \
+                           $(GST_VIDEO_LIBS) \
+                           $(GST_APP_LIBS) \
                            $(MM_COMMON_LIBS) \
                            $(MM_LOG_LIBS) \
-                           $(MMTA_LIBS) \
                            $(EXIF_LIBS) \
-                           $(MMSESSION_LIBS) \
                            $(MMSOUND_LIBS) \
-                           $(AVSYSTEM_LIBS) \
                            $(SNDFILE_LIBS) \
                            $(CAMSRCJPEGENC_LIBS) \
                            $(VCONF_LIBS) \
-                           $(MMUTIL_IMGP_LIBS) \
-                           $(AUDIOSESSIONMGR_LIBS)
+                           $(MMUTIL_IMGP_LIBS)
 
-libmmfcamcorder_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x010 -DMMF_DEBUG_PREFIX=\"MMF-CAMCORDER\" -D_INTERNAL_SESSION_MANAGER_
-libmmfcamcorder_la_LIBADD += $(MMLOGSVR_LIBS)
+libmmfcamcorder_la_CFLAGS += -DMMF_LOG_OWNER=0x010 -D_FILE_OFFSET_BITS=64
+libmmfcamcorder_la_CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections
+libmmfcamcorder_la_LIBADD += $(SYSTEMINFO_LIBS)
 
 install-exec-hook:
                                        mkdir -p $(DESTDIR)$(prefix)/share/sounds/mm-camcorder && \
-                                       cp $(srcdir)/../sounds/*.wav $(DESTDIR)$(prefix)/share/sounds/mm-camcorder/
+                                       cp $(srcdir)/../sounds/* $(DESTDIR)$(prefix)/share/sounds/mm-camcorder/
 
index 6eb962b..1d4b4c3 100644 (file)
@@ -727,22 +727,31 @@ extern "C" {
 
 /**
  * Frames per second. This is an integer field
- * 
+ *
  */
 #define MMCAM_CAMERA_FPS                        "camera-fps"
 
 /**
- * Width of input video stream.
+ * Width of preview stream.
  */
 #define MMCAM_CAMERA_WIDTH                      "camera-width"
 
 /**
- * Height of input video stream.
- * @see                
+ * Height of preview stream.
  */
 #define MMCAM_CAMERA_HEIGHT                     "camera-height"
 
 /**
+ * Width of video stream.
+ */
+#define MMCAM_VIDEO_WIDTH                       "video-width"
+
+/**
+ * Height of video stream.
+ */
+#define MMCAM_VIDEO_HEIGHT                      "video-height"
+
+/**
  * Digital zoom level.
  */
 #define MMCAM_CAMERA_DIGITAL_ZOOM               "camera-digital-zoom"
@@ -1199,25 +1208,19 @@ extern "C" {
 #define MMCAM_CAMERA_FLIP                              "camera-flip"
 
 /**
- * X coordinate of Face zoom.
+ * Support Zero Shutter Lag capture
  */
-#define MMCAM_CAMERA_FACE_ZOOM_X                      "camera-face-zoom-x"
+#define MMCAM_SUPPORT_ZSL_CAPTURE                   "support-zsl-capture"
 
 /**
- * Y coordinate of Face zoom.
- */
-#define MMCAM_CAMERA_FACE_ZOOM_Y                      "camera-face-zoom-y"
+* Support zero copy format
+*/
+#define MMCAM_SUPPORT_ZERO_COPY_FORMAT              "support-zero-copy-format"
 
 /**
- * Zoom level of Face zoom.
- */
-#define MMCAM_CAMERA_FACE_ZOOM_LEVEL                  "camera-face-zoom-level"
-
-/**
- * Mode of Face zoom.
- * @see                MMCamcorderFaceZoomMode
- */
-#define MMCAM_CAMERA_FACE_ZOOM_MODE                   "camera-face-zoom-mode"
+* Support media packet callback
+*/
+#define MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB              "support-media-packet-preview-cb"
 
 
 /*=======================================================================================
@@ -1304,10 +1307,10 @@ enum MMCamcorderColorToneType {
 
 /**
  * An enumeration for white balance. White Balance is the control that adjusts
- * the camcorder's color sensitivity to match the prevailing color of white 
- * outdoor light, yellower indoor light, or (sometimes) greenish fluorescent 
- * light. White balance may be set either automatically or manually. White balance 
- * may be set "incorrectly" on purpose to achieve special effects. 
+ * the camcorder's color sensitivity to match the prevailing color of white
+ * outdoor light, yellower indoor light, or (sometimes) greenish fluorescent
+ * light. White balance may be set either automatically or manually. White balance
+ * may be set "incorrectly" on purpose to achieve special effects.
  */
 enum MMCamcorderWhiteBalanceType {
        MM_CAMCORDER_WHITE_BALANCE_NONE = 0,            /**< None */
@@ -1320,13 +1323,12 @@ enum MMCamcorderWhiteBalanceType {
        MM_CAMCORDER_WHITE_BALANCE_HORIZON,             /**< Horizon */
        MM_CAMCORDER_WHITE_BALANCE_FLASH,               /**< Flash */
        MM_CAMCORDER_WHITE_BALANCE_CUSTOM,              /**< Custom */
-       
 };
 
 
 /**
  * An enumeration for scene mode. Scene mode gives the environment condition
- * for operating camcorder. The mode of operation can be in daylight, night and 
+ * for operating camcorder. The mode of operation can be in daylight, night and
  * backlight. It can be an automatic setting also.
  */
 enum MMCamcorderSceneModeType {
@@ -1345,6 +1347,7 @@ enum MMCamcorderSceneModeType {
        MM_CAMCORDER_SCENE_MODE_SHOW_WINDOW,    /**< Show window */
        MM_CAMCORDER_SCENE_MODE_CANDLE_LIGHT,   /**< Candle light */
        MM_CAMCORDER_SCENE_MODE_BACKLIGHT,      /**< Backlight */
+       MM_CAMCORDER_SCENE_MODE_AQUA,           /**< Aqua */
 };
 
 
@@ -1353,8 +1356,8 @@ enum MMCamcorderSceneModeType {
  */
 enum MMCamcorderFocusMode {
        MM_CAMCORDER_FOCUS_MODE_NONE = 0,       /**< Focus mode is None */
-       MM_CAMCORDER_FOCUS_MODE_PAN,            /**< Pan focus mode*/   
-       MM_CAMCORDER_FOCUS_MODE_AUTO,           /**< Autofocus mode*/   
+       MM_CAMCORDER_FOCUS_MODE_PAN,            /**< Pan focus mode*/
+       MM_CAMCORDER_FOCUS_MODE_AUTO,           /**< Autofocus mode*/
        MM_CAMCORDER_FOCUS_MODE_MANUAL,         /**< Manual focus mode*/
        MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO,     /**< Touch Autofocus mode*/
        MM_CAMCORDER_FOCUS_MODE_CONTINUOUS,     /**< Continuous Autofocus mode*/
@@ -1532,19 +1535,12 @@ enum MMCamcorderDetectMode {
 
 
 /**
- * An enumeration for Face zoom mode.
- */
-enum MMCamcorderFaceZoomMode {
-       MM_CAMCORDER_FACE_ZOOM_MODE_OFF = 0,    /**< turn face zoom off */
-       MM_CAMCORDER_FACE_ZOOM_MODE_ON,         /**< turn face zoom on */
-};
-
-/**
  * An enumeration for recommended preview resolution.
  */
 enum MMCamcorderPreviewType {
        MM_CAMCORDER_PREVIEW_TYPE_NORMAL = 0,   /**< normal ratio like 4:3 */
        MM_CAMCORDER_PREVIEW_TYPE_WIDE,         /**< wide ratio like 16:9 */
+       MM_CAMCORDER_PREVIEW_TYPE_SQUARE,       /**< square ratio like 1:1 */
 };
 
 
@@ -1676,6 +1672,8 @@ typedef struct {
 /**
  * Structure for video stream data.
  */
+#define BUFFER_MAX_PLANE_NUM 4
+
 typedef struct {
        union {
                struct {
@@ -1704,6 +1702,8 @@ typedef struct {
        int width;                      /**< width of video buffer */
        int height;                     /**< height of video buffer */
        unsigned int timestamp;         /**< timestamp of stream buffer (msec)*/
+       void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
+       void *internal_buffer;          /**< Internal buffer pointer */
 } MMCamcorderVideoStreamDataType;
 
 
index 406dece..8f96aeb 100644 (file)
@@ -25,6 +25,7 @@
 /*=======================================================================================
 | INCLUDE FILES                                                                                |
 ========================================================================================*/
+#include <gst/gst.h>
 #include <mm_types.h>
 #include <stdarg.h>
 
@@ -93,10 +94,9 @@ typedef enum
        MM_CAM_CAMERA_WDR,
        MM_CAM_CAMERA_ANTI_HANDSHAKE,
        MM_CAM_CAMERA_FPS_AUTO,
-       MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING,
        MM_CAM_CAMERA_DELAY_ATTR_SETTING,
-       MM_CAM_AUDIO_ENCODER_BITRATE,                   /* 40 */
-       MM_CAM_VIDEO_ENCODER_BITRATE,
+       MM_CAM_AUDIO_ENCODER_BITRATE,
+       MM_CAM_VIDEO_ENCODER_BITRATE,                   /* 40 */
        MM_CAM_IMAGE_ENCODER_QUALITY,
        MM_CAM_CAPTURE_FORMAT,
        MM_CAM_CAPTURE_WIDTH,
@@ -105,8 +105,8 @@ typedef enum
        MM_CAM_CAPTURE_INTERVAL,
        MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
        MM_CAM_DISPLAY_HANDLE,
-       MM_CAM_DISPLAY_DEVICE,                          /* 50 */
-       MM_CAM_DISPLAY_SURFACE,
+       MM_CAM_DISPLAY_DEVICE,
+       MM_CAM_DISPLAY_SURFACE,                         /* 50 */
        MM_CAM_DISPLAY_RECT_X,
        MM_CAM_DISPLAY_RECT_Y,
        MM_CAM_DISPLAY_RECT_WIDTH,
@@ -115,8 +115,8 @@ typedef enum
        MM_CAM_DISPLAY_SOURCE_Y,
        MM_CAM_DISPLAY_SOURCE_WIDTH,
        MM_CAM_DISPLAY_SOURCE_HEIGHT,
-       MM_CAM_DISPLAY_ROTATION,                        /* 60 */
-       MM_CAM_DISPLAY_VISIBLE,
+       MM_CAM_DISPLAY_ROTATION,
+       MM_CAM_DISPLAY_VISIBLE,                         /* 60 */
        MM_CAM_DISPLAY_SCALE,
        MM_CAM_DISPLAY_GEOMETRY_METHOD,
        MM_CAM_TARGET_FILENAME,
@@ -125,8 +125,8 @@ typedef enum
        MM_CAM_TAG_ENABLE,
        MM_CAM_TAG_IMAGE_DESCRIPTION,
        MM_CAM_TAG_ORIENTATION,
-       MM_CAM_TAG_SOFTWARE,                            /* 70 */
-       MM_CAM_TAG_LATITUDE,
+       MM_CAM_TAG_SOFTWARE,
+       MM_CAM_TAG_LATITUDE,                            /* 70 */
        MM_CAM_TAG_LONGITUDE,
        MM_CAM_TAG_ALTITUDE,
        MM_CAM_STROBE_CONTROL,
@@ -135,8 +135,8 @@ typedef enum
        MM_CAM_DETECT_MODE,
        MM_CAM_DETECT_NUMBER,
        MM_CAM_DETECT_FOCUS_SELECT,
-       MM_CAM_DETECT_SELECT_NUMBER,                    /* 80 */
-       MM_CAM_DETECT_STATUS,
+       MM_CAM_DETECT_SELECT_NUMBER,
+       MM_CAM_DETECT_STATUS,                           /* 80 */
        MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
        MM_CAM_CAMERA_AF_TOUCH_X,
        MM_CAM_CAMERA_AF_TOUCH_Y,
@@ -145,34 +145,33 @@ typedef enum
        MM_CAM_CAMERA_FOCAL_LENGTH,
        MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
        MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
-       MM_CAM_CAPTURE_THUMBNAIL,                       /* 90 */
        MM_CAM_TAG_GPS_ENABLE,
-       MM_CAM_TAG_GPS_TIME_STAMP,
+       MM_CAM_TAG_GPS_TIME_STAMP,                      /* 90 */
        MM_CAM_TAG_GPS_DATE_STAMP,
        MM_CAM_TAG_GPS_PROCESSING_METHOD,
        MM_CAM_CAMERA_ROTATION,
-       MM_CAM_ENABLE_CONVERTED_STREAM_CALLBACK,
        MM_CAM_CAPTURED_SCREENNAIL,
        MM_CAM_CAPTURE_SOUND_ENABLE,
        MM_CAM_RECOMMEND_DISPLAY_ROTATION,
-       MM_CAM_CAMERA_FLIP,                             /* 100 */
+       MM_CAM_CAMERA_FLIP,
        MM_CAM_CAMERA_HDR_CAPTURE,
        MM_CAM_DISPLAY_MODE,
-       MM_CAM_CAMERA_FACE_ZOOM_X,
-       MM_CAM_CAMERA_FACE_ZOOM_Y,
-       MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
-       MM_CAM_CAMERA_FACE_ZOOM_MODE,
-       MM_CAM_AUDIO_DISABLE,
+       MM_CAM_AUDIO_DISABLE,                   /* 100 */
        MM_CAM_RECOMMEND_CAMERA_WIDTH,
        MM_CAM_RECOMMEND_CAMERA_HEIGHT,
-       MM_CAM_CAPTURED_EXIF_RAW_DATA,                  /* 110 */
+       MM_CAM_CAPTURED_EXIF_RAW_DATA,
        MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
        MM_CAM_DISPLAY_EVAS_DO_SCALING,
        MM_CAM_CAMERA_FACING_DIRECTION,
        MM_CAM_DISPLAY_FLIP,
        MM_CAM_CAMERA_VIDEO_STABILIZATION,
        MM_CAM_TAG_VIDEO_ORIENTATION,
-       MM_CAM_NUM
+       MM_CAM_VIDEO_WIDTH,                     /* 110 */
+       MM_CAM_VIDEO_HEIGHT,
+       MM_CAM_SUPPORT_ZSL_CAPTURE,
+       MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+       MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
+       MM_CAM_ATTRIBUTE_NUM
 }MMCamcorderAttrsID;
 
 /*=======================================================================================
@@ -185,7 +184,7 @@ typedef bool (*mmf_cam_commit_func_t)(MMHandleType handle, int attr_idx, const m
 ========================================================================================*/
 typedef struct {
        MMCamcorderAttrsID attrid;
-       char *name;
+       const char *name;
        int value_type;
        int flags;
        union {
@@ -195,8 +194,17 @@ typedef struct {
                double value_double;
        } default_value;              /* default value */
        MMCamAttrsValidType validity_type;
-       int validity_value1;    /* can be int min, int *array, double *array, or cast to double min. */
-       int validity_value2;    /* can be int max, int count, int count, or cast to double max. */
+       union {
+               int *int_array;
+               int int_min;
+               double *double_array;
+               double double_min;
+       } validity_value_1;
+       union {
+               int int_max;
+               double double_max;
+               int count;
+       } validity_value_2;
        mmf_cam_commit_func_t attr_commit;
 } mm_cam_attr_construct_info;
 
@@ -230,13 +238,14 @@ MMHandleType _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info
 /**
  * This function release structure of attributes.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  attrs           Handle of camcorder attribute.
  * @return     void
  * @remarks
  * @see                _mmcamcorder_alloc_attribute()
  *
  */
-void _mmcamcorder_dealloc_attribute(MMHandleType attrs);
+void _mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs);
 
 /**
  * This is a meta  function to get attributes of camcorder with given attribute names.
@@ -325,6 +334,7 @@ bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const mmf
 bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, const mmf_value_t *value);
@@ -333,9 +343,7 @@ bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx,
 bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int attr_idx, const mmf_value_t *value);
-bool _mmcamcorder_commit_camera_hold_af_after_capturing(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
-bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value);
 bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const mmf_value_t *value);
index 5f2abf3..afb0581 100644 (file)
@@ -85,6 +85,12 @@ enum ConfigureCategoryCtrl {
 ========================================================================================*/
 typedef struct _type_int type_int;
 struct _type_int {
+       const char *name;
+       int value;
+};
+
+typedef struct _type_int2 type_int2;
+struct _type_int2 {
        char *name;
        int value;
 };
@@ -115,6 +121,12 @@ struct _type_int_pair_array {
 
 typedef struct _type_string type_string;
 struct _type_string {
+       const char *name;
+       const char *value;
+};
+
+typedef struct _type_string2 type_string2;
+struct _type_string2 {
        char *name;
        char *value;
 };
@@ -129,35 +141,45 @@ struct _type_string_array {
 
 typedef struct _type_element type_element;
 struct _type_element {
-       char *name;
-       char *element_name;
+       const char *name;
+       const char *element_name;
        type_int **value_int;
        int count_int;
        type_string **value_string;
        int count_string;
 };
 
-typedef struct _conf_info conf_info;
-struct _conf_info {
+typedef struct _type_element2 type_element2;
+struct _type_element2 {
+       char *name;
+       char *element_name;
+       type_int2 **value_int;
+       int count_int;
+       type_string2 **value_string;
+       int count_string;
+};
+
+typedef struct _conf_detail conf_detail;
+struct _conf_detail {
        int count;
        void **detail_info;
 };
 
 typedef struct _conf_info_table conf_info_table;
 struct _conf_info_table {
-       char *name;
+       const char *name;
        int value_type;
        union {
+               type_element *value_element;
                int value_int;
                char *value_string;
-               type_element *value_element;
        };
 };
 
 typedef struct _camera_conf camera_conf;
 struct _camera_conf {
        int type;
-       conf_info **info;
+       conf_detail **info;
 };
 
 /*=======================================================================================
@@ -167,6 +189,7 @@ struct _camera_conf {
 /**
  * This function creates configure info structure from ini file.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  type            configure type(MAIN or CTRL).
  * @param[in]  ConfFile        ini file path.
  * @param[out] configure_info  configure structure to be got.
@@ -175,22 +198,24 @@ struct _camera_conf {
  * @see                _mmcamcorder_conf_release_info()
  *
  */
-int _mmcamcorder_conf_get_info(int type, char *ConfFile, camera_conf **configure_info);
+int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info);
 
 /**
  * This function releases configure info.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  configure_info  configure structure to be released.
  * @return     void
  * @remarks
  * @see                _mmcamcorder_conf_get_info()
  *
  */
-void _mmcamcorder_conf_release_info(camera_conf **configure_info);
+void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info);
 
 /**
  * This function gets integer type value from configure info.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  configure_info  configure structure created by _mmcamcorder_conf_get_info.
  * @param[in]  category        configure category.
  * @param[in]  name            detail name in category.
@@ -200,7 +225,7 @@ void _mmcamcorder_conf_release_info(camera_conf **configure_info);
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_int(camera_conf *configure_info, int category, char *name, int *value);
+int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf *configure_info, int category, const char *name, int *value);
 
 /**
  * This function gets integer-range type value from configure info.
@@ -214,7 +239,7 @@ int _mmcamcorder_conf_get_value_int(camera_conf *configure_info, int category, c
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, char *name, type_int_range **value);
+int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, const char *name, type_int_range **value);
 
 /**
  * This function gets integer-array type value from configure info.
@@ -228,7 +253,7 @@ int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int categ
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, char *name, type_int_array **value);
+int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, const char *name, type_int_array **value);
 
 /**
  * This function gets integer-pair-array type value from configure info.
@@ -242,11 +267,12 @@ int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int categ
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, char *name, type_int_pair_array **value);
+int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, const char *name, type_int_pair_array **value);
 
 /**
  * This function gets string type value from configure info.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  configure_info  configure structure created by _mmcamcorder_conf_get_info.
  * @param[in]  category        configure category.
  * @param[in]  name            detail name in category.
@@ -256,7 +282,7 @@ int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_string(camera_conf *configure_info, int category, char *name, char **value);
+int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf *configure_info, int category, const char *name, const char **value);
 
 /**
  * This function gets string-array type value from configure info.
@@ -270,11 +296,12 @@ int _mmcamcorder_conf_get_value_string(camera_conf *configure_info, int category
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, char *name, type_string_array **value);
+int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, const char *name, type_string_array **value);
 
 /**
  * This function gets element info from configure info.
  *
+ * @param[in]  handle          Handle of camcorder.
  * @param[in]  configure_info  configure structure created by _mmcamcorder_conf_get_info.
  * @param[in]  category        configure category.
  * @param[in]  name            detail name in category.
@@ -284,7 +311,7 @@ int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int ca
  * @see
  *
  */
-int _mmcamcorder_conf_get_element(camera_conf *configure_info, int category, char *name, type_element **element);
+int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf *configure_info, int category, const char *name, type_element **element);
 
 /**
  * This function gets element name from element info.
@@ -296,7 +323,7 @@ int _mmcamcorder_conf_get_element(camera_conf *configure_info, int category, cha
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_element_name(type_element *element, char **value);
+int _mmcamcorder_conf_get_value_element_name(type_element *element, const char **value);
 
 /**
  * This function gets integer value of element's named property from element info.
@@ -309,7 +336,7 @@ int _mmcamcorder_conf_get_value_element_name(type_element *element, char **value
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_element_int(type_element *element, char *name, int *value);
+int _mmcamcorder_conf_get_value_element_int(type_element *element, const char *name, int *value);
 
 /**
  * This function gets string value of element's named property from element info.
@@ -322,7 +349,7 @@ int _mmcamcorder_conf_get_value_element_int(type_element *element, char *name, i
  * @see
  *
  */
-int _mmcamcorder_conf_get_value_element_string(type_element *element, char *name, char **value);
+int _mmcamcorder_conf_get_value_element_string(type_element *element, const char *name, const char **value);
 
 /**
  * This function sets all property of element info.
@@ -345,20 +372,20 @@ int _mmcamcorder_conf_set_value_element_property(GstElement *gst, type_element *
  * @see
  *
  */
-void _mmcamcorder_conf_print_info(camera_conf **configure_info);
+void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf **configure_info);
 
 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type);
 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format);
 
 /* Internal function */
-void _mmcamcorder_conf_init(int type, camera_conf **configure_info);
-int _mmcamcorder_conf_parse_info(int type, FILE *fd, camera_conf **configure_info);
-int _mmcamcorder_conf_get_value_type(int type, int category, char *name, int *value_type);
-int _mmcamcorder_conf_add_info(int type, conf_info **info, char **buffer_details, int category, int count_details);
-int _mmcamcorder_conf_get_default_value_int(int type, int category, char *name, int *value);
-int _mmcamcorder_conf_get_default_value_string(int type, int category, char *name, char **value);
-int _mmcamcorder_conf_get_default_element(int type, int category, char *name, type_element **element);
-int _mmcamcorder_conf_get_category_size(int type, int category, int *size);
+void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf **configure_info);
+int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fd, camera_conf **configure_info);
+int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char *name, int *value_type);
+int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details);
+int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char *name, int *value);
+int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
+int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
+int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
 
 #ifdef __cplusplus
 }
index 64b3c30..efbdc97 100644 (file)
@@ -29,7 +29,6 @@
 #include <libexif/exif-tag.h>
 #include <libexif/exif-format.h>
 #include <libexif/exif-data.h>
-#include <libexif/samsung/mnote-samsung-tag.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -88,7 +87,7 @@ ExifData *mm_exif_get_exif_from_info(mm_exif_info_t *info);
 int mm_exif_set_exif_to_info(mm_exif_info_t *info, ExifData *exif);
 
 /**
- * add one tag information into exif 
+ * add one tag information into exif
  *  @param[in] info exif info.
  *  @param[in] Exif tag .
  *  @param[in] tag content category.
@@ -99,7 +98,7 @@ int mm_exif_set_exif_to_info(mm_exif_info_t *info, ExifData *exif);
  */
 int mm_exif_set_add_entry(ExifData *exif, ExifIfd ifd, ExifTag tag,
                          ExifFormat format, unsigned long components,
-                         unsigned char *data);
+                         const char *data);
 
 /**
  * Write thumbnail data into exif info.
@@ -114,25 +113,6 @@ int mm_exif_add_thumbnail_info(mm_exif_info_t *info, void *thumbnail,
                               int width, int height, int len);
 
 /**
- * create ExifMnoteDataSamsung and set up related function pointers
- * @param[in/out] info exif info.
- * @return return int.
- */
-int mm_exif_mnote_create(ExifData *exif);
-
-/**
- * add one Samsung maker note tag information into exif
- *  @param[in/out] info exif info.
- *  @param[in] Samsung maker note tag .
- *  @param[in] tag index.
- *  @param[in] sub tag index 1.
- *  @param[in] sub tag index 2.
- *  @return return int.
- */
-int mm_exif_mnote_set_add_entry(ExifData *exif, MnoteSamsungTag tag,
-                               int index, int subindex1, int subindex2);
-
-/**
  * Write exif info into a jpeg image and then save as a jpeg file.
  * @param[in/out] filename jpeg filename.
  * @param[in] info exif info.
@@ -155,6 +135,15 @@ int mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length,
                                      mm_exif_info_t *info, void *jpeg,
                                      unsigned int jpeg_len);
 
+/**
+ * Load exif info from a jpeg memory buffer.
+ * @param[out] info exif info.
+ * @param[in] jpeg jpeg image data.
+ * @param[in] length length of jpeg image.
+ * @return return int.
+ */
+int mm_exif_load_exif_info(mm_exif_info_t **info, void *jpeg_data, int jpeg_length);
+
 #ifdef __cplusplus
 }
 #endif
index eb33cab..cb025b2 100644 (file)
@@ -96,7 +96,7 @@ typedef struct {
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
 ========================================================================================*/
-/* create bin */
+/* create pipeline */
 /**
  * This function creates bin of video source.
  * Basically, main pipeline of camcorder is composed of several bin(a bundle
@@ -108,7 +108,7 @@ typedef struct {
  * @remarks
  * @see                __mmcamcorder_create_preview_pipeline()
  */
-int _mmcamcorder_create_videosrc_bin(MMHandleType handle);
+int _mmcamcorder_create_preview_elements(MMHandleType handle);
 
 /**
  * This function creates bin of audio source.
@@ -124,19 +124,6 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle);
 int _mmcamcorder_create_audiosrc_bin(MMHandleType handle);
 
 /**
- * This function creates bin of video sink.
- * Basically, main pipeline of camcorder is composed of several bin(a bundle
- *  of elements). Each bin operates its own function. This bin has a roll
- * transferring video data to frame buffer.
- *
- * @param[in]  handle          Handle of camcorder context.
- * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
- * @remarks
- * @see                __mmcamcorder_create_preview_pipeline()
- */
-int _mmcamcorder_create_videosink_bin(MMHandleType handle);
-
-/**
  * This function creates outputsink bin.
  *
  * @param[in]  handle          Handle of camcorder context.
@@ -148,19 +135,6 @@ int _mmcamcorder_create_videosink_bin(MMHandleType handle);
 int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebinProfile profile);
 
 /**
- * This function creates bin of still shot sink.
- * Basically, main pipeline of camcorder is composed of several bin(a bundle
- *  of elements). Each bin operates its own function. This bin has a roll
- * writting image file with video stream.
- *
- * @param[in]  handle          Handle of camcorder context.
- * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
- * @remarks
- * @see                __mmcamcorder_create_preview_pipeline()
- */
-int _mmcamcorder_create_stillshotsink_bin(MMHandleType handle);
-
-/**
  * This function creates main pipeline of camcorder.
  * Basically, main pipeline of camcorder is composed of several bin(a bundle
  *  of elements). And if the appilcation wants to make pipeline working, the
@@ -176,21 +150,24 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle);
 
 /* plug-in related */
 void _mmcamcorder_negosig_handler(GstElement *videosrc, MMHandleType handle);
+void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpointer handle);
 
 /* etc */
 int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element *VideosinkElement);
 int _mmcamcorder_vframe_stablize(MMHandleType handle);
 gboolean _mmcamcorder_get_device_info(MMHandleType handle);
 int _mmcamcorder_get_eos_message(MMHandleType handle);
-void _mmcamcorder_remove_element_handle(MMHandleType handle, int first_elem, int last_elem);
+void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int first_elem, int last_elem);
 int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle);
 int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle);
 bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate);
 bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip);
 bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate);
+bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, int width, int height, int fps, int rotate);
 bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int viderosrc_flip);
 bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake);
 bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilization);
+bool _mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height);
 
 #ifdef __cplusplus
 }
index 2881d7b..d40db30 100644 (file)
@@ -35,7 +35,6 @@
 #include <mm_attrs.h>
 #include <mm_attrs_private.h>
 #include <mm_message.h>
-#include <mm_ta.h>
 #include <sndfile.h>
 #include <vconf.h>
 #include <gst/video/video-format.h>
@@ -62,11 +61,11 @@ extern "C" {
 /*=======================================================================================
 | MACRO DEFINITIONS                                                                    |
 ========================================================================================*/
-#define _mmcam_dbg_verb(fmt, args...)  mmf_debug(MMF_DEBUG_VERBOSE,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_log(fmt, args...)   mmf_debug(MMF_DEBUG_LOG,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_warn(fmt, args...)  mmf_debug(MMF_DEBUG_WARNING,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_err(fmt, args...)   mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_crit(fmt, args...)  mmf_debug(MMF_DEBUG_CRITICAL,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
+#define _mmcam_dbg_verb(fmt, args...)  debug_verbose (" "fmt"\n", ##args);
+#define _mmcam_dbg_log(fmt, args...)   debug_log (" "fmt"\n", ##args);
+#define _mmcam_dbg_warn(fmt, args...)  debug_warning (" "fmt"\n", ##args);
+#define _mmcam_dbg_err(fmt, args...)   debug_error (" "fmt"\n", ##args);
+#define _mmcam_dbg_crit(fmt, args...)  debug_critical (" "fmt"\n", ##args);
 
 /**
  *     Macro for checking validity and debugging
@@ -98,104 +97,121 @@ extern "C" {
 #endif
 
 /* gstreamer element creation macro */
-#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, eid, name /*char* */, err) \
-       if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \
+       if (element[eid].gst != NULL) { \
                _mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
-               gst_object_unref(sub_context->element[eid].gst); \
+               gst_object_unref(element[eid].gst); \
        } \
-       sub_context->element[eid].id = eid; \
-       sub_context->element[eid].gst = gst_pipeline_new(name); \
-       if (sub_context->element[eid].gst == NULL) { \
+       element[eid].id = eid; \
+       element[eid].gst = gst_pipeline_new(name); \
+       if (element[eid].gst == NULL) { \
                _mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
                goto pipeline_creation_error; \
        } else { \
-               g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+               g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
        }
 
-#define _MMCAMCORDER_BIN_MAKE(sub_context, eid, name /*char* */, err) \
-       if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \
+       if (element[eid].gst != NULL) { \
                _mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
-               gst_object_unref(sub_context->element[eid].gst); \
+               gst_object_unref(element[eid].gst); \
        } \
-       sub_context->element[eid].id = eid; \
-       sub_context->element[eid].gst = gst_bin_new(name); \
-       if (sub_context->element[eid].gst == NULL) { \
+       element[eid].id = eid; \
+       element[eid].gst = gst_bin_new(name); \
+       if (element[eid].gst == NULL) { \
                _mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
                goto pipeline_creation_error; \
        } else { \
-               g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+               g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
        }
 
-#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, eid, name /*char* */, nickname /*char* */, elist, err) \
-       if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \
+       if (element[eid].gst != NULL) { \
                _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
-               gst_object_unref(sub_context->element[eid].gst); \
+               gst_object_unref(element[eid].gst); \
        } \
-       sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
-       if (sub_context->element[eid].gst == NULL) { \
+       element[eid].gst = gst_element_factory_make(name, nickname); \
+       if (element[eid].gst == NULL) { \
                _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
                goto pipeline_creation_error; \
        } else { \
                _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
-               sub_context->element[eid].id = eid; \
-               g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+               element[eid].id = eid; \
+               g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
                err = MM_ERROR_NONE; \
        } \
-       elist = g_list_append(elist, &(sub_context->element[eid]));
+       elist = g_list_append(elist, &(element[eid]));
 
-#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, eid, name /*char* */, nickname /*char* */, elist) \
-       if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \
+       if (element[eid].gst != NULL) { \
                _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
-               gst_object_unref(sub_context->element[eid].gst); \
+               gst_object_unref(element[eid].gst); \
        } \
-       sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
-       if (sub_context->element[eid].gst == NULL) { \
+       element[eid].gst = gst_element_factory_make(name, nickname); \
+       if (element[eid].gst == NULL) { \
                _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \
        } else { \
                _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
-               sub_context->element[eid].id = eid; \
-               g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
-               elist = g_list_append(elist, &(sub_context->element[eid])); \
+               element[eid].id = eid; \
+               g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+               elist = g_list_append(elist, &(element[eid])); \
        }
 
 #define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
-       if (sub_context->element[eid].gst != NULL) { \
+       if (sub_context->encode_element[eid].gst != NULL) { \
                _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
-               gst_object_unref(sub_context->element[eid].gst); \
+               gst_object_unref(sub_context->encode_element[eid].gst); \
        } \
-       sub_context->element[eid].id = eid; \
-       g_object_get(G_OBJECT(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sc->element[eid].gst), NULL); \
-       if (sub_context->element[eid].gst == NULL) { \
-               _mmcam_dbg_err("Element get fail. element_id=[%d], name=[%s]", eid, name); \
+       sub_context->encode_element[eid].id = eid; \
+       g_object_get(G_OBJECT(sub_context->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sub_context->encode_element[eid].gst), NULL); \
+       if (sub_context->encode_element[eid].gst == NULL) { \
+               _mmcam_dbg_err("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
                goto pipeline_creation_error; \
        } else{ \
-               gst_object_unref(sub_context->element[eid].gst); \
-               g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+               gst_object_unref(sub_context->encode_element[eid].gst); \
+               g_object_weak_ref(G_OBJECT(sub_context->encode_element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
        }
 
 /* GStreamer element remove macro */
-#define _MMCAMCORDER_ELEMENT_REMOVE(sub_context, eid) \
-       if (sub_context->element[eid].gst != NULL) { \
-               gst_object_unref(sub_context->element[eid].gst); \
+#define _MMCAMCORDER_ELEMENT_REMOVE(element, eid) \
+       if (element[eid].gst != NULL) { \
+               gst_object_unref(element[eid].gst); \
        }
 
 #define _MM_GST_ELEMENT_LINK_MANY       gst_element_link_many
 #define _MM_GST_ELEMENT_LINK            gst_element_link
 #define _MM_GST_PAD_LINK                gst_pad_link
 
-#define _MM_GST_PAD_LINK_UNREF( srcpad, sinkpad, err, if_fail_goto ) \
-{ \
-       GstPadLinkReturn ret = _MM_GST_PAD_LINK( srcpad, sinkpad ); \
-       gst_object_unref( srcpad ); srcpad = NULL; \
-       gst_object_unref( sinkpad ); sinkpad = NULL; \
-       if (ret != GST_PAD_LINK_OK) { \
-               err = MM_ERROR_CAMCORDER_GST_LINK; \
-               goto if_fail_goto; \
-       } \
+#define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto)\
+{\
+       GstPadLinkReturn ret = _MM_GST_PAD_LINK(srcpad, sinkpad);\
+       if (ret != GST_PAD_LINK_OK) {\
+               GstObject *src_parent = gst_pad_get_parent(srcpad);\
+               GstObject *sink_parent = gst_pad_get_parent(sinkpad);\
+               char *src_name = NULL;\
+               char *sink_name = NULL;\
+               g_object_get((GObject *)src_parent, "name", &src_name, NULL);\
+               g_object_get((GObject *)sink_parent, "name", &sink_name, NULL);\
+               _mmcam_dbg_err("src[%s] - sink[%s] link failed", src_name, sink_name);\
+               gst_object_unref(src_parent); src_parent = NULL;\
+               gst_object_unref(sink_parent); sink_parent = NULL;\
+               if (src_name) {\
+                       free(src_name); src_name = NULL;\
+               }\
+               if (sink_name) {\
+                       free(sink_name); sink_name = NULL;\
+               }\
+               gst_object_unref(srcpad); srcpad = NULL;\
+               gst_object_unref(sinkpad); sinkpad = NULL;\
+               err = MM_ERROR_CAMCORDER_GST_LINK;\
+               goto if_fail_goto;\
+       }\
+       gst_object_unref(srcpad); srcpad = NULL;\
+       gst_object_unref(sinkpad); sinkpad = NULL;\
 }
 
 #define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
@@ -262,58 +278,69 @@ extern "C" {
 /**
  *     Functions related with LOCK and WAIT
  */
-#define _MMCAMCORDER_CAST_MTSAFE(handle)                               (((mmf_camcorder_t*)handle)->mtsafe)
+#define _MMCAMCORDER_CAST_MTSAFE(handle)                       (((mmf_camcorder_t*)handle)->mtsafe)
 
-#define _MMCAMCORDER_GET_LOCK(handle)                                  (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
-#define _MMCAMCORDER_LOCK(handle)                                              g_mutex_lock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK(handle)                                   g_mutex_trylock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK(handle)                                            g_mutex_unlock(_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_GET_LOCK(handle)                          (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
+#define _MMCAMCORDER_LOCK(handle)                              pthread_mutex_lock(&_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK(handle)                           pthread_mutex_trylock(&_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK(handle)                            pthread_mutex_unlock(&_MMCAMCORDER_GET_LOCK(handle))
 
-#define _MMCAMCORDER_GET_COND(handle)                                  (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
-#define _MMCAMCORDER_WAIT(handle)                                              g_cond_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TIMED_WAIT(handle, timeval)               g_cond_timed_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle),timeval)
+#define _MMCAMCORDER_GET_COND(handle)                          (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
+#define _MMCAMCORDER_WAIT(handle)                              pthread_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TIMED_WAIT(handle, timeval)               pthread_cond_timedwait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), timeval)
 
-#define _MMCAMCORDER_SIGNAL(handle)                                            g_cond_signal (_MMCAMCORDER_GET_COND(handle));
-#define _MMCAMCORDER_BROADCAST(handle)                                 g_cond_broadcast (_MMCAMCORDER_GET_COND(handle));
+#define _MMCAMCORDER_SIGNAL(handle)                            pthread_cond_signal(&_MMCAMCORDER_GET_COND(handle))
+#define _MMCAMCORDER_BROADCAST(handle)                         pthread_cond_broadcast(&_MMCAMCORDER_GET_COND(handle))
 
 /* for command */
-#define _MMCAMCORDER_GET_CMD_LOCK(handle)                                      (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
-#define _MMCAMCORDER_LOCK_CMD(handle)                                          g_mutex_lock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_CMD(handle)                                       g_mutex_trylock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_CMD(handle)                                                g_mutex_unlock(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_GET_CMD_LOCK(handle)                      (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
+#define _MMCAMCORDER_LOCK_CMD(handle)                          pthread_mutex_lock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_CMD(handle)                       pthread_mutex_trylock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_CMD(handle)                                pthread_mutex_unlock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+
+/* for ASM */
+#define _MMCAMCORDER_GET_ASM_LOCK(handle)                      (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
+#define _MMCAMCORDER_LOCK_ASM(handle)                          pthread_mutex_lock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASM(handle)                       pthread_mutex_trylock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASM(handle)                                pthread_mutex_unlock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
 
 /* for state change */
-#define _MMCAMCORDER_GET_STATE_LOCK(handle)                                    (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
-#define _MMCAMCORDER_LOCK_STATE(handle)                                                g_mutex_lock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_STATE(handle)                                     g_mutex_trylock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_STATE(handle)                                              g_mutex_unlock(_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_STATE_LOCK(handle)                    (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
+#define _MMCAMCORDER_LOCK_STATE(handle)                                pthread_mutex_lock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_STATE(handle)                     pthread_mutex_trylock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_STATE(handle)                      pthread_mutex_unlock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
 
 /* for gstreamer state change */
-#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle)                                        (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
-#define _MMCAMCORDER_LOCK_GST_STATE(handle)                                            g_mutex_lock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle)                                 g_mutex_trylock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_GST_STATE(handle)                                          g_mutex_unlock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle)                        (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
+#define _MMCAMCORDER_LOCK_GST_STATE(handle)                    pthread_mutex_lock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle)                 pthread_mutex_trylock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_STATE(handle)                  pthread_mutex_unlock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+
+#define _MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle)         (_MMCAMCORDER_CAST_MTSAFE(handle).gst_encode_state_lock)
+#define _MMCAMCORDER_LOCK_GST_ENCODE_STATE(handle)             pthread_mutex_lock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_ENCODE_STATE(handle)          pthread_mutex_trylock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_ENCODE_STATE(handle)           pthread_mutex_unlock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
 
 /* for setting/calling callback */
 #define _MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle)      (_MMCAMCORDER_CAST_MTSAFE(handle).message_cb_lock)
-#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle)          g_mutex_lock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle)       g_mutex_trylock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle)        g_mutex_unlock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle)          pthread_mutex_lock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle)       pthread_mutex_trylock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle)        pthread_mutex_unlock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
 
 #define _MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle)     (_MMCAMCORDER_CAST_MTSAFE(handle).vcapture_cb_lock)
-#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle)         g_mutex_lock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle)      g_mutex_trylock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle)       g_mutex_unlock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle)         pthread_mutex_lock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle)      pthread_mutex_trylock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle)       pthread_mutex_unlock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
 
 #define _MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle)      (_MMCAMCORDER_CAST_MTSAFE(handle).vstream_cb_lock)
-#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle)          g_mutex_lock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle)       g_mutex_trylock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle)        g_mutex_unlock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle)          pthread_mutex_lock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle)       pthread_mutex_trylock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle)        pthread_mutex_unlock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
 
 #define _MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle)      (_MMCAMCORDER_CAST_MTSAFE(handle).astream_cb_lock)
-#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle)          g_mutex_lock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle)       g_mutex_trylock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle)        g_mutex_unlock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle)          pthread_mutex_lock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle)       pthread_mutex_trylock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle)        pthread_mutex_unlock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
 
 /**
  * Caster of main handle (camcorder)
@@ -333,13 +360,15 @@ extern "C" {
 #define MM_CAMCORDER_MODE_NUM                  3       /**< Number of mode type */
 #define MM_CAMCORDER_COLOR_TONE_NUM            30      /**< Number of color-tone modes */
 #define MM_CAMCORDER_WHITE_BALANCE_NUM         10      /**< Number of WhiteBalance modes*/
-#define MM_CAMCORDER_SCENE_MODE_NUM            15      /**< Number of program-modes */
+#define MM_CAMCORDER_SCENE_MODE_NUM            16      /**< Number of program-modes */
 #define MM_CAMCORDER_FOCUS_MODE_NUM            6       /**< Number of focus mode*/
 #define MM_CAMCORDER_AUTO_FOCUS_NUM            5       /**< Total count of auto focus type*/
 #define MM_CAMCORDER_FOCUS_STATE_NUM           4       /**< Number of focus state */
 #define MM_CAMCORDER_ISO_NUM                   10      /**< Number of ISO */
 #define MM_CAMCORDER_AUTO_EXPOSURE_NUM         9       /**< Number of Auto exposure type */
 #define MM_CAMCORDER_WDR_NUM                   3       /**< Number of wide dynamic range */
+#define MM_CAMCORDER_FLIP_NUM                  4       /**< Number of Filp mode */
+#define MM_CAMCORDER_ROTATION_NUM              4       /**< Number of Rotation mode */
 #define MM_CAMCORDER_AHS_NUM                   4       /**< Number of anti-handshake */
 #define MM_CAMCORDER_VIDEO_STABILIZATION_NUM   2       /**< Number of video stabilization */
 #define MM_CAMCORDER_HDR_CAPTURE_NUM           3       /**< Number of HDR capture mode */
@@ -379,9 +408,9 @@ enum {
        _MMCamcorder_MULTI_SHOT,
 };
 
-/** 
- * Enumerations for manual focus direction. 
- * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored. 
+/**
+ * Enumerations for manual focus direction.
+ * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
  */
 enum MMCamcorderMfLensDir {
        MM_CAMCORDER_MF_LENS_DIR_FORWARD = 1,   /**< Focus direction to forward */
@@ -400,37 +429,44 @@ typedef enum {
        _MMCAMCORDER_MAIN_PIPE = 0x00,
 
        /* Pipeline element of Video input */
-       _MMCAMCORDER_VIDEOSRC_BIN,
        _MMCAMCORDER_VIDEOSRC_SRC,
        _MMCAMCORDER_VIDEOSRC_FILT,
-       _MMCAMCORDER_VIDEOSRC_QUE,
+       _MMCAMCORDER_VIDEOSRC_CLS_QUE,
        _MMCAMCORDER_VIDEOSRC_CLS,
-       _MMCAMCORDER_VIDEOSRC_SCALE,
-       _MMCAMCORDER_VIDEOSRC_VSFLT,
-       _MMCAMCORDER_VIDEOSRC_TEE,
+       _MMCAMCORDER_VIDEOSRC_CLS_FILT,
+       _MMCAMCORDER_VIDEOSRC_QUE,
+       _MMCAMCORDER_VIDEOSRC_DECODE,
+
+       /* Pipeline element of Video output */
+       _MMCAMCORDER_VIDEOSINK_QUE,
+       _MMCAMCORDER_VIDEOSINK_CLS,
+       _MMCAMCORDER_VIDEOSINK_SINK,
+
+       _MMCAMCORDER_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_PREVIEW_PIPELINE_ELELMENT;
+
+/**
+ * Camcorder Pipeline's Element name.
+ * @note index of element.
+ */
+typedef enum {
+       _MMCAMCORDER_ENCODE_NONE = (-1),
+
+       /* Main Pipeline Element */
+       _MMCAMCORDER_ENCODE_MAIN_PIPE = 0x00,
 
        /* Pipeline element of Audio input */
        _MMCAMCORDER_AUDIOSRC_BIN,
        _MMCAMCORDER_AUDIOSRC_SRC,
        _MMCAMCORDER_AUDIOSRC_FILT,
-       _MMCAMCORDER_AUDIOSRC_NS,
        _MMCAMCORDER_AUDIOSRC_QUE,
        _MMCAMCORDER_AUDIOSRC_CONV,
        _MMCAMCORDER_AUDIOSRC_VOL,
-       _MMCAMCORDER_AUDIOSRC_ENC,
-
-       /* Pipeline element of Video output */
-       _MMCAMCORDER_VIDEOSINK_BIN,
-       _MMCAMCORDER_VIDEOSINK_QUE,
-       _MMCAMCORDER_VIDEOSINK_SCALE,
-       _MMCAMCORDER_VIDEOSINK_FILT,
-       _MMCAMCORDER_VIDEOSINK_OVERLAY,
-       _MMCAMCORDER_VIDEOSINK_CLS,
-       _MMCAMCORDER_VIDEOSINK_ROTATE,
-       _MMCAMCORDER_VIDEOSINK_SINK,
 
        /* Pipeline element of Encodebin */
        _MMCAMCORDER_ENCSINK_BIN,
+       _MMCAMCORDER_ENCSINK_SRC,
+       _MMCAMCORDER_ENCSINK_FILT,
        _MMCAMCORDER_ENCSINK_ENCBIN,
        _MMCAMCORDER_ENCSINK_AQUE,
        _MMCAMCORDER_ENCSINK_CONV,
@@ -449,39 +485,15 @@ typedef enum {
        _MMCAMCORDER_ENCSINK_MUX,
        _MMCAMCORDER_ENCSINK_SINK,
 
-       /* Pipeline element of Stillshot output */
-       _MMCAMCORDER_STILLSHOTSINK_BIN,
-       _MMCAMCORDER_STILLSHOTSINK_QUE,
-       _MMCAMCORDER_STILLSHOTSINK_TOGGLE,
-       _MMCAMCORDER_STILLSHOTSINK_CLS,
-       _MMCAMCORDER_STILLSHOTSINK_CROP,
-       _MMCAMCORDER_STILLSHOTSINK_FILT,
-       _MMCAMCORDER_STILLSHOTSINK_SCALE,
-       _MMCAMCORDER_STILLSHOTSINK_FILT2,
-       _MMCAMCORDER_STILLSHOTSINK_ENC,
-       _MMCAMCORDER_STILLSHOTSINK_SINK,
-
-       _MMCamcorder_PIPELINE_ELEMENT_NUM,
-} _MMCAMCORDER_PIPELINE_ELELMENT;
+       _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_ENCODE_PIPELINE_ELELMENT;
 
-/**
- * Command type for Camcorder.
- */
 typedef enum {
-       _MMCAMCORDER_CMD_CREATE,
-       _MMCAMCORDER_CMD_DESTROY,
-       _MMCAMCORDER_CMD_REALIZE,
-       _MMCAMCORDER_CMD_UNREALIZE,
-       _MMCAMCORDER_CMD_START,
-       _MMCAMCORDER_CMD_STOP,
-       _MMCAMCORDER_CMD_CAPTURESTART,
-       _MMCAMCORDER_CMD_CAPTURESTOP,
-       _MMCAMCORDER_CMD_RECORD,
-       _MMCAMCORDER_CMD_PAUSE,
-       _MMCAMCORDER_CMD_COMMIT,
-       _MMCAMCORDER_CMD_CANCEL,
-       _MMCAMCORDER_CMD_QUIT,
-} _MMCamcorderCommandType;
+       _MMCAMCORDER_TASK_THREAD_STATE_NONE,
+       _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START,
+       _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE,
+       _MMCAMCORDER_TASK_THREAD_STATE_EXIT,
+} _MMCamcorderTaskThreadState;
 
 /**
  * System state change cause
@@ -519,33 +531,19 @@ typedef struct {
  * MMCamcorder information for Multi-Thread Safe
  */
 typedef struct {
-       GMutex *lock;                   /**< Mutex (for general use) */
-       GCond *cond;                    /**< Condition (for general use) */
-       GMutex *cmd_lock;               /**< Mutex (for command) */
-       GMutex *state_lock;             /**< Mutex (for state change) */
-       GMutex *gst_state_lock;         /**< Mutex (for state change) */
-       GMutex *message_cb_lock;        /**< Mutex (for message callback) */
-       GMutex *vcapture_cb_lock;       /**< Mutex (for video capture callback) */
-       GMutex *vstream_cb_lock;        /**< Mutex (for video stream callback) */
-       GMutex *astream_cb_lock;        /**< Mutex (for audio stream callback) */
+       pthread_mutex_t lock;                   /**< Mutex (for general use) */
+       pthread_cond_t cond;                    /**< Condition (for general use) */
+       pthread_mutex_t cmd_lock;               /**< Mutex (for command) */
+       pthread_mutex_t asm_lock;               /**< Mutex (for ASM) */
+       pthread_mutex_t state_lock;             /**< Mutex (for state change) */
+       pthread_mutex_t gst_state_lock;         /**< Mutex (for gst pipeline state change) */
+       pthread_mutex_t gst_encode_state_lock;  /**< Mutex (for gst encode pipeline state change) */
+       pthread_mutex_t message_cb_lock;                /**< Mutex (for message callback) */
+       pthread_mutex_t vcapture_cb_lock;       /**< Mutex (for video capture callback) */
+       pthread_mutex_t vstream_cb_lock;                /**< Mutex (for video stream callback) */
+       pthread_mutex_t astream_cb_lock;                /**< Mutex (for audio stream callback) */
 } _MMCamcorderMTSafe;
 
-/**
- * MMCamcorder information for command loop
- */
-typedef struct {
-       pthread_t pCommandThread;                                                                                       /**< Command loop handle */
-       GQueue *cmd_queue;                                                                                                      /**< Queue for Command loop */
-       sem_t sema;                                                                                                             /**< Semaphore for Command loop */
-} _MMCamcorderCommand;
-
-/**
- * MMCamcorder command information
- */
-typedef struct {
-       MMHandleType handle;                                                                                            /**< camcorder handle */
-       _MMCamcorderCommandType type;                                                                           /**< Type of command */
-} __MMCamcorderCmdInfo;
 
 /**
  * MMCamcorder Sub Context
@@ -554,6 +552,7 @@ typedef struct {
        bool isMaxsizePausing;                  /**< Because of size limit, pipeline is paused. */
        bool isMaxtimePausing;                  /**< Because of time limit, pipeline is paused. */
        int element_num;                        /**< count of element */
+       int encode_element_num;                 /**< count of encode element */
        int cam_stability_count;                /**< camsensor stability count. the count of frame will drop */
        GstClockTime pipeline_time;             /**< current time of Gstreamer Pipeline */
        GstClockTime pause_time;                /**< amount of time while pipeline is in PAUSE state.*/
@@ -575,15 +574,17 @@ typedef struct {
        int pass_first_vframe;                  /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */
 
        /* INI information */
-       gchar format_name[sizeof(GST_VIDEO_FORMATS_ALL)]; /**< Get format value of camera INI file */
+       unsigned int fourcc;                    /**< Get fourcc value of camera INI file */
        _MMCamcorderImageInfo *info_image;      /**< extra information for image capture */
        _MMCamcorderVideoInfo *info_video;      /**< extra information for video recording */
        _MMCamcorderAudioInfo *info_audio;      /**< extra information for audio recording */
 
-       _MMCamcorderGstElement *element;        /**< array of Gstreamer element */
+       _MMCamcorderGstElement *element;        /**< array of preview element */
+       _MMCamcorderGstElement *encode_element; /**< array of encode element */
        _MMCamcorderKPIMeasure kpi;             /**< information related with performance measurement */
 
        type_element *VideosinkElement;         /**< configure data of videosink element */
+       type_element *VideoconvertElement;      /**< configure data of videoconvert element */
        gboolean SensorEncodedCapture;          /**< whether camera sensor support encoded image capture */
        gboolean internal_encode;               /**< whether use internal encoding function */
 } _MMCamcorderSubContext;
@@ -594,6 +595,7 @@ typedef struct {
 typedef struct mmf_camcorder {
        /* information */
        int type;               /**< mmcamcorder_mode_type */
+       int device_type;        /**< device type */
        int state;              /**< state of camcorder */
        int target_state;       /**< Target state that want to set. This is a flag that
                                   * stands for async state changing. If this value differ from state,
@@ -605,14 +607,12 @@ typedef struct mmf_camcorder {
        mm_exif_info_t *exif_info;             /**< EXIF */
        GList *buffer_probes;                  /**< a list of buffer probe handle */
        GList *event_probes;                   /**< a list of event probe handle */
-       GList *data_probes;                    /**< a list of data probe handle */
        GList *signals;                        /**< a list of signal handle */
        GList *msg_data;                       /**< a list of msg data */
        camera_conf *conf_main;                /**< Camera configure Main structure */
        camera_conf *conf_ctrl;                /**< Camera configure Control structure */
-       int asm_handle_sh;                     /**< Audio session manager handle of share session */
-       int asm_handle_ex;                     /**< Audio session manager handle of exclusive session */
        guint pipeline_cb_event_id;            /**< Event source ID of pipeline message callback */
+       guint encode_pipeline_cb_event_id;     /**< Event source ID of encode pipeline message callback */
        guint setting_event_id;                /**< Event source ID of attributes setting to sensor */
        SOUND_INFO snd_info;                   /**< Sound handle for multishot capture */
 
@@ -628,21 +628,39 @@ typedef struct mmf_camcorder {
        int (*command)(MMHandleType, int);                      /**< camcorder's command */
 
        /* etc */
+       mm_cam_attr_construct_info *cam_attrs_const_info;       /**< attribute info */
+       conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table - MAIN category */
+       conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table - CONTROL category */
+       int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table size - MAIN category */
+       int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table size - CONTROL category */
        _MMCamcorderMTSafe mtsafe;                              /**< Thread safe */
-       _MMCamcorderCommand cmd;                                /**< information for command loop */
-       int sync_state_change;                                  /**< Change framework state synchronously */
-       int quick_device_close;
-       int state_change_by_system;                             /**< MSL changes its state by itself because of system(ASM,MDM..) **/
-       int asm_event_code;                                     /**< event code of audio session manager */
+       int state_change_by_system;                             /**< MSL changes its state by itself because of system */
        pthread_mutex_t sound_lock;                             /**< Capture sound mutex */
        pthread_cond_t sound_cond;                              /**< Capture sound cond */
+       pthread_mutex_t restart_preview_lock;                   /**< Capture sound mutex */
        int use_zero_copy_format;                               /**< Whether use zero copy format for camera input */
+       int support_media_packet_preview_cb;                   /**< Whether support zero copy format for camera input */
        int shutter_sound_policy;                               /**< shutter sound policy */
+       int brightness_default;                                 /**< default value of brightness */
+       int brightness_step_denominator;                        /**< denominator of brightness bias step */
+       int support_zsl_capture;                                /**< support Zero Shutter Lag capture */
+       char *model_name;                                       /**< model name from system info */
+       char *software_version;                                 /**< software_version from system info */
+       int capture_sound_count;                                /**< count for capture sound */
+       bool stillshot_wide_resolution;                         /**<to set the capture resolution high*/
 
        _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM];        /**< converting structure of camera info */
        _MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM];                    /**< enum converting list that is modified by ini info */
 
-       int reserved[4];                        /**< reserved */
+       gboolean capture_in_recording;                          /**< Flag for capture while recording */
+
+       /* task thread */
+       pthread_t task_thread;                                  /**< thread for task */
+       pthread_mutex_t task_thread_lock;                       /**< mutex for task thread */
+       pthread_cond_t task_thread_cond;                        /**< cond for task thread */
+       _MMCamcorderTaskThreadState task_thread_state;          /**< state of task thread */
+
+       int reserved[4];                                        /**< reserved */
 } mmf_camcorder_t;
 
 /*=======================================================================================
@@ -667,7 +685,7 @@ typedef struct mmf_camcorder {
 int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info);
 
 /**
- *     This function destroys instance of camcorder. 
+ *     This function destroys instance of camcorder.
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
  *     @return         This function returns zero on success, or negative value with error code.
@@ -957,7 +975,7 @@ int _mmcamcorder_get_state(MMHandleType handle);
 void _mmcamcorder_set_state(MMHandleType handle, int state);
 
 /**
- * This function gets asynchronous status of MSL Camcroder. 
+ * This function gets asynchronous status of MSL Camcroder.
  *
  * @param[in]  handle          Handle of camcorder context.
  * @param[in]  target_state    setting target_state value of camcorder.
@@ -969,40 +987,6 @@ void _mmcamcorder_set_state(MMHandleType handle, int state);
 int _mmcamcorder_get_async_state(MMHandleType handle);
 
 /**
- * This function sets new target state of camcorder.
- *
- * @param[in]  handle          Handle of camcorder context.
- * @param[in]  target_state    setting target_state value of camcorder.
- * @return     This function returns zero on success, or negative value with error code.
- * @remarks
- * @see                _mmcamcorder_get_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-int _mmcamcorder_set_async_state(MMHandleType handle, int target_state);
-
-/**
- * This function sets new target state of camcorder.
- *
- * @param[in]  handle          Handle of camcorder context.
- * @return     gboolean
- * @remarks
- * @see                _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_set_async_cancel(MMHandleType handle);
-
-/**
- * Check whether camcorder changes its state now.
- *
- * @param[in]  handle          Handle of camcorder context.
- * @return     gboolean
- * @remarks
- * @see                _mmcamcorder_set_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_is_state_changing(MMHandleType handle);
-
-/**
  * This function allocates structure of subsidiary attributes.
  *
  * @param[in]  type            Allocation type of camcorder context.
@@ -1093,7 +1077,7 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type);
 void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
 
 /**
- * This function sets gstreamer element status. 
+ * This function sets gstreamer element status.
  * If the gstreamer fails to set status or returns asynchronous mode,
  * this function waits for state changed until timeout expired.
  *
@@ -1107,14 +1091,14 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
 int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
 
 /**
- * This function sets gstreamer element status, asynchronously. 
+ * This function sets gstreamer element status, asynchronously.
  * Regardless of processing, it returns immediately.
  *
  * @param[in]  pipeline        Pointer of pipeline
  * @param[in]  target_state    newly setting status
  * @return     This function returns zero on success, or negative value with error code.
  * @remarks
- * @see        
+ * @see
  *
  */
 int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
@@ -1130,14 +1114,6 @@ void _mmcamcorder_video_current_framerate_init(MMHandleType handle);
 int _mmcamcorder_video_current_framerate(MMHandleType handle);
 int _mmcamcorder_video_average_framerate(MMHandleType handle);
 
-/* command */
-void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo);
-int _mmcamcorder_create_command_loop(MMHandleType handle);
-int _mmcamcorder_destroy_command_loop(MMHandleType handle);
-int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info);
-int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type);
-void *_mmcamcorder_command_loop_thread(void *arg);
-
 #ifdef __cplusplus
 }
 #endif
index a9c747b..9d64d0b 100644 (file)
@@ -143,7 +143,7 @@ extern "C" {
 #define _MMCAMCORDER_SENSOR_ENUM_NONE  -255
 
 /* camera information related */
-#define CAMINFO_CONVERT_NUM            40
+#define CAMINFO_CONVERT_NUM            41
 
 
 /*=======================================================================================
@@ -175,6 +175,8 @@ typedef enum {
        ENUM_CONVERT_EXPOSURE_MODE,
        ENUM_CONVERT_STROBE_MODE,
        ENUM_CONVERT_WDR,
+       ENUM_CONVERT_FLIP,
+       ENUM_CONVERT_ROTATION,
        ENUM_CONVERT_ANTI_HAND_SHAKE,
        ENUM_CONVERT_VIDEO_STABILIZATION,
        ENUM_CONVERT_NUM
@@ -190,7 +192,7 @@ typedef struct {
        int total_enum_num;             /**< total enumeration count */
        int *enum_arr;                  /**< enumeration array */
        int category;                   /**< category */
-       char *keyword;                  /**< keyword array */
+       const char *keyword;                    /**< keyword array */
 } _MMCamcorderEnumConvert;
 
 
@@ -202,7 +204,7 @@ typedef struct {
        int category;                           /**< category of configuration */
        int attr_idx;                           /**< attribute index */
        int attr_idx_pair;                      /**< attribute index (only for 'pair' type) */
-       char *keyword;
+       const char *keyword;
        MMCamConvertingType conv_type;
        _MMCamcorderEnumConvert *enum_convert;  /**< converting value table */
 } _MMCamcorderInfoConverting;
index f193e5b..59b80da 100644 (file)
@@ -26,6 +26,7 @@
 | INCLUDE FILES                                                                                |
 ========================================================================================*/
 #include <pulse/pulseaudio.h>
+#include <pulse/ext-policy.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -38,13 +39,12 @@ extern "C" {
 /*=======================================================================================
 | MACRO DEFINITIONS                                                                    |
 ========================================================================================*/
-#define _MMCAMCORDER_FILEPATH_CAPTURE_SND       "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
-#define _MMCAMCORDER_FILEPATH_CAPTURE2_SND      "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
-#define _MMCAMCORDER_FILEPATH_REC_START_SND     "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
-#define _MMCAMCORDER_FILEPATH_REC_STOP_SND      "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
-#define _MMCAMCORDER_FILEPATH_AF_SUCCEED_SND    "/usr/share/sounds/mm-camcorder/af_succeed.wav"
-#define _MMCAMCORDER_FILEPATH_AF_FAIL_SND       "/usr/share/sounds/mm-camcorder/af_fail.wav"
-#define _MMCAMCORDER_FILEPATH_NO_SND            "/usr/share/sounds/mm-camcorder/no_sound.wav"
+#define _MMCAMCORDER_FILEPATH_CAPTURE_SND        "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
+#define _MMCAMCORDER_FILEPATH_CAPTURE2_SND       "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
+#define _MMCAMCORDER_FILEPATH_REC_START_SND      "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
+#define _MMCAMCORDER_FILEPATH_REC_STOP_SND       "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
+#define _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE   "camera-shutter"
+#define _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP  "recording-stop"
 
 /*=======================================================================================
 | ENUM DEFINITIONS                                                                     |
@@ -65,6 +65,8 @@ typedef struct __SOUND_INFO {
        /* PCM */
        MMSoundPcmHandle_t handle;
        mm_sound_device_out active_out_backup;
+       int volume_type;
+       unsigned int volume_level;
 
        /* mutex and cond */
        pthread_mutex_t play_mutex;
@@ -85,7 +87,10 @@ typedef struct __SOUND_INFO {
        pa_sample_spec sample_spec;
        size_t sample_length;
        pa_channel_map channel_map;
-#endif
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+       pa_stream *sample_stream;
+       pa_sample_spec sample_spec;
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
        _MMCamcorderSoundState state;
 } SOUND_INFO;
@@ -103,11 +108,11 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename);
 #else /* _MMCAMCORDER_UPLOAD_SAMPLE */
 gboolean _mmcamcorder_sound_init(MMHandleType handle);
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
-gboolean _mmcamcorder_sound_play(MMHandleType handle);
+gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play);
 gboolean _mmcamcorder_sound_finalize(MMHandleType handle);
 
-gboolean _mmcamcorder_sound_capture_play_cb(gpointer data);
-void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync);
+void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync_play);
+void _mmcamcorder_sound_solo_play_wait(MMHandleType handle);
 
 #ifdef __cplusplus
 }
index b2bb2ff..3864d08 100644 (file)
@@ -48,14 +48,7 @@ extern "C" {
 /*=======================================================================================
 | ENUM DEFINITIONS                                                                     |
 ========================================================================================*/
-/**
- * Enumeration for flip of fimcconvert
- */
-enum {
-       FIMCCONVERT_FLIP_NONE = 0,
-       FIMCCONVERT_FLIP_VERTICAL,
-       FIMCCONVERT_FLIP_HORIZONTAL
-};
+
 
 /*=======================================================================================
 | STRUCTURE DEFINITIONS                                                                        |
@@ -107,7 +100,7 @@ typedef struct {
  * @remarks
  * @see                __mmcamcorder_create_preview_pipeline()
  */
-int _mmcamcorder_add_stillshot_pipeline(MMHandleType handle);
+int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle);
 
 /**
  * This function remove still shot bin from main pipeline.
@@ -139,15 +132,16 @@ int _mmcamcorder_connect_capture_signal(MMHandleType handle);
  */
 void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle);
 int _mmcamcorder_video_capture_command(MMHandleType handle, int command);
-int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int capture_height);
 
 /* Function for capture */
 int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int image_height);
+int __mmcamcorder_update_exif_info(MMHandleType handle,void* imagedata, int imgln);
 void __mmcamcorder_init_stillshot_info(MMHandleType handle);
 void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstSample *sample);
 void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest);
 int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureDataType *original, MMCamcorderCaptureDataType *thumbnail);
 int __mmcamcorder_set_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest, MMCamcorderCaptureDataType *thumbnail);
+gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data);
 
 #ifdef __cplusplus
 }
index 67333c4..ee35977 100644 (file)
@@ -25,6 +25,9 @@
 /*=======================================================================================
 | INCLUDE FILES                                                                                |
 ========================================================================================*/
+#include <camsrcjpegenc.h>
+#include <linux/magic.h>
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,7 +55,7 @@ do { \
        } else { \
                item->object = G_OBJECT(x_pad); \
                item->category = x_category; \
-        item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \
+               item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \
                x_hcamcorder->buffer_probes = g_list_append(x_hcamcorder->buffer_probes, item); \
                _mmcam_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
        } \
@@ -70,29 +73,12 @@ do { \
        } else { \
                item->object =G_OBJECT(x_pad); \
                item->category = x_category; \
-        item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \
+               item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \
                x_hcamcorder->event_probes = g_list_append(x_hcamcorder->event_probes, item); \
                _mmcam_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
        } \
 } while (0);
 
-#define MMCAMCORDER_ADD_DATA_PROBE(x_pad, x_category, x_callback, x_hcamcorder) \
-do { \
-       MMCamcorderHandlerItem *item = NULL; \
-       item = (MMCamcorderHandlerItem *) g_malloc(sizeof(MMCamcorderHandlerItem)); \
-       if (!item) { \
-               _mmcam_dbg_err("Cannot connect buffer probe [malloc fail] \n"); \
-       } else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \
-               _mmcam_dbg_err("Invalid handler category : %x \n", x_category); \
-       } else { \
-               item->object =G_OBJECT(x_pad); \
-               item->category = x_category; \
-        item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_DATA_BOTH, x_callback, x_hcamcorder, NULL); \
-               x_hcamcorder->data_probes = g_list_append(x_hcamcorder->data_probes, item); \
-               _mmcam_dbg_log("Adding data probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
-       } \
-} while (0);
-
 #define MMCAMCORDER_SIGNAL_CONNECT( x_object, x_category, x_signal, x_callback, x_hcamcorder) \
 do { \
        MMCamcorderHandlerItem* item = NULL; \
@@ -196,6 +182,7 @@ typedef struct {
        MMHandleType handle;            /**< handle */
        int id;                         /**< message id */
        MMMessageParamType param;       /**< message parameter */
+       pthread_mutex_t lock;           /**< mutex for item */
 } _MMCamcorderMsgItem;
 
 /**
@@ -249,11 +236,23 @@ typedef struct
        int __dummy2;
        /* arbitrary data */
        int data[16];
+       /* dmabuf or ion fd */
+       int fd[SCMN_IMGB_MAX_PLANE];
+       /* flag for buffer share */
+       int buf_share_method;
+       /* Y plane size */
+       int y_size;
+       /* UV plane size */
+       int uv_size;
+       /* Tizen buffer object of each image plane */
+       void *bo[SCMN_IMGB_MAX_PLANE];
 } SCMN_IMGB;
 
 /*=======================================================================================
 | CONSTANT DEFINITIONS                                                                 |
 ========================================================================================*/
+#define FAT32_FILE_SYSTEM_MAX_SIZE              (4294967295UL)     /* 4 GigaByte - 1 byte */
+#define NANO_SEC_PER_MILI_SEC                   1000000
 #define _MMCAMCORDER_HANDLER_CATEGORY_ALL \
        (_MMCAMCORDER_HANDLER_PREVIEW | _MMCAMCORDER_HANDLER_VIDEOREC |_MMCAMCORDER_HANDLER_STILLSHOT | _MMCAMCORDER_HANDLER_AUDIOREC)
 
@@ -262,8 +261,8 @@ typedef struct
 ========================================================================================*/
 /* GStreamer */
 void _mmcamcorder_remove_buffer_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
+void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object);
 void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
-void _mmcamcorder_remove_data_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
 void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCategory category);
 void _mmcamcorder_remove_all_handlers(MMHandleType handle, _MMCamcorderHandlerCategory category);
 void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_was);
@@ -283,10 +282,12 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co
 /* JPEG encode */
 gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsigned int src_height,
                                   int src_format, unsigned int src_length, unsigned int jpeg_quality,
-                                  void **result_data, unsigned int *result_length);
+                                  void **result_data, unsigned int *result_length, int enc_type);
 /* resize */
-gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int src_height, int src_length, int src_format,
-                                   unsigned char **dst_data, int *dst_width, int *dst_height, int *dst_length);
+gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_width, unsigned int src_height, unsigned int src_length, int src_format,
+                                   unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length);
+gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_width, unsigned int src_height,
+                                           unsigned char **dst, unsigned int dst_width, unsigned int dst_height);
 
 /* Recording */
 /* find top level tag only, do not use this function for finding sub level tags.
@@ -302,9 +303,11 @@ gboolean _mmcamcorder_update_composition_matrix(FILE *f, int orientation);
 /* File system */
 int _mmcamcorder_get_freespace(const gchar *path, guint64 *free_space);
 int _mmcamcorder_get_file_size(const char *filename, guint64 *size);
+int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type);
+gboolean _mmcamcorder_check_file_path(const gchar *path);
 
-/* Debug */
-void _mmcamcorder_err_trace_write(char *str_filename, char *func_name, int line_num, char *fmt, ...);
+/* Task */
+void *_mmcamcorder_util_task_thread_func(void *data);
 
 #ifdef __cplusplus
 }
index dd78abe..f15a12f 100644 (file)
@@ -42,6 +42,11 @@ extern "C" {
 /*=======================================================================================
 | ENUM DEFINITIONS                                                                     |
 ========================================================================================*/
+enum {
+       PUSH_ENCODING_BUFFER_INIT = 0,
+       PUSH_ENCODING_BUFFER_RUN,
+       PUSH_ENCODING_BUFFER_STOP,
+};
 
 /*=======================================================================================
 | STRUCTURE DEFINITIONS                                                                        |
@@ -52,17 +57,29 @@ extern "C" {
 typedef struct {
        gboolean b_commiting;           /**< Is it commiting now? */
        char *filename;                 /**< recorded filename */
-       double record_timestamp_ratio;  /**< timestamp ratio of video recording for slow motion recording */
+       double record_timestamp_ratio;  /**< timestamp ratio of video recording for slow/fast motion recording */
+       double record_motion_rate;      /**< motion rate of video recording for slow/fast motion recording */
+       GstClockTime prev_preview_ts;   /**< previous preview frame timestamp */
+       GstClockTime base_video_ts;     /**< base video frame timestamp */
+       guint record_drop_count;        /**< drop count of video recording for slow/fast motion recording */
        guint64 video_frame_count;      /**< current video frame */
        guint64 audio_frame_count;      /**< current audio frame */
        guint64 filesize;               /**< current file size */
        guint64 max_size;               /**< max recording size */
        guint64 max_time;               /**< max recording time */
        int fileformat;                 /**< recording file format */
-/*
-       guint checker_id;
-       guint checker_count;
-*/
+       int push_encoding_buffer;       /**< ready to record flag */
+       int preview_width;              /**< preview width */
+       int preview_height;             /**< preview height */
+       int video_width;                /**< video width */
+       int video_height;               /**< video height */
+       int fps;                        /**< fps in videosrc caps */
+       gboolean is_firstframe;
+       gboolean get_first_I_frame;     /**< start flag for H.264 preview recording */
+       gboolean support_dual_stream;   /**< support dual stream flag */
+       gboolean record_dual_stream;    /**< record with dual stream flag */
+       gboolean restart_preview;       /**< flag for whether restart preview or not when start recording */
+       pthread_mutex_t size_check_lock;/**< mutex for checking recording size */
 } _MMCamcorderVideoInfo;
 
 /*=======================================================================================
@@ -81,36 +98,35 @@ typedef struct {
 | GLOBAL FUNCTION PROTOTYPES                                                           |
 ========================================================================================*/
 /**
- * This function add recorder bin to main pipeline.
+ * This function creates recorder pipeline.
  * When application creates initial pipeline, there are only bins for preview.
- * If application wants to add recording function, bins for recording should be added.
+ * If application wants to record, recorder pipeline should be created.
  *
  * @param[in]  handle          Handle of camcorder context.
  * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
  * @remarks
  * @see                __mmcamcorder_create_preview_pipeline()
  */
-int _mmcamcorder_add_recorder_pipeline(MMHandleType handle);
+int _mmcamcorder_create_recorder_pipeline(MMHandleType handle);
 
 /**
- * This function remove recorder bin from main pipeline.
+ * This function connects video stream cb signal.
  *
  * @param[in]  handle          Handle of camcorder context.
  * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
  * @remarks
- * @see                __mmcamcorder_create_preview_pipeline(), __mmcamcorder_add_recorder_pipeline()
  */
-int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle);
+int _mmcamcorder_connect_video_stream_cb_signal(MMHandleType handle);
 
 /**
- * This function destroy video pipeline.
+ * This function remove recorder bin from main pipeline.
  *
  * @param[in]  handle          Handle of camcorder context.
- * @return     void
+ * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
  * @remarks
- * @see                _mmcamcorder_destroy_pipeline()
+ * @see                __mmcamcorder_create_preview_pipeline(), __mmcamcorder_add_recorder_pipeline()
  */
-void _mmcamcorder_destroy_video_pipeline(MMHandleType handle);
+int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle);
 
 /**
  * This function operates each command on video mode.
@@ -133,6 +149,15 @@ int _mmcamcorder_video_command(MMHandleType handle, int command);
  */
 int _mmcamcorder_video_handle_eos(MMHandleType handle);
 
+/**
+ * This function prepares video recording
+ *
+ * @param[in]  handle          Handle of camcorder context.
+ * @return     This function returns MM_ERROR_NONE on success, or the other values on error.
+ * @remarks
+ */
+int _mmcamcorder_video_prepare_record(MMHandleType handle);
+
 
 #ifdef __cplusplus
 }
index 2514355..1c4fc1d 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-
 #include <mm_error.h>
-#include <mm_ta.h>
-
 #include <mm_attrs_private.h>
+
 #include "mm_camcorder.h"
 #include "mm_camcorder_internal.h"
 
@@ -49,11 +47,7 @@ int mm_camcorder_create(MMHandleType *camcorder, MMCamPreset *info)
 
        _mmcam_dbg_err("");
 
-       MMTA_INIT() ;
-
-       __ta__("_mmcamcorder_create",
        error = _mmcamcorder_create(camcorder, info);
-       );
 
        _mmcam_dbg_err("END");
 
@@ -69,12 +63,7 @@ int mm_camcorder_destroy(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_destroy",
        error = _mmcamcorder_destroy(camcorder);
-       );
-
-       MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
-       MMTA_RELEASE();
 
        _mmcam_dbg_err("END!!!");
 
@@ -90,14 +79,11 @@ int mm_camcorder_realize(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
-               __ta__("_mmcamcorder_realize",
-               error = _mmcamcorder_realize(camcorder);
-               );
-       } else {
-               /* After sending command, this function just return immediately. */
-               error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_REALIZE);
-       }
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
+       error = _mmcamcorder_realize(camcorder);
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -113,14 +99,11 @@ int mm_camcorder_unrealize(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
-               __ta__("_mmcamcorder_unrealize",
-               error = _mmcamcorder_unrealize(camcorder);
-               );
-       } else {
-               /* After sending command, this function just return immediately. */
-               error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_UNREALIZE);
-       }
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
+       error = _mmcamcorder_unrealize(camcorder);
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -136,14 +119,11 @@ int mm_camcorder_start(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
-               __ta__("_mmcamcorder_start",
-               error = _mmcamcorder_start(camcorder);
-               );
-       } else {
-               /* After sending command, this function just return immediately. */
-               error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_START);
-       }
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
+       error = _mmcamcorder_start(camcorder);
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -159,14 +139,11 @@ int mm_camcorder_stop(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
-               __ta__("_mmcamcorder_stop",
-               error = _mmcamcorder_stop(camcorder);
-               );
-       } else {
-               /* After sending command, this function just return immediately. */
-               error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_STOP);
-       }
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
+       error = _mmcamcorder_stop(camcorder);
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -182,9 +159,11 @@ int mm_camcorder_capture_start(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_capture_start",
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
        error = _mmcamcorder_capture_start(camcorder);
-       );
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -200,9 +179,11 @@ int mm_camcorder_capture_stop(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_capture_stop",
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
        error = _mmcamcorder_capture_stop(camcorder);
-       );
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -218,9 +199,11 @@ int mm_camcorder_record(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_record",
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
        error = _mmcamcorder_record(camcorder);
-       );
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -236,9 +219,11 @@ int mm_camcorder_pause(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_pause",
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
        error = _mmcamcorder_pause(camcorder);
-       );
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -254,16 +239,11 @@ int mm_camcorder_commit(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       MMTA_ACUM_ITEM_BEGIN("Real Commit Time", 0);
+       _MMCAMCORDER_LOCK_ASM(camcorder);
 
-       if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
-               __ta__("_mmcamcorder_stop",
-               error = _mmcamcorder_commit(camcorder);
-               );
-       } else {
-               /* After sending command, this function just return immediately. */
-               error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_COMMIT);
-       }
+       error = _mmcamcorder_commit(camcorder);
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -279,9 +259,11 @@ int mm_camcorder_cancel(MMHandleType camcorder)
 
        _mmcam_dbg_err("");
 
-       __ta__("_mmcamcorder_cancel",
+       _MMCAMCORDER_LOCK_ASM(camcorder);
+
        error = _mmcamcorder_cancel(camcorder);
-       );
+
+       _MMCAMCORDER_UNLOCK_ASM(camcorder);
 
        _mmcam_dbg_err("END");
 
@@ -291,49 +273,33 @@ int mm_camcorder_cancel(MMHandleType camcorder)
 
 int mm_camcorder_set_message_callback(MMHandleType  camcorder, MMMessageCallback callback, void *user_data)
 {
-       int error = MM_ERROR_NONE;
-
        mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
 
-       error = _mmcamcorder_set_message_callback(camcorder, callback, user_data);
-
-       return error;
+       return _mmcamcorder_set_message_callback(camcorder, callback, user_data);
 }
 
 
 int mm_camcorder_set_video_stream_callback(MMHandleType camcorder, mm_camcorder_video_stream_callback callback, void* user_data)
 {
-       int error = MM_ERROR_NONE;
-
        mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
 
-       error = _mmcamcorder_set_video_stream_callback(camcorder, callback, user_data);
-
-       return error;
+       return _mmcamcorder_set_video_stream_callback(camcorder, callback, user_data);
 }
 
 
 int mm_camcorder_set_audio_stream_callback(MMHandleType camcorder, mm_camcorder_audio_stream_callback callback, void* user_data)
 {
-       int error = MM_ERROR_NONE;
-
        mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
 
-       error = _mmcamcorder_set_audio_stream_callback(camcorder, callback, user_data);
-
-       return error;
+       return _mmcamcorder_set_audio_stream_callback(camcorder, callback, user_data);
 }
 
 
 int mm_camcorder_set_video_capture_callback(MMHandleType camcorder, mm_camcorder_video_capture_callback callback, void* user_data)
 {
-       int error = MM_ERROR_NONE;
-
        mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
 
-       error = _mmcamcorder_set_video_capture_callback(camcorder, callback, user_data);
-
-       return error;
+       return _mmcamcorder_set_video_capture_callback(camcorder, callback, user_data);
 }
 
 
@@ -378,7 +344,7 @@ int mm_camcorder_set_attributes(MMHandleType camcorder,  char **err_attr_name, c
        va_start (var_args, attribute_name);
        ret = _mmcamcorder_set_attributes(camcorder, err_attr_name, attribute_name, var_args);
        va_end (var_args);
-       
+
        return ret;
 }
 
@@ -425,4 +391,3 @@ int mm_camcorder_stop_focusing(MMHandleType camcorder)
 
        return error;
 }
-
index 816fcb5..eb601a0 100644 (file)
@@ -24,6 +24,7 @@
 |  INCLUDE FILES                                                                       |
 =======================================================================================*/
 #include "mm_camcorder_internal.h"
+#include "mm_camcorder_gstcommon.h"
 
 #include <gst/video/colorbalance.h>
 #include <gst/video/cameracontrol.h>
 /*---------------------------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS for internal                                          |
 ---------------------------------------------------------------------------------------*/
-int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8,
-              MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE};
-
-int visible_values[] = { 0, 1 };       /*0: off, 1:on*/
-
-int strobe_mode[] = {MM_CAMCORDER_STROBE_MODE_OFF,
-                    MM_CAMCORDER_STROBE_MODE_ON,
-                    MM_CAMCORDER_STROBE_MODE_AUTO,
-                    MM_CAMCORDER_STROBE_MODE_REDEYE_REDUCTION,
-                    MM_CAMCORDER_STROBE_MODE_SLOW_SYNC,
-                    MM_CAMCORDER_STROBE_MODE_FRONT_CURTAIN,
-                    MM_CAMCORDER_STROBE_MODE_REAR_CURTAIN,
-                    MM_CAMCORDER_STROBE_MODE_PERMANENT};
-
-int tag_enable_values[] = { 0, 1 };
-
-int tag_orientation_values[] =
-{
-       1,      /*The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
-       2,      /*the 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
-       3,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
-       4,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
-       5,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
-       6,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
-       7,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
-       8,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
-};
-
-
-/* basic attributes' info */
-mm_cam_attr_construct_info cam_attrs_const_info[] ={
-       //0
-       {
-               MM_CAM_MODE,                        /* ID */
-               "mode",                             /* Name */
-               MMF_VALUE_TYPE_INT,                 /* Type */
-               MM_ATTRS_FLAG_RW,                   /* Flag */
-               {(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE},     /* Default value */
-               MM_ATTRS_VALID_TYPE_INT_RANGE,      /* Validity type */
-               MM_CAMCORDER_MODE_VIDEO_CAPTURE,    /* Validity val1 (min, *array,...) */
-               MM_CAMCORDER_MODE_AUDIO,            /* Validity val2 (max, count, ...) */
-               NULL,                               /* Runtime setting function of the attribute */
-       },
-       // 1
-       {
-               MM_CAM_AUDIO_DEVICE,
-               "audio-device",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_AUDIO_DEVICE_MIC},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               MM_AUDIO_DEVICE_NUM-1,
-               NULL,
-       },
-       // 2
-       {
-               MM_CAM_CAMERA_DEVICE_COUNT,
-               "camera-device-count",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_VIDEO_DEVICE_NUM},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_VIDEO_DEVICE_NONE,
-               MM_VIDEO_DEVICE_NUM,
-               NULL,
-       },
-       // 3
-       {
-               MM_CAM_AUDIO_ENCODER,
-               "audio-encoder",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_AUDIO_CODEC_AMR},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)NULL,
-               0,
-               NULL,
-       },
-       // 4
-       {
-               MM_CAM_VIDEO_ENCODER,
-               "video-encoder",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_VIDEO_CODEC_MPEG4},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)NULL,
-               0,
-               NULL,
-       },
-       //5
-       {
-               MM_CAM_IMAGE_ENCODER,
-               "image-encoder",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_IMAGE_CODEC_JPEG},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)NULL,
-               0,
-               NULL,
-       },
-       //6
-       {
-               MM_CAM_FILE_FORMAT,
-               "file-format",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_FILE_FORMAT_MP4},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)NULL,
-               0,
-               NULL,
-       },
-       //7
-       {
-               MM_CAM_CAMERA_DEVICE_NAME,
-               "camera-device-name",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //8
-       {
-               MM_CAM_AUDIO_SAMPLERATE,
-               "audio-samplerate",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)8000},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //9
-       {
-               MM_CAM_AUDIO_FORMAT,
-               "audio-format",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)depth,
-               ARRAY_SIZE(depth),
-               NULL,
-       },
-       //10
-       {
-               MM_CAM_AUDIO_CHANNEL,
-               "audio-channel",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)2},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               1,
-               2,
-               NULL,
-       },
-       //11
-       {
-               MM_CAM_AUDIO_VOLUME,
-               "audio-volume",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               0,
-               10.0,
-               _mmcamcorder_commit_audio_volume,
-       },
-       //12
-       {
-               MM_CAM_AUDIO_INPUT_ROUTE,
-               "audio-input-route",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_AUDIOROUTE_USE_EXTERNAL_SETTING,
-               MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY,
-               _mmcamcorder_commit_audio_input_route,
-       },
-       //13
-       {
-               MM_CAM_FILTER_SCENE_MODE,
-               "filter-scene-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_filter_scene_mode,
-       },
-       //14
-       {
-               MM_CAM_FILTER_BRIGHTNESS,
-               "filter-brightness",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_filter,
-       },
-       //15
-       {
-               MM_CAM_FILTER_CONTRAST,
-               "filter-contrast",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_filter,
-       },
-       //16
-       {
-               MM_CAM_FILTER_WB,
-               "filter-wb",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_filter,
-       },
-       //17
-       {
-               MM_CAM_FILTER_COLOR_TONE,
-               "filter-color-tone",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_filter,
-       },
-       //18
-       {
-               MM_CAM_FILTER_SATURATION,
-               "filter-saturation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_filter,
-       },
-       //19
-       {
-               MM_CAM_FILTER_HUE,
-               "filter-hue",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_filter,
-       },
-       //20
-       {
-               MM_CAM_FILTER_SHARPNESS,
-               "filter-sharpness",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_filter,
-       },
-       //21
-       {
-               MM_CAM_CAMERA_FORMAT,
-               "camera-format",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_PIXEL_FORMAT_YUYV},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //22
-       {
-               MM_CAM_CAMERA_RECORDING_MOTION_RATE,
-               "camera-recording-motion-rate",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_recording_motion_rate,
-       },
-       //23
-       {
-               MM_CAM_CAMERA_FPS,
-               "camera-fps",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)30},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_fps,
-       },
-       //24
-       {
-               MM_CAM_CAMERA_WIDTH,
-               "camera-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_width,
-       },
-       //25
-       {
-               MM_CAM_CAMERA_HEIGHT,
-               "camera-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_height,
-       },
-       //26
-       {
-               MM_CAM_CAMERA_DIGITAL_ZOOM,
-               "camera-digital-zoom",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)10},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_camera_zoom,
-       },
-       //27
-       {
-               MM_CAM_CAMERA_OPTICAL_ZOOM,
-               "camera-optical-zoom",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_camera_zoom,
-       },
-       //28
-       {
-               MM_CAM_CAMERA_FOCUS_MODE,
-               "camera-focus-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_CAMCORDER_FOCUS_MODE_NONE},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_focus_mode,
-       },
-       //29
-       {
-               MM_CAM_CAMERA_AF_SCAN_RANGE,
-               "camera-af-scan-range",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_af_scan_range,
-       },
-       //30
-       {
-               MM_CAM_CAMERA_EXPOSURE_MODE,
-               "camera-exposure-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //31
-       {
-               MM_CAM_CAMERA_EXPOSURE_VALUE,
-               "camera-exposure-value",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //32
-       {
-               MM_CAM_CAMERA_F_NUMBER,
-               "camera-f-number",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //33
-       {
-               MM_CAM_CAMERA_SHUTTER_SPEED,
-               "camera-shutter-speed",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //34
-       {
-               MM_CAM_CAMERA_ISO,
-               "camera-iso",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //35
-       {
-               MM_CAM_CAMERA_WDR,
-               "camera-wdr",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_wdr,
-       },
-       //36
-       {
-               MM_CAM_CAMERA_ANTI_HANDSHAKE,
-               "camera-anti-handshake",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_anti_handshake,
-       },
-       //37
-       {
-               MM_CAM_CAMERA_FPS_AUTO,
-               "camera-fps-auto",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //38
-       {
-               MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING,
-               "camera-hold-af-after-capturing",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               _mmcamcorder_commit_camera_hold_af_after_capturing,
-       },
-       //39
-       {
-               MM_CAM_CAMERA_DELAY_ATTR_SETTING,
-               "camera-delay-attr-setting",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //40
-       {
-               MM_CAM_AUDIO_ENCODER_BITRATE,
-               "audio-encoder-bitrate",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //41
-       {
-               MM_CAM_VIDEO_ENCODER_BITRATE,
-               "video-encoder-bitrate",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //42
-       {
-               MM_CAM_IMAGE_ENCODER_QUALITY,
-               "image-encoder-quality",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)95},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_image_encoder_quality,
-       },
-       //43
-       {
-               MM_CAM_CAPTURE_FORMAT,
-               "capture-format",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_PIXEL_FORMAT_ENCODED},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //44
-       {
-               MM_CAM_CAPTURE_WIDTH,
-               "capture-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1600},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_capture_width ,
-       },
-       //45
-       {
-               MM_CAM_CAPTURE_HEIGHT,
-               "capture-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1200},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_capture_height,
-       },
-       //46
-       {
-               MM_CAM_CAPTURE_COUNT,
-               "capture-count",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_capture_count,
-       },
-       //47
-       {
-               MM_CAM_CAPTURE_INTERVAL,
-               "capture-interval",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //48
-       {
-               MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
-               "capture-break-cont-shot",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               _mmcamcorder_commit_capture_break_cont_shot,
-       },
-       //49
-       {
-               MM_CAM_DISPLAY_HANDLE,
-               "display-handle",
-               MMF_VALUE_TYPE_DATA,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               _mmcamcorder_commit_display_handle,
-       },
-       //50
-       {
-               MM_CAM_DISPLAY_DEVICE,
-               "display-device",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_DISPLAY_DEVICE_MAINLCD},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //51
-       {
-               MM_CAM_DISPLAY_SURFACE,
-               "display-surface",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_DISPLAY_SURFACE_X},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //52
-       {
-               MM_CAM_DISPLAY_RECT_X,
-               "display-rect-x",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_display_rect,
-       },
-       //53
-       {
-               MM_CAM_DISPLAY_RECT_Y,
-               "display-rect-y",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_display_rect,
-       },
-       //54
-       {
-               MM_CAM_DISPLAY_RECT_WIDTH,
-               "display-rect-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_display_rect,
-       },
-       //55
-       {
-               MM_CAM_DISPLAY_RECT_HEIGHT,
-               "display-rect-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_display_rect,
-       },
-       //56
-       {
-               MM_CAM_DISPLAY_SOURCE_X,
-               "display-src-x",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //57
-       {
-               MM_CAM_DISPLAY_SOURCE_Y,
-               "display-src-y",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //58
-       {
-               MM_CAM_DISPLAY_SOURCE_WIDTH,
-               "display-src-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //59
-       {
-               MM_CAM_DISPLAY_SOURCE_HEIGHT,
-               "display-src-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //60
-       {
-               MM_CAM_DISPLAY_ROTATION,
-               "display-rotation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_DISPLAY_ROTATION_NONE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_DISPLAY_ROTATION_NONE,
-               MM_DISPLAY_ROTATION_270,
-               _mmcamcorder_commit_display_rotation,
-       },
-       //61
-       {
-               MM_CAM_DISPLAY_VISIBLE,
-               "display-visible",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)visible_values,
-               ARRAY_SIZE(visible_values),
-               _mmcamcorder_commit_display_visible,
-       },
-       //62
-       {
-               MM_CAM_DISPLAY_SCALE,
-               "display-scale",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_DISPLAY_SCALE_DEFAULT,
-               MM_DISPLAY_SCALE_TRIPLE_LENGTH,
-               _mmcamcorder_commit_display_scale,
-       },
-       //63
-       {
-               MM_CAM_DISPLAY_GEOMETRY_METHOD,
-               "display-geometry-method",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_DISPLAY_METHOD_LETTER_BOX,
-               MM_DISPLAY_METHOD_CUSTOM_ROI,
-               _mmcamcorder_commit_display_geometry_method,
-       },
-       //64
-       {
-               MM_CAM_TARGET_FILENAME,
-               "target-filename",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)"/tmp/CAM-NONAME"},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               _mmcamcorder_commit_target_filename,
-       },
-       //65
-       {
-               MM_CAM_TARGET_MAX_SIZE,
-               "target-max-size",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //66
-       {
-               MM_CAM_TARGET_TIME_LIMIT,
-               "target-time-limit",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               NULL,
-       },
-       //67
-       {
-               MM_CAM_TAG_ENABLE,
-               "tag-enable",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //68
-       {
-               MM_CAM_TAG_IMAGE_DESCRIPTION,
-               "tag-image-description",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //69
-       {
-               MM_CAM_TAG_ORIENTATION,
-               "tag-orientation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)1},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               (int)tag_orientation_values,
-               ARRAY_SIZE(tag_orientation_values),
-               NULL,
-       },
-       //70
-       {
-               MM_CAM_TAG_SOFTWARE,
-               "tag-software",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //71
-       {
-               MM_CAM_TAG_LATITUDE,
-               "tag-latitude",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               -360,
-               360,
-               NULL,
-       },
-       //72
-       {
-               MM_CAM_TAG_LONGITUDE,
-               "tag-longitude",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               -360,
-               360,
-               NULL,
-       },
-       //73
-       {
-               MM_CAM_TAG_ALTITUDE,
-               "tag-altitude",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               -999999,
-               999999,
-               NULL,
-       },
-       //74
-       {
-               MM_CAM_STROBE_CONTROL,
-               "strobe-control",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_strobe,
-       },
-       //75
-       {
-               MM_CAM_STROBE_CAPABILITIES,
-               "strobe-capabilities",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_strobe,
-       },
-       //76
-       {
-               MM_CAM_STROBE_MODE,
-               "strobe-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_strobe,
-       },
-       //77
-       {
-               MM_CAM_DETECT_MODE,
-               "detect-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_detect,
-       },
-       //78
-       {
-               MM_CAM_DETECT_NUMBER,
-               "detect-number",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_detect,
-       },
-       //79
-       {
-               MM_CAM_DETECT_FOCUS_SELECT,
-               "detect-focus-select",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_detect,
-       },
-       //80
-       {
-               MM_CAM_DETECT_SELECT_NUMBER,
-               "detect-select-number",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               _mmcamcorder_commit_detect,
-       },
-       //81
-       {
-               MM_CAM_DETECT_STATUS,
-               "detect-status",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_detect,
-       },
-       //82
-       {
-               MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
-               "capture-zero-systemlag",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //83
-       {
-               MM_CAM_CAMERA_AF_TOUCH_X,
-               "camera-af-touch-x",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_af_touch_area,
-       },
-       //84
-       {
-               MM_CAM_CAMERA_AF_TOUCH_Y,
-               "camera-af-touch-y",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_af_touch_area,
-       },
-       //85
-       {
-               MM_CAM_CAMERA_AF_TOUCH_WIDTH,
-               "camera-af-touch-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_af_touch_area,
-       },
-       //86
-       {
-               MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
-               "camera-af-touch-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_af_touch_area,
-       },
-       //87
-       {
-               MM_CAM_CAMERA_FOCAL_LENGTH,
-               "camera-focal-length",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
-               0,
-               1000,
-               _mmcamcorder_commit_camera_capture_mode,
-       },
-       //88
-       {
-               MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
-               "recommend-preview-format-for-capture",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_PIXEL_FORMAT_YUYV},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_PIXEL_FORMAT_NV12,
-               MM_PIXEL_FORMAT_ITLV_JPEG_UYVY,
-               NULL,
-       },
-       //89
-       {
-               MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
-               "recommend-preview-format-for-recording",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_PIXEL_FORMAT_NV12},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_PIXEL_FORMAT_NV12,
-               MM_PIXEL_FORMAT_ITLV_JPEG_UYVY,
-               NULL,
-       },
-       //90
-       {
-               MM_CAM_CAPTURE_THUMBNAIL,
-               "capture-thumbnail",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)TRUE},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //91
-       {
-               MM_CAM_TAG_GPS_ENABLE,
-               "tag-gps-enable",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)TRUE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //92
-       {
-               MM_CAM_TAG_GPS_TIME_STAMP,
-               "tag-gps-time-stamp",
-               MMF_VALUE_TYPE_DOUBLE,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //93
-       {
-               MM_CAM_TAG_GPS_DATE_STAMP,
-               "tag-gps-date-stamp",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //94
-       {
-               MM_CAM_TAG_GPS_PROCESSING_METHOD,
-               "tag-gps-processing-method",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_RW,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //95
-       {
-               MM_CAM_CAMERA_ROTATION,
-               "camera-rotation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_VIDEO_INPUT_ROTATION_NONE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_VIDEO_INPUT_ROTATION_NONE,
-               MM_VIDEO_INPUT_ROTATION_270,
-               _mmcamcorder_commit_camera_rotate,
-       },
-       //96
-       {
-               MM_CAM_ENABLE_CONVERTED_STREAM_CALLBACK,
-               "enable-converted-stream-callback",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               NULL,
-       },
-       //97
-       {
-               MM_CAM_CAPTURED_SCREENNAIL,
-               "captured-screennail",
-               MMF_VALUE_TYPE_DATA,
-               MM_ATTRS_FLAG_READABLE,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //98
-       {
-               MM_CAM_CAPTURE_SOUND_ENABLE,
-               "capture-sound-enable",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)TRUE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               1,
-               _mmcamcorder_commit_capture_sound_enable,
-       },
-       //99
-       {
-               MM_CAM_RECOMMEND_DISPLAY_ROTATION,
-               "recommend-display-rotation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_DISPLAY_ROTATION_270},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_DISPLAY_ROTATION_NONE,
-               MM_DISPLAY_ROTATION_270,
-               NULL,
-       },
-       //100
-       {
-               MM_CAM_CAMERA_FLIP,
-               "camera-flip",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_FLIP_NONE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_FLIP_NONE,
-               MM_FLIP_BOTH,
-               _mmcamcorder_commit_camera_flip,
-       },
-       //101
-       {
-               MM_CAM_CAMERA_HDR_CAPTURE,
-               "camera-hdr-capture",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_hdr_capture,
-       },
-       //102
-       {
-               MM_CAM_DISPLAY_MODE,
-               "display-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_DISPLAY_MODE_DEFAULT},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_display_mode,
-       },
-       //103
-       {
-               MM_CAM_CAMERA_FACE_ZOOM_X,
-               "camera-face-zoom-x",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_face_zoom,
-       },
-       //104
-       {
-               MM_CAM_CAMERA_FACE_ZOOM_Y,
-               "camera-face-zoom-y",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               _MMCAMCORDER_MAX_INT,
-               _mmcamcorder_commit_camera_face_zoom,
-       },
-       //105
-       {
-               MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
-               "camera-face-zoom-level",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)0},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               0,
-               -1,
-               NULL,
-       },
-       //106
-       {
-               MM_CAM_CAMERA_FACE_ZOOM_MODE,
-               "camera-face-zoom-mode",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_face_zoom,
-       },
-       //107
-       {
-               MM_CAM_AUDIO_DISABLE,
-               "audio-disable",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)FALSE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               FALSE,
-               TRUE,
-               _mmcamcorder_commit_audio_disable,
-       },
-       //108
-       {
-               MM_CAM_RECOMMEND_CAMERA_WIDTH,
-               "recommend-camera-width",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //109
-       {
-               MM_CAM_RECOMMEND_CAMERA_HEIGHT,
-               "recommend-camera-height",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               NULL,
-       },
-       //110
-       {
-               MM_CAM_CAPTURED_EXIF_RAW_DATA,
-               "captured-exif-raw-data",
-               MMF_VALUE_TYPE_DATA,
-               MM_ATTRS_FLAG_READABLE,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //111
-       {
-               MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
-               "display-evas-surface-sink",
-               MMF_VALUE_TYPE_STRING,
-               MM_ATTRS_FLAG_READABLE,
-               {(void*)NULL},
-               MM_ATTRS_VALID_TYPE_NONE,
-               0,
-               0,
-               NULL,
-       },
-       //112
-       {
-               MM_CAM_DISPLAY_EVAS_DO_SCALING,
-               "display-evas-do-scaling",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)TRUE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               FALSE,
-               TRUE,
-               _mmcamcorder_commit_display_evas_do_scaling,
-       },
-       //113
-       {
-               MM_CAM_CAMERA_FACING_DIRECTION,
-               "camera-facing-direction",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR,
-               MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT,
-               NULL,
-       },
-       //114
-       {
-               MM_CAM_DISPLAY_FLIP,
-               "display-flip",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_FLIP_NONE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_FLIP_NONE,
-               MM_FLIP_BOTH,
-               _mmcamcorder_commit_display_flip,
-       },
-       //115
-       {
-               MM_CAM_CAMERA_VIDEO_STABILIZATION,
-               "camera-video-stabilization",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_CAMCORDER_VIDEO_STABILIZATION_OFF},
-               MM_ATTRS_VALID_TYPE_INT_ARRAY,
-               0,
-               0,
-               _mmcamcorder_commit_camera_video_stabilization,
-       },
-       //118
-       {
-               MM_CAM_TAG_VIDEO_ORIENTATION,
-               "tag-video-orientation",
-               MMF_VALUE_TYPE_INT,
-               MM_ATTRS_FLAG_RW,
-               {(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
-               MM_ATTRS_VALID_TYPE_INT_RANGE,
-               MM_CAMCORDER_TAG_VIDEO_ORT_NONE,
-               MM_CAMCORDER_TAG_VIDEO_ORT_270,
-               NULL,
-       }
-};
-
 
 /*-----------------------------------------------------------------------
 |    LOCAL VARIABLE DEFINITIONS for internal                           |
@@ -1493,6 +57,9 @@ static int readonly_attributes[] = {
        MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
        MM_CAM_CAPTURED_SCREENNAIL,
        MM_CAM_RECOMMEND_DISPLAY_ROTATION,
+       MM_CAM_SUPPORT_ZSL_CAPTURE,
+       MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+       MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB
 };
 
 /*-----------------------------------------------------------------------
@@ -1500,7 +67,6 @@ static int readonly_attributes[] = {
 -----------------------------------------------------------------------*/
 /* STATIC INTERNAL FUNCTION */
 static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height);
-static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height);
 static int  __mmcamcorder_set_conf_to_valid_info(MMHandleType handle);
 static int  __mmcamcorder_release_conf_valid_info(MMHandleType handle);
 static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx);
@@ -1517,34 +83,1350 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info )
 {
        _mmcam_dbg_log( "" );
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        MMHandleType attrs = 0;
        mmf_attrs_construct_info_t *attrs_const_info = NULL;
-       int attr_count = 0;
-       int idx;
+       unsigned int attr_count = 0;
+       unsigned int idx;
+
+       static int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE};
+       static int flip_list[] = { MM_FLIP_NONE };
+       static int rotation_list[] = { MM_VIDEO_INPUT_ROTATION_NONE };
+       static int visible_values[] = { 0, 1 }; /*0: off, 1:on*/
+       static int tag_orientation_values[] =
+               {
+                       1,      /*The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
+                       2,      /*the 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
+                       3,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
+                       4,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
+                       5,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
+                       6,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
+                       7,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
+                       8,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
+               };
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return 0;
+       }
 
        /* Create attribute constructor */
        _mmcam_dbg_log("start");
 
        /* alloc 'mmf_attrs_construct_info_t' */
-       attr_count = ARRAY_SIZE(cam_attrs_const_info);
+       attr_count = MM_CAM_ATTRIBUTE_NUM;
        attrs_const_info = malloc(attr_count * sizeof(mmf_attrs_construct_info_t));
-
        if (!attrs_const_info) {
                _mmcam_dbg_err("Fail to alloc constructor.");
                return 0;
        }
 
+       /* alloc default attribute info */
+       hcamcorder->cam_attrs_const_info = (mm_cam_attr_construct_info *)malloc(sizeof(mm_cam_attr_construct_info) * attr_count);
+       if (hcamcorder->cam_attrs_const_info == NULL) {
+               _mmcam_dbg_err("failed to alloc default attribute info");
+               free(attrs_const_info);
+               attrs_const_info = NULL;
+               return 0;
+       }
+
+       /* basic attributes' info */
+       mm_cam_attr_construct_info temp_info[] = {
+               //0
+               {
+                       MM_CAM_MODE,                        /* ID */
+                       "mode",                             /* Name */
+                       MMF_VALUE_TYPE_INT,                 /* Type */
+                       MM_ATTRS_FLAG_RW,                   /* Flag */
+                       {(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE},     /* Default value */
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,      /* Validity type */
+                       {MM_CAMCORDER_MODE_VIDEO_CAPTURE},    /* Validity val1 (min, *array,...) */
+                       {MM_CAMCORDER_MODE_AUDIO},            /* Validity val2 (max, count, ...) */
+                       NULL,                               /* Runtime setting function of the attribute */
+               },
+               {
+                       MM_CAM_AUDIO_DEVICE,
+                       "audio-device",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_AUDIO_DEVICE_MIC},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {MM_AUDIO_DEVICE_NUM-1},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_DEVICE_COUNT,
+                       "camera-device-count",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_VIDEO_DEVICE_NUM},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_VIDEO_DEVICE_NONE},
+                       {MM_VIDEO_DEVICE_NUM},
+                       NULL,
+               },
+               {
+                       MM_CAM_AUDIO_ENCODER,
+                       "audio-encoder",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_AUDIO_CODEC_AMR},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {NULL},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_VIDEO_ENCODER,
+                       "video-encoder",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_VIDEO_CODEC_MPEG4},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {NULL},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_IMAGE_ENCODER,
+                       "image-encoder",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_IMAGE_CODEC_JPEG},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {NULL},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_FILE_FORMAT,
+                       "file-format",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_FILE_FORMAT_MP4},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {NULL},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_DEVICE_NAME,
+                       "camera-device-name",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_AUDIO_SAMPLERATE,
+                       "audio-samplerate",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)8000},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_AUDIO_FORMAT,
+                       "audio-format",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {depth},
+                       {ARRAY_SIZE(depth)},
+                       NULL,
+               },
+               //10
+               {
+                       MM_CAM_AUDIO_CHANNEL,
+                       "audio-channel",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)2},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {1},
+                       {2},
+                       NULL,
+               },
+               {
+                       MM_CAM_AUDIO_VOLUME,
+                       "audio-volume",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {0},
+                       {10.0},
+                       _mmcamcorder_commit_audio_volume,
+               },
+               {
+                       MM_CAM_AUDIO_INPUT_ROUTE,
+                       "audio-input-route",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
+                       {MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY},
+                       _mmcamcorder_commit_audio_input_route,
+               },
+               {
+                       MM_CAM_FILTER_SCENE_MODE,
+                       "filter-scene-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_filter_scene_mode,
+               },
+               {
+                       MM_CAM_FILTER_BRIGHTNESS,
+                       "filter-brightness",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_FILTER_CONTRAST,
+                       "filter-contrast",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_FILTER_WB,
+                       "filter-wb",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_FILTER_COLOR_TONE,
+                       "filter-color-tone",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_FILTER_SATURATION,
+                       "filter-saturation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_FILTER_HUE,
+                       "filter-hue",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_filter,
+               },
+               //20
+               {
+                       MM_CAM_FILTER_SHARPNESS,
+                       "filter-sharpness",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_filter,
+               },
+               {
+                       MM_CAM_CAMERA_FORMAT,
+                       "camera-format",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_PIXEL_FORMAT_YUYV},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_RECORDING_MOTION_RATE,
+                       "camera-recording-motion-rate",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_camera_recording_motion_rate,
+               },
+               {
+                       MM_CAM_CAMERA_FPS,
+                       "camera-fps",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)30},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_fps,
+               },
+               {
+                       MM_CAM_CAMERA_WIDTH,
+                       "camera-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_width,
+               },
+               {
+                       MM_CAM_CAMERA_HEIGHT,
+                       "camera-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_height,
+               },
+               {
+                       MM_CAM_CAMERA_DIGITAL_ZOOM,
+                       "camera-digital-zoom",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)10},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_camera_zoom,
+               },
+               {
+                       MM_CAM_CAMERA_OPTICAL_ZOOM,
+                       "camera-optical-zoom",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_camera_zoom,
+               },
+               {
+                       MM_CAM_CAMERA_FOCUS_MODE,
+                       "camera-focus-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_CAMCORDER_FOCUS_MODE_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_focus_mode,
+               },
+               {
+                       MM_CAM_CAMERA_AF_SCAN_RANGE,
+                       "camera-af-scan-range",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_af_scan_range,
+               },
+               //30
+               {
+                       MM_CAM_CAMERA_EXPOSURE_MODE,
+                       "camera-exposure-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_CAMERA_EXPOSURE_VALUE,
+                       "camera-exposure-value",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_CAMERA_F_NUMBER,
+                       "camera-f-number",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_CAMERA_SHUTTER_SPEED,
+                       "camera-shutter-speed",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_CAMERA_ISO,
+                       "camera-iso",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_CAMERA_WDR,
+                       "camera-wdr",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_wdr,
+               },
+               {
+                       MM_CAM_CAMERA_ANTI_HANDSHAKE,
+                       "camera-anti-handshake",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_anti_handshake,
+               },
+               {
+                       MM_CAM_CAMERA_FPS_AUTO,
+                       "camera-fps-auto",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_DELAY_ATTR_SETTING,
+                       "camera-delay-attr-setting",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       NULL,
+               },
+               {
+                       MM_CAM_AUDIO_ENCODER_BITRATE,
+                       "audio-encoder-bitrate",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               // 40
+               {
+                       MM_CAM_VIDEO_ENCODER_BITRATE,
+                       "video-encoder-bitrate",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_IMAGE_ENCODER_QUALITY,
+                       "image-encoder-quality",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)95},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_image_encoder_quality,
+               },
+               {
+                       MM_CAM_CAPTURE_FORMAT,
+                       "capture-format",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_PIXEL_FORMAT_ENCODED},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAPTURE_WIDTH,
+                       "capture-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1600},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_capture_width ,
+               },
+               {
+                       MM_CAM_CAPTURE_HEIGHT,
+                       "capture-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1200},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_capture_height,
+               },
+               {
+                       MM_CAM_CAPTURE_COUNT,
+                       "capture-count",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_capture_count,
+               },
+               {
+                       MM_CAM_CAPTURE_INTERVAL,
+                       "capture-interval",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
+                       "capture-break-cont-shot",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       _mmcamcorder_commit_capture_break_cont_shot,
+               },
+               {
+                       MM_CAM_DISPLAY_HANDLE,
+                       "display-handle",
+                       MMF_VALUE_TYPE_DATA,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_display_handle,
+               },
+               {
+                       MM_CAM_DISPLAY_DEVICE,
+                       "display-device",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_DISPLAY_DEVICE_MAINLCD},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               // 50
+               {
+                       MM_CAM_DISPLAY_SURFACE,
+                       "display-surface",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_DISPLAY_SURFACE_X},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_RECT_X,
+                       "display-rect-x",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_display_rect,
+               },
+               {
+                       MM_CAM_DISPLAY_RECT_Y,
+                       "display-rect-y",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_display_rect,
+               },
+               {
+                       MM_CAM_DISPLAY_RECT_WIDTH,
+                       "display-rect-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_display_rect,
+               },
+               {
+                       MM_CAM_DISPLAY_RECT_HEIGHT,
+                       "display-rect-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_display_rect,
+               },
+               {
+                       MM_CAM_DISPLAY_SOURCE_X,
+                       "display-src-x",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_SOURCE_Y,
+                       "display-src-y",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_SOURCE_WIDTH,
+                       "display-src-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_SOURCE_HEIGHT,
+                       "display-src-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_ROTATION,
+                       "display-rotation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_DISPLAY_ROTATION_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_DISPLAY_ROTATION_NONE},
+                       {MM_DISPLAY_ROTATION_270},
+                       _mmcamcorder_commit_display_rotation,
+               },
+               { // 60
+                       MM_CAM_DISPLAY_VISIBLE,
+                       "display-visible",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {visible_values},
+                       {ARRAY_SIZE(visible_values)},
+                       _mmcamcorder_commit_display_visible,
+               },
+               {
+                       MM_CAM_DISPLAY_SCALE,
+                       "display-scale",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_DISPLAY_SCALE_DEFAULT},
+                       {MM_DISPLAY_SCALE_TRIPLE_LENGTH},
+                       _mmcamcorder_commit_display_scale,
+               },
+               {
+                       MM_CAM_DISPLAY_GEOMETRY_METHOD,
+                       "display-geometry-method",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_DISPLAY_METHOD_LETTER_BOX},
+                       {MM_DISPLAY_METHOD_CUSTOM_ROI},
+                       _mmcamcorder_commit_display_geometry_method,
+               },
+               {
+                       MM_CAM_TARGET_FILENAME,
+                       "target-filename",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_target_filename,
+               },
+               {
+                       MM_CAM_TARGET_MAX_SIZE,
+                       "target-max-size",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_TARGET_TIME_LIMIT,
+                       "target-time-limit",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_ENABLE,
+                       "tag-enable",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_IMAGE_DESCRIPTION,
+                       "tag-image-description",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_ORIENTATION,
+                       "tag-orientation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)1},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {tag_orientation_values},
+                       {ARRAY_SIZE(tag_orientation_values)},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_SOFTWARE,
+                       "tag-software",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               //70
+               {
+                       MM_CAM_TAG_LATITUDE,
+                       "tag-latitude",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {-360},
+                       {360},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_LONGITUDE,
+                       "tag-longitude",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {-360},
+                       {360},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_ALTITUDE,
+                       "tag-altitude",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {-999999},
+                       {999999},
+                       NULL,
+               },
+               {
+                       MM_CAM_STROBE_CONTROL,
+                       "strobe-control",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_strobe,
+               },
+               {
+                       MM_CAM_STROBE_CAPABILITIES,
+                       "strobe-capabilities",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_strobe,
+               },
+               {
+                       MM_CAM_STROBE_MODE,
+                       "strobe-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_strobe,
+               },
+               {
+                       MM_CAM_DETECT_MODE,
+                       "detect-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_detect,
+               },
+               {
+                       MM_CAM_DETECT_NUMBER,
+                       "detect-number",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_detect,
+               },
+               {
+                       MM_CAM_DETECT_FOCUS_SELECT,
+                       "detect-focus-select",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_detect,
+               },
+               {
+                       MM_CAM_DETECT_SELECT_NUMBER,
+                       "detect-select-number",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {-1},
+                       _mmcamcorder_commit_detect,
+               },
+               //80
+               {
+                       MM_CAM_DETECT_STATUS,
+                       "detect-status",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_detect,
+               },
+               {
+                       MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
+                       "capture-zero-systemlag",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_AF_TOUCH_X,
+                       "camera-af-touch-x",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_camera_af_touch_area,
+               },
+               {
+                       MM_CAM_CAMERA_AF_TOUCH_Y,
+                       "camera-af-touch-y",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_camera_af_touch_area,
+               },
+               {
+                       MM_CAM_CAMERA_AF_TOUCH_WIDTH,
+                       "camera-af-touch-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_camera_af_touch_area,
+               },
+               {
+                       MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
+                       "camera-af-touch-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {_MMCAMCORDER_MAX_INT},
+                       _mmcamcorder_commit_camera_af_touch_area,
+               },
+               {
+                       MM_CAM_CAMERA_FOCAL_LENGTH,
+                       "camera-focal-length",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {0},
+                       {1000},
+                       _mmcamcorder_commit_camera_capture_mode,
+               },
+               {
+                       MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
+                       "recommend-preview-format-for-capture",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_PIXEL_FORMAT_YUYV},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_PIXEL_FORMAT_NV12},
+                       {(MM_PIXEL_FORMAT_NUM-1)},
+                       NULL,
+               },
+               {
+                       MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
+                       "recommend-preview-format-for-recording",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_PIXEL_FORMAT_NV12},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_PIXEL_FORMAT_NV12},
+                       {(MM_PIXEL_FORMAT_NUM-1)},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_GPS_ENABLE,
+                       "tag-gps-enable",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       NULL,
+               },
+               // 90
+               {
+                       MM_CAM_TAG_GPS_TIME_STAMP,
+                       "tag-gps-time-stamp",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_GPS_DATE_STAMP,
+                       "tag-gps-date-stamp",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_TAG_GPS_PROCESSING_METHOD,
+                       "tag-gps-processing-method",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_ROTATION,
+                       "camera-rotation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_VIDEO_INPUT_ROTATION_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {rotation_list},
+                       {ARRAY_SIZE(rotation_list)},
+                       _mmcamcorder_commit_camera_rotate,
+               },
+               {
+                       MM_CAM_CAPTURED_SCREENNAIL,
+                       "captured-screennail",
+                       MMF_VALUE_TYPE_DATA,
+                       MM_ATTRS_FLAG_READABLE,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAPTURE_SOUND_ENABLE,
+                       "capture-sound-enable",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)TRUE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {0},
+                       {1},
+                       _mmcamcorder_commit_capture_sound_enable,
+               },
+               {
+                       MM_CAM_RECOMMEND_DISPLAY_ROTATION,
+                       "recommend-display-rotation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_DISPLAY_ROTATION_270},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_DISPLAY_ROTATION_NONE},
+                       {MM_DISPLAY_ROTATION_270},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAMERA_FLIP,
+                       "camera-flip",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_FLIP_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {flip_list},
+                       {ARRAY_SIZE(flip_list)},
+                       _mmcamcorder_commit_camera_flip,
+               },
+               {
+                       MM_CAM_CAMERA_HDR_CAPTURE,
+                       "camera-hdr-capture",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_hdr_capture,
+               },
+               {
+                       MM_CAM_DISPLAY_MODE,
+                       "display-mode",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_DISPLAY_MODE_DEFAULT},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_display_mode,
+               },
+               //100
+               {
+                       MM_CAM_AUDIO_DISABLE,
+                       "audio-disable",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {FALSE},
+                       {TRUE},
+                       _mmcamcorder_commit_audio_disable,
+               },
+               {
+                       MM_CAM_RECOMMEND_CAMERA_WIDTH,
+                       "recommend-camera-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_RECOMMEND_CAMERA_HEIGHT,
+                       "recommend-camera-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_CAPTURED_EXIF_RAW_DATA,
+                       "captured-exif-raw-data",
+                       MMF_VALUE_TYPE_DATA,
+                       MM_ATTRS_FLAG_READABLE,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
+                       "display-evas-surface-sink",
+                       MMF_VALUE_TYPE_STRING,
+                       MM_ATTRS_FLAG_READABLE,
+                       {(void*)NULL},
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       {0},
+                       {0},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_EVAS_DO_SCALING,
+                       "display-evas-do-scaling",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)TRUE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {FALSE},
+                       {TRUE},
+                       _mmcamcorder_commit_display_evas_do_scaling,
+               },
+               {
+                       MM_CAM_CAMERA_FACING_DIRECTION,
+                       "camera-facing-direction",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
+                       {MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT},
+                       NULL,
+               },
+               {
+                       MM_CAM_DISPLAY_FLIP,
+                       "display-flip",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_FLIP_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_FLIP_NONE},
+                       {MM_FLIP_BOTH},
+                       _mmcamcorder_commit_display_flip,
+               },
+               {
+                       MM_CAM_CAMERA_VIDEO_STABILIZATION,
+                       "camera-video-stabilization",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_CAMCORDER_VIDEO_STABILIZATION_OFF},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_camera_video_stabilization,
+               },
+               {
+                       MM_CAM_TAG_VIDEO_ORIENTATION,
+                       "tag-video-orientation",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
+                       {MM_CAMCORDER_TAG_VIDEO_ORT_270},
+                       NULL,
+               },
+               //110
+               {
+                       MM_CAM_VIDEO_WIDTH,
+                       "video-width",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_video_size,
+               },
+               {
+                       MM_CAM_VIDEO_HEIGHT,
+                       "video-height",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)0},
+                       MM_ATTRS_VALID_TYPE_INT_ARRAY,
+                       {0},
+                       {0},
+                       _mmcamcorder_commit_video_size,
+               },
+               {
+                       MM_CAM_SUPPORT_ZSL_CAPTURE,
+                       "support-zsl-capture",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {FALSE},
+                       {TRUE},
+                       NULL,
+               },
+               {
+                       MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+                       "support-zero-copy-format",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {FALSE},
+                       {TRUE},
+                       NULL,
+               },
+               {
+                       MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
+                       "support-media-packet-preview-cb",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {FALSE},
+                       {TRUE},
+                       NULL,
+               }
+       };
+
+       memcpy(hcamcorder->cam_attrs_const_info, temp_info, sizeof(mm_cam_attr_construct_info) * attr_count);
+
        for (idx = 0 ; idx < attr_count ; idx++) {
                /* attribute order check. This should be same. */
-               if (idx != cam_attrs_const_info[idx].attrid) {
+               if (idx != hcamcorder->cam_attrs_const_info[idx].attrid) {
                        _mmcam_dbg_err("Please check attributes order. Is the idx same with enum val?");
+                       free(attrs_const_info);
+                       attrs_const_info = NULL;
+                       free(hcamcorder->cam_attrs_const_info);
+                       hcamcorder->cam_attrs_const_info = NULL;
                        return 0;
                }
 
-               attrs_const_info[idx].name = cam_attrs_const_info[idx].name;
-               attrs_const_info[idx].value_type = cam_attrs_const_info[idx].value_type;
-               attrs_const_info[idx].flags = cam_attrs_const_info[idx].flags;
-               attrs_const_info[idx].default_value = cam_attrs_const_info[idx].default_value.value_void;
+               attrs_const_info[idx].name = hcamcorder->cam_attrs_const_info[idx].name;
+               attrs_const_info[idx].value_type = hcamcorder->cam_attrs_const_info[idx].value_type;
+               attrs_const_info[idx].flags = hcamcorder->cam_attrs_const_info[idx].flags;
+               attrs_const_info[idx].default_value = hcamcorder->cam_attrs_const_info[idx].default_value.value_void;
        }
 
        /* Camcorder Attributes */
@@ -1561,6 +1443,8 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info )
 
        if (attrs == 0) {
                _mmcam_dbg_err("Fail to alloc attribute handle");
+               free(hcamcorder->cam_attrs_const_info);
+               hcamcorder->cam_attrs_const_info = NULL;
                return 0;
        }
 
@@ -1571,39 +1455,39 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info )
 /*             _mmcam_dbg_log("Valid type [%s:%d, %d, %d]", cam_attrs_const_info[idx].name, cam_attrs_const_info[idx].validity_type
                        , cam_attrs_const_info[idx].validity_value1, cam_attrs_const_info[idx].validity_value2);
 */
-               mmf_attrs_set_valid_type (attrs, idx, cam_attrs_const_info[idx].validity_type);
+               mmf_attrs_set_valid_type (attrs, idx, hcamcorder->cam_attrs_const_info[idx].validity_type);
 
-               switch (cam_attrs_const_info[idx].validity_type)
+               switch (hcamcorder->cam_attrs_const_info[idx].validity_type)
                {
                        case MM_ATTRS_VALID_TYPE_INT_ARRAY:
-                               if (cam_attrs_const_info[idx].validity_value1 &&
-                                   cam_attrs_const_info[idx].validity_value2 > 0) {
+                               if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array &&
+                                   hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
                                        mmf_attrs_set_valid_array(attrs, idx,
-                                                                 (const int *)(cam_attrs_const_info[idx].validity_value1),
-                                                                 cam_attrs_const_info[idx].validity_value2,
-                                                                 (int)(cam_attrs_const_info[idx].default_value.value_int));
+                                                                 (const int *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array),
+                                                                 hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
+                                                                 hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
                                }
                        break;
                        case MM_ATTRS_VALID_TYPE_INT_RANGE:
                                mmf_attrs_set_valid_range(attrs, idx,
-                                                         cam_attrs_const_info[idx].validity_value1,
-                                                         cam_attrs_const_info[idx].validity_value2,
-                                                         (int)(cam_attrs_const_info[idx].default_value.value_int));
+                                                         hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_min,
+                                                         hcamcorder->cam_attrs_const_info[idx].validity_value_2.int_max,
+                                                         hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
                        break;
                        case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
-                               if (cam_attrs_const_info[idx].validity_value1 &&
-                                   cam_attrs_const_info[idx].validity_value2 > 0) {
+                               if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array &&
+                                   hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
                                        mmf_attrs_set_valid_double_array(attrs, idx,
-                                                                        (const double *)(cam_attrs_const_info[idx].validity_value1),
-                                                                        cam_attrs_const_info[idx].validity_value2,
-                                                                        (double)(cam_attrs_const_info[idx].default_value.value_double));
+                                                                        (const double *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array),
+                                                                        hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
+                                                                        hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
                                }
                        break;
                        case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
                                mmf_attrs_set_valid_double_range(attrs, idx,
-                                                                (double)(cam_attrs_const_info[idx].validity_value1),
-                                                                (double)(cam_attrs_const_info[idx].validity_value2),
-                                                                (double)(cam_attrs_const_info[idx].default_value.value_double));
+                                                                hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_min,
+                                                                hcamcorder->cam_attrs_const_info[idx].validity_value_2.double_max,
+                                                                hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
                        break;
                        case MM_ATTRS_VALID_TYPE_NONE:
                        break;
@@ -1621,20 +1505,31 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info )
 
 
 void
-_mmcamcorder_dealloc_attribute(MMHandleType attrs)
+_mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs)
 {
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return;
+       }
+
        _mmcam_dbg_log("");
 
-       if (attrs)
-       {
+       if (attrs) {
                mmf_attrs_free(attrs);
-
                _mmcam_dbg_log("released attribute");
        }
+
+       if (hcamcorder->cam_attrs_const_info) {
+               free(hcamcorder->cam_attrs_const_info);
+               hcamcorder->cam_attrs_const_info = NULL;
+               _mmcam_dbg_log("released attribute info");
+       }
 }
 
 
-int 
+int
 _mmcamcorder_get_attributes(MMHandleType handle,  char **err_attr_name, const char *attribute_name, va_list var_args)
 {
        MMHandleType attrs = 0;
@@ -1652,7 +1547,7 @@ _mmcamcorder_get_attributes(MMHandleType handle,  char **err_attr_name, const ch
 }
 
 
-int 
+int
 _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
 {
        MMHandleType attrs = 0;
@@ -1661,22 +1556,34 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha
        mmf_return_val_if_fail( handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
 //     mmf_return_val_if_fail( err_attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
 
-       attrs = MMF_CAMCORDER_ATTRS(handle);
-       mmf_return_val_if_fail( attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED );
+       if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
+               _mmcam_dbg_err("Another command is running.");
+               return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+       }
 
-       __ta__( "__mmcamcorder_check_valid_pair",
-       ret = __mmcamcorder_check_valid_pair( handle, err_attr_name, attribute_name, var_args );
-       );
+       attrs = MMF_CAMCORDER_ATTRS(handle);
+       if (attrs) {
+               ret = __mmcamcorder_check_valid_pair( handle, err_attr_name, attribute_name, var_args );
+       } else {
+               _mmcam_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
+               ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+       }
 
        if (ret == MM_ERROR_NONE) {
                ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args);
        }
 
+       _MMCAMCORDER_UNLOCK_CMD(handle);
+
+       if (ret != MM_ERROR_NONE) {
+               _mmcam_dbg_err("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle);
+       }
+
        return ret;
 }
 
 
-int 
+int
 _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCamAttrsInfo *info)
 {
        MMHandleType attrs = 0;
@@ -1733,49 +1640,22 @@ _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCa
 }
 
 
-//attribute commiter
-void
-__mmcamcorder_print_attrs (const char *attr_name, const mmf_value_t *value, char* cmt_way)
-{
-       switch(value->type)
-       {
-               case MMF_VALUE_TYPE_INT:
-                       _mmcam_dbg_log("%s :(%s:%d)", cmt_way, attr_name, value->value.i_val);
-               break;
-               case MMF_VALUE_TYPE_DOUBLE:
-                       _mmcam_dbg_log("%s :(%s:%f)", cmt_way, attr_name, value->value.d_val);
-               break;
-               case MMF_VALUE_TYPE_STRING:
-                       _mmcam_dbg_log("%s :(%s:%s)", cmt_way, attr_name, value->value.s_val);
-               break;
-               case MMF_VALUE_TYPE_DATA:
-                       _mmcam_dbg_log("%s :(%s:%p)", cmt_way, attr_name, value->value.p_val);
-               break;
-       }
-
-       return;
-}
-
 bool
 _mmcamcorder_commit_camcorder_attrs (int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param)
 {
        bool bret = FALSE;
+       mmf_camcorder_t *hcamcorder = NULL;
 
        mmf_return_val_if_fail(commit_param, FALSE);
        mmf_return_val_if_fail(attr_idx >= 0, FALSE);
        mmf_return_val_if_fail(attr_name, FALSE);
        mmf_return_val_if_fail(value, FALSE);
 
-       if (cam_attrs_const_info[attr_idx].attr_commit)
-       {
-//             _mmcam_dbg_log("Dynamic commit:(%s)", attr_name);
-               __mmcamcorder_print_attrs(attr_name, value, "Dynamic");
-               bret = cam_attrs_const_info[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
-       }
-       else
-       {
-//             _mmcam_dbg_log("Static commit:(%s)", attr_name);
-               __mmcamcorder_print_attrs(attr_name, value, "Static");
+       hcamcorder = MMF_CAMCORDER(commit_param);
+
+       if (hcamcorder->cam_attrs_const_info[attr_idx].attr_commit) {
+               bret = hcamcorder->cam_attrs_const_info[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
+       } else {
                bret = TRUE;
        }
 
@@ -1788,25 +1668,32 @@ int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle)
        int *format = NULL;
        int total_count = 0;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+       }
+
        /* Audio encoder */
        total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER, &format);
-       cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1 = (int)format;
-       cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value2 = (int)total_count;
+       hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = format;
+       hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = total_count;
 
        /* Video encoder */
        total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER, &format);
-       cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1 = (int)format;
-       cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value2 = (int)total_count;
+       hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = format;
+       hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = total_count;
 
        /* Image encoder */
        total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER, &format);
-       cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1 = (int)format;
-       cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value2 = (int)total_count;
+       hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = format;
+       hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = total_count;
 
        /* File format */
        total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_MUX, &format);
-       cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1 = (int)format;
-       cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value2 = (int)total_count;
+       hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = format;
+       hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = total_count;
 
        return MM_ERROR_NONE;
 }
@@ -1816,38 +1703,45 @@ int __mmcamcorder_release_conf_valid_info(MMHandleType handle)
 {
        int *allocated_memory = NULL;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+       }
+
        _mmcam_dbg_log("START");
 
        /* Audio encoder info */
-       allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1);
+       allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array);
        if (allocated_memory) {
                free(allocated_memory);
-               cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1 = (int)NULL;
-               cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value2 = (int)0;
+               hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = NULL;
+               hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = 0;
        }
 
        /* Video encoder info */
-       allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1);
+       allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array);
        if (allocated_memory) {
                free(allocated_memory);
-               cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1 = (int)NULL;
-               cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value2 = (int)0;
+               hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = NULL;
+               hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = 0;
        }
 
        /* Image encoder info */
-       allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1);
+       allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array);
        if (allocated_memory) {
                free(allocated_memory);
-               cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1 = (int)NULL;
-               cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value2 = (int)0;
+               hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = NULL;
+               hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = 0;
        }
 
        /* File format info */
-       allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1);
+       allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array);
        if (allocated_memory) {
                free(allocated_memory);
-               cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1 = (int)NULL;
-               cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value2 = (int)0;
+               hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = NULL;
+               hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = 0;
        }
 
        _mmcam_dbg_log("DONE");
@@ -1922,9 +1816,9 @@ bool _mmcamcorder_commit_capture_break_cont_shot (MMHandleType handle, int attr_
        GstCameraControl       *control = NULL;
        type_element           *VideosrcElement = NULL;
 
-       char* videosrc_name = NULL;
+       const char *videosrc_name = NULL;
 
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                      "VideosrcElement",
                                      &VideosrcElement );
@@ -1934,29 +1828,17 @@ bool _mmcamcorder_commit_capture_break_cont_shot (MMHandleType handle, int attr_
        if (!sc)
                return TRUE;
 
-       if( ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING )
-       {
-               if( !strcmp( videosrc_name, "avsysvideosrc" ) || !strcmp( videosrc_name, "camerasrc" ) )
-               {
-                       if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
-                       {
-                               _mmcam_dbg_err("Can't cast Video source into camera control.");
-                               return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
-                       }
-
-                       control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
+       if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+                       _mmcam_dbg_warn("Can't cast Video source into camera control.");
+                       return TRUE;
+               }
 
-                       gst_camera_control_set_capture_command( control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT );
+               control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
+               gst_camera_control_set_capture_command( control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT );
 
-                       _mmcam_dbg_warn( "Commit Break continuous shot : Set command OK. current state[%d]", current_state );
-               }
-               else
-               {
-                       _mmcam_dbg_warn( "Another videosrc plugin[%s] is not supported yet.", videosrc_name );
-               }
-       }
-       else
-       {
+               _mmcam_dbg_warn( "Commit Break continuous shot : Set command OK. current state[%d]", current_state );
+       } else {
                _mmcam_dbg_warn( "Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state );
        }
 
@@ -2016,36 +1898,29 @@ bool _mmcamcorder_commit_audio_volume (MMHandleType handle, int attr_idx, const
        bool bret = FALSE;
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc)
+       if (!sc) {
                return TRUE;
+       }
 
        current_state = _mmcamcorder_get_state( handle);
 
-       if ((current_state == MM_CAMCORDER_STATE_RECORDING)||(current_state == MM_CAMCORDER_STATE_PAUSED))
-       {
+       if ((current_state == MM_CAMCORDER_STATE_RECORDING)||(current_state == MM_CAMCORDER_STATE_PAUSED)) {
                double mslNewVal = 0;
                mslNewVal = value->value.d_val;
 
-               if (sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst)
-               {
-                       if(mslNewVal == 0.0)
-                       {
-                               //Because data probe of audio src do the same job, it doesn't need to set mute here. Already null raw data.
-//                             MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", TRUE);
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
-                       }
-                       else
-                       {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal);
+               if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst) {
+                       if (mslNewVal == 0.0) {
+                               /* Because data probe of audio src do the same job, it doesn't need to set mute here. Already null raw data. */
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
+                       } else {
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal);
                        }
                }
 
                _mmcam_dbg_log("Commit : volume(%f)", mslNewVal);
                bret = TRUE;
-       }
-       else
-       {
+       } else {
                _mmcam_dbg_log("Commit : nothing to commit. status(%d)", current_state);
                bret = TRUE;
        }
@@ -2066,7 +1941,7 @@ bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int a
        int current_state = MM_CAMCORDER_STATE_NONE;
        _MMCamcorderSubContext *sc = NULL;
 
-       mmf_return_val_if_fail(handle, TRUE);
+       mmf_return_val_if_fail(handle, FALSE);
 
        current_state = _mmcamcorder_get_state(handle);
 
@@ -2078,7 +1953,9 @@ bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int a
        /* Verify recording motion rate */
        if (value->value.d_val > 0.0) {
                sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-               mmf_return_val_if_fail(sc, TRUE);
+               if (!sc) {
+                       return TRUE;
+               }
 
                /* set is_slow flag */
                if (value->value.d_val != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
@@ -2096,11 +1973,20 @@ bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int a
 }
 
 
-bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        MMHandleType attr = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
-       int width, height;
+       int ret = 0;
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
+
+       mmf_return_val_if_fail(hcamcorder, FALSE);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc) {
+               return TRUE;
+       }
 
        attr = MMF_CAMCORDER_ATTRS(handle);
        mmf_return_val_if_fail(attr, FALSE);
@@ -2109,7 +1995,7 @@ bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const
 
        current_state = _mmcamcorder_get_state(handle);
 
-       if (current_state > MM_CAMCORDER_STATE_READY) {
+       if (current_state > MM_CAMCORDER_STATE_PREPARE) {
                _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state);
                return FALSE;
        } else {
@@ -2119,36 +2005,153 @@ bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const
                flags = info.flag;
 
                if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
-                       mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_HEIGHT, &height, NULL);
-                       width = value->value.i_val;
-                       //This means that width is changed while height isn't changed. So call _mmcamcorder_commit_camera_height forcely.
-                       _mmcam_dbg_log("Call _mmcamcorder_commit_camera_height");
-                       return __mmcamcorder_set_camera_resolution(handle, width, height);
+                       int width = value->value.i_val;
+                       int height = 0;
+                       int preview_format = MM_PIXEL_FORMAT_NV12;
+                       int codec_type = MM_IMAGE_CODEC_JPEG;
+
+                       mm_camcorder_get_attributes(handle, NULL,
+                                                   MMCAM_CAMERA_HEIGHT, &height,
+                                                   MMCAM_CAMERA_FORMAT, &preview_format,
+                                                   MMCAM_IMAGE_ENCODER, &codec_type,
+                                                   NULL);
+
+                       if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+                               if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+                                       _mmcam_dbg_log("restart preview");
+
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
+                                       _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+                                       /* get preview format */
+                                       sc->info_image->preview_format = preview_format;
+                                       sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+                                       ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+                                       _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+
+                                       /* unlock */
+                                       pthread_mutex_unlock(&(hcamcorder->restart_preview_lock));
+                               } else {
+                                       _mmcam_dbg_err("currently locked for preview restart");
+                                       return FALSE;
+                               }
+                       } else {
+                               /* get preview format */
+                               sc->info_image->preview_format = preview_format;
+                               sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+                               ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+                       }
+
+                       return ret;
                }
+
                return TRUE;
        }
 }
 
 
-bool _mmcamcorder_commit_camera_height (MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
-       int width, height;
+       int ret = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
        MMHandleType attr = 0;
-       
-       attr = MMF_CAMCORDER_ATTRS(handle);
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
+
+       mmf_return_val_if_fail(hcamcorder, FALSE);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc) {
+               return TRUE;
+       }
+
+       attr = MMF_CAMCORDER_ATTRS(hcamcorder);
        mmf_return_val_if_fail(attr, FALSE);
 
        _mmcam_dbg_log("Height(%d)", value->value.i_val);
        current_state = _mmcamcorder_get_state( handle);
 
-       if (current_state > MM_CAMCORDER_STATE_READY) {
+       if (current_state > MM_CAMCORDER_STATE_PREPARE) {
                _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state);
                return FALSE;
        } else {
-               height = value->value.i_val;
-               mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_WIDTH, &width, NULL);
-               return __mmcamcorder_set_camera_resolution(handle, width, height);
+               int width = 0;
+               int height = value->value.i_val;
+               int preview_format = MM_PIXEL_FORMAT_NV12;
+               int codec_type = MM_IMAGE_CODEC_JPEG;
+               int video_stabilization = 0;
+
+               mm_camcorder_get_attributes(handle, NULL,
+                                           MMCAM_CAMERA_WIDTH, &width,
+                                           MMCAM_CAMERA_FORMAT, &preview_format,
+                                           MMCAM_IMAGE_ENCODER, &codec_type,
+                                           MMCAM_CAMERA_VIDEO_STABILIZATION, &video_stabilization,
+                                           NULL);
+
+               sc->info_video->preview_width = width;
+               sc->info_video->preview_height = height;
+
+               if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+                       if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+                               _mmcam_dbg_log("restart preview");
+
+                               _mmcam_dbg_log("set empty buffers");
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
+                               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+                               /* get preview format */
+                               sc->info_image->preview_format = preview_format;
+                               sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+
+                               ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+                               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+
+                               /* unlock */
+                               pthread_mutex_unlock(&(hcamcorder->restart_preview_lock));
+                       } else {
+                               _mmcam_dbg_err("currently locked for preview restart");
+                               return FALSE;
+                       }
+               } else {
+                       /* get preview format */
+                       sc->info_image->preview_format = preview_format;
+                       sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+                       ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+               }
+
+               return ret;
+       }
+}
+
+
+bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+       int current_state = MM_CAMCORDER_STATE_NONE;
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       mmf_return_val_if_fail(hcamcorder, FALSE);
+
+       current_state = _mmcamcorder_get_state(handle);
+       if (current_state > MM_CAMCORDER_STATE_PREPARE) {
+               _mmcam_dbg_err("Video Resolution can't be changed.(state=%d)", current_state);
+               return FALSE;
+       } else {
+               _mmcam_dbg_warn("Video Resolution %d [attr_idx %d] ",
+                               value->value.i_val, attr_idx);
+               return TRUE;
        }
 }
 
@@ -2162,14 +2165,19 @@ bool _mmcamcorder_commit_camera_zoom (MMHandleType handle, int attr_idx, const m
        int zoom_type;
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
+       if (!sc) {
+               return TRUE;
+       }
 
        _mmcam_dbg_log("(%d)", attr_idx);
 
        current_state = _mmcamcorder_get_state(handle);
-
-       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+       if (current_state < MM_CAMCORDER_STATE_READY) {
+               _mmcam_dbg_log("will be applied when preview starts");
                return TRUE;
+       } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               _mmcam_dbg_warn("Can not set while CAPTURING");
+               return FALSE;
        }
 
        if (attr_idx == MM_CAM_CAMERA_OPTICAL_ZOOM) {
@@ -2183,15 +2191,11 @@ bool _mmcamcorder_commit_camera_zoom (MMHandleType handle, int attr_idx, const m
 
                if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                        _mmcam_dbg_log("Can't cast Video source into camera control.");
-                       return TRUE; 
+                       return TRUE;
                }
 
                control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
-
-               __ta__("                gst_camera_control_set_zoom",
                ret = gst_camera_control_set_zoom(control, zoom_type, zoom_level);
-               );
-
                if (ret) {
                        _mmcam_dbg_log("Succeed in operating Zoom[%d].", zoom_level);
                        return TRUE;
@@ -2213,7 +2217,9 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c
        _MMCamcorderSubContext *sc = NULL;
        GstCameraControl *control = NULL;
        int mslVal;
-       int mode, cur_focus_mode, cur_focus_range;
+       int set_focus_mode = 0;
+       int cur_focus_mode = 0;
+       int cur_focus_range = 0;
 
        attr = MMF_CAMCORDER_ATTRS(handle);
        mmf_return_val_if_fail(attr, FALSE);
@@ -2236,13 +2242,11 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c
                return TRUE;
        }
 
-       if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst )
-       {
+       if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
                int flags = MM_ATTRS_FLAG_NONE;
                MMCamAttrsInfo info;
 
-               if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
-               {
+               if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                        _mmcam_dbg_log("Can't cast Video source into camera control.");
                        return TRUE;
                }
@@ -2250,46 +2254,28 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c
                control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
 
                mslVal = value->value.i_val;
-               mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal );
+               set_focus_mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal );
 
                mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_SCAN_RANGE, &info);
                flags = info.flag;
 
-               if (!(flags & MM_ATTRS_FLAG_MODIFIED))
-               {
-                       if( gst_camera_control_get_focus( control, &cur_focus_mode, &cur_focus_range ) )
-                       {
-                               if( mode != cur_focus_mode )
-                               {
-                                       MMTA_ACUM_ITEM_BEGIN("                gst_camera_control_set_focus", 0);
-                                       if( gst_camera_control_set_focus( control, mode, cur_focus_range ) )
-                                       {
-                                               MMTA_ACUM_ITEM_END("                gst_camera_control_set_focus", 0);
-                                               _mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
-                                               return TRUE;
-                                       }
-                                       else
-                                       {
-                                               _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
-                                       }
-                                       MMTA_ACUM_ITEM_END("                gst_camera_control_set_focus", 0);
-                               }
-                               else
-                               {
-                                       _mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal );
+               if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
+                       if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
+                               if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) {
+                                       _mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);
                                        return TRUE;
+                               } else {
+                                       _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal);
                                }
-                       }
-                       else
-                       {
-                               _mmcam_dbg_warn( "Failed to get AF mode, so do not set new AF mode[%d]", mslVal );
+                       } else {
+                               _mmcam_dbg_err("failed to get focus mode");
+                               return FALSE;
                        }
                }
-       }
-       else
-       {
+       } else {
                _mmcam_dbg_log("pointer of video src is null");
        }
+
        return TRUE;
 }
 
@@ -2299,9 +2285,8 @@ bool _mmcamcorder_commit_camera_af_scan_range (MMHandleType handle, int attr_idx
        _MMCamcorderSubContext *sc = NULL;
        GstCameraControl *control = NULL;
        int current_state = MM_CAMCORDER_STATE_NONE;
-       int mslVal, newVal;
-       int cur_focus_mode = 0;
-       int cur_focus_range = 0;
+       int mslVal = 0;
+       int newVal = 0;
        int msl_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
        int converted_mode = 0;
 
@@ -2321,15 +2306,13 @@ bool _mmcamcorder_commit_camera_af_scan_range (MMHandleType handle, int attr_idx
        newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
 
        current_state = _mmcamcorder_get_state(handle);
-       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
-               _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+       if (current_state < MM_CAMCORDER_STATE_READY) {
+               _mmcam_dbg_log("af scan range will be changed later.(state=%d)", current_state);
                return TRUE;
        }
-       
-       if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst )
-       {
-               if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
-               {
+
+       if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+               if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                        _mmcam_dbg_log("Can't cast Video source into camera control.");
                        return TRUE;
                }
@@ -2339,37 +2322,13 @@ bool _mmcamcorder_commit_camera_af_scan_range (MMHandleType handle, int attr_idx
                mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &msl_mode, NULL);
                converted_mode = _mmcamcorder_convert_msl_to_sensor( handle, MM_CAM_CAMERA_FOCUS_MODE, msl_mode );
 
-               if( gst_camera_control_get_focus( control, &cur_focus_mode, &cur_focus_range ) )
-               {
-
-                       if (( newVal != cur_focus_range ) || ( converted_mode != cur_focus_mode ))
-                       {
-                               MMTA_ACUM_ITEM_BEGIN("                gst_camera_control_set_focus", 0);
-                               if( gst_camera_control_set_focus( control, converted_mode, newVal ) )
-                               {
-                                       MMTA_ACUM_ITEM_END("                gst_camera_control_set_focus", 0);
-                                       //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
-                                       return TRUE;
-                               }
-                               else
-                               {
-                                       MMTA_ACUM_ITEM_END("                gst_camera_control_set_focus", 0);
-                                       _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
-                               }
-                       }
-                       else
-                       {
-                               //_mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal );
-                               return TRUE;
-                       }
-               }
-               else
-               {
-                       _mmcam_dbg_warn( "Failed to get AF mode, so do not set new AF mode[%d]", mslVal );
+               if (gst_camera_control_set_focus(control, converted_mode, newVal)) {
+                       //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
+                       return TRUE;
+               } else {
+                       _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
                }
-       }
-       else
-       {
+       } else {
                _mmcam_dbg_log("pointer of video src is null");
        }
        return FALSE;
@@ -2384,9 +2343,9 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
        int current_state = MM_CAMCORDER_STATE_NONE;
        int ret = FALSE;
        int focus_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
-       
+
        gboolean do_set = FALSE;
-       
+
        MMCamAttrsInfo info_y, info_w, info_h;
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
@@ -2402,7 +2361,7 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
                _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
                return TRUE;
        }
-       
+
        ret = mm_camcorder_get_attributes(handle, NULL,
                                MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
                                NULL);
@@ -2411,7 +2370,7 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
                _mmcam_dbg_warn( "Failed to get FOCUS MODE.[%x]", ret );
                return FALSE;
        }
-       
+
        if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO ) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS))
        {
                _mmcam_dbg_warn( "Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode );
@@ -2423,7 +2382,7 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
                if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
                {
                        _mmcam_dbg_log("Can't cast Video source into camera control.");
-                       return TRUE; 
+                       return TRUE;
                }
 
                switch( attr_idx )
@@ -2497,20 +2456,18 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
                        default:
                                break;
                }
-               
+
                if( do_set )
                {
                        control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
-                       
-                       __ta__( "                gst_camera_control_get_focus_area",
+
                        ret = gst_camera_control_get_auto_focus_area( control, &get_area );
-                       );
                        if( !ret )
                        {
                                _mmcam_dbg_warn( "Failed to get AF area" );
                                return FALSE;
                        }
-                       
+
                        if( get_area.x == set_area.x && get_area.y == set_area.y )
                        // width and height are not supported now.
                        // get_area.width == set_area.width && get_area.height == set_area.height
@@ -2519,9 +2476,7 @@ bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx
                                return TRUE;
                        }
 
-                       __ta__( "                gst_camera_control_set_focus_area",
                        ret = gst_camera_control_set_auto_focus_area( control, set_area );
-                       );
                        if( ret )
                        {
                                _mmcam_dbg_log( "Succeed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height );
@@ -2612,9 +2567,7 @@ bool _mmcamcorder_commit_camera_capture_mode (MMHandleType handle, int attr_idx,
 
                control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
 
-               __ta__("                gst_camera_control_set_exposure",
                ret = gst_camera_control_set_exposure(control, exposure_type, newVal1, newVal2);
-               );
                if (ret) {
                        _mmcam_dbg_log("Succeed in setting exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2 );
                        return TRUE;
@@ -2647,17 +2600,17 @@ bool _mmcamcorder_commit_camera_wdr (MMHandleType handle, int attr_idx, const mm
        }
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
+       if (!sc) {
+               return TRUE;
+       }
 
        /* check current state */
        current_state = _mmcamcorder_get_state( handle);
-       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
-               _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+       if (current_state < MM_CAMCORDER_STATE_READY) {
+               _mmcam_dbg_log("will be applied when preview starts");
                return TRUE;
-       }
-
-       if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
-               _mmcam_dbg_warn("Can not set WDR while CAPTURING");
+       } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               _mmcam_dbg_warn("Can not set while CAPTURING");
                return FALSE;
        }
 
@@ -2734,35 +2687,6 @@ bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int att
 }
 
 
-bool _mmcamcorder_commit_camera_hold_af_after_capturing (MMHandleType handle, int attr_idx, const mmf_value_t *value)
-{
-       _MMCamcorderSubContext *sc = NULL;
-       int current_state = MM_CAMCORDER_STATE_NONE;
-
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc)
-               return TRUE;
-
-       current_state = _mmcamcorder_get_state(handle);
-
-       if( current_state < MM_CAMCORDER_STATE_READY )
-       {
-               _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
-               return TRUE;
-       }
-       
-       if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)
-       {
-               _mmcam_dbg_log("Commit : value of Hold af after capturing is %d", value->value.i_val);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", value->value.i_val);
-       }
-       else
-               _mmcam_dbg_warn("Commit : Hold af after capturing cannot be set");
-
-       return TRUE;
-}
-
-
 bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
@@ -2819,18 +2743,32 @@ bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx
 bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        _MMCamcorderSubContext *sc = NULL;
-       char * filename = NULL;
+       const char * filename = NULL;
        int size = 0;
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc)
+       if (!sc) {
                return TRUE;
+       }
 
        /* get string */
-       filename = (char *)mmf_value_get_string(value, &size);
+       filename = mmf_value_get_string(value, &size);
+
+       if (sc->info_video) {
+               if (sc->info_video->filename) {
+                       free(sc->info_video->filename);
+                       sc->info_video->filename = NULL;
+               }
+               sc->info_video->filename = strdup(filename);
+               if (sc->info_video->filename == NULL) {
+                       _mmcam_dbg_err("failed to strdup filename [%s]", filename);
+                       return FALSE;
+               }
+       }
 
-       if (sc->element && sc->element[_MMCAMCORDER_ENCSINK_SINK].gst) {
-               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
+       if (sc->encode_element && sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst) {
+               _mmcam_dbg_log("new file location set.[%s] filesink %p", filename, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
                _mmcam_dbg_log("new file location set.(%s)", filename);
        } else {
                _mmcam_dbg_log("element is not created yet. [%s] will be set later...", filename);
@@ -2851,12 +2789,18 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va
        int newVal = 0;
        int mslNewVal = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
-       gchar * control_label = NULL;
+       const char *control_label = NULL;
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
 
        int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
        gboolean check_scene_mode = FALSE;
 
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_log("handle is NULL");
+               return FALSE;
+       }
+
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        if (!sc)
                return TRUE;
@@ -2868,9 +2812,12 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va
        }
 
        current_state = _mmcamcorder_get_state(handle);
-       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
-               _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+       if (current_state < MM_CAMCORDER_STATE_READY) {
+               _mmcam_dbg_log("will be applied when preview starts");
                return TRUE;
+       } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               _mmcam_dbg_warn("Can not set while CAPTURING");
+               return FALSE;
        }
 
        if (value->type != MM_ATTRS_TYPE_INT) {
@@ -2912,6 +2859,9 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va
                control_label = "sharpness";
                check_scene_mode = TRUE;
                break;
+       default:
+               _mmcam_dbg_err("unknown attribute index %d", attr_idx);
+               return FALSE;
        }
 
        if (check_scene_mode) {
@@ -2923,50 +2873,40 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va
        }
 
        newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslNewVal);
-       if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE)
+       if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE) {
                return FALSE;
-                       
+       }
+
        _mmcam_dbg_log("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);
-       
+
        if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                _mmcam_dbg_log("Can't cast Video source into color balance.");
                return TRUE;
        }
-       
-       balance = GST_COLOR_BALANCE (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
 
-       controls = gst_color_balance_list_channels (balance);
+       balance = GST_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+       controls = gst_color_balance_list_channels(balance);
        if (controls == NULL) {
                _mmcam_dbg_log("There is no list of colorbalance controls");
                return FALSE;
        }
 
-       for (item = controls ; item != NULL ; item = item->next) {
-               if (item) {
-                       if (item->data) {
-                               Colorchannel = item->data;
-                               /*_mmcam_dbg_log("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);*/
+       for (item = controls ; item && item->data ; item = item->next) {
+               Colorchannel = item->data;
+               //_mmcam_dbg_log("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);
 
-                               if (!strcmp(Colorchannel->label, control_label)) {
-                                       break;
-                               } else {
-                                       Colorchannel = NULL;
-                               }
-                       }
+               if (!strcmp(Colorchannel->label, control_label)) {
+                       gst_color_balance_set_value (balance, Colorchannel, newVal);
+                       _mmcam_dbg_log("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal);
+                       break;
                }
        }
 
-       if (Colorchannel== NULL) {
-               _mmcam_dbg_log("There is no data in the colorbalance controls(%d)", attr_idx);
+       if (item == NULL) {
+               _mmcam_dbg_err("failed to find color channel item");
                return FALSE;
        }
 
-       __ta__("                gst_color_balance_set_value",
-       gst_color_balance_set_value (balance, Colorchannel, newVal);
-       );
-
-       _mmcam_dbg_log( "Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal);
-
        return TRUE;
 }
 
@@ -2990,11 +2930,11 @@ bool _mmcamcorder_commit_filter_scene_mode (MMHandleType handle, int attr_idx, c
        }
 
        current_state = _mmcamcorder_get_state(handle);
-       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+       if (current_state < MM_CAMCORDER_STATE_READY) {
                _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
                return TRUE;
        }
-       
+
        if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
                int ret = 0;
 
@@ -3003,15 +2943,13 @@ bool _mmcamcorder_commit_filter_scene_mode (MMHandleType handle, int attr_idx, c
                        return TRUE;
                }
 
-               control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
-               __ta__("                gst_camera_control_set_exposure:GST_CAMERA_CONTROL_PROGRAM_MODE",
+               control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
                ret = gst_camera_control_set_exposure(control, GST_CAMERA_CONTROL_PROGRAM_MODE, newVal, 0);
-               );
                if (ret) {
                        _mmcam_dbg_log("Succeed in setting program mode[%d].", mslVal);
 
                        if (mslVal == MM_CAMCORDER_SCENE_MODE_NORMAL) {
-                               int i = 0;
+                               unsigned int i = 0;
                                int attr_idxs[] = {
                                        MM_CAM_CAMERA_ISO
                                        , MM_CAM_FILTER_BRIGHTNESS
@@ -3049,114 +2987,6 @@ bool _mmcamcorder_commit_filter_flip (MMHandleType handle, int attr_idx, const m
 }
 
 
-bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value)
-{
-       int ret = 0;
-       int current_state = MM_CAMCORDER_STATE_NONE;
-
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       GstCameraControl *control = NULL;
-       _MMCamcorderSubContext *sc = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
-
-       /* these are only available after camera preview is started */
-       current_state = _mmcamcorder_get_state(handle);
-       if (current_state >= MM_CAMCORDER_STATE_PREPARE &&
-           hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
-               int x = 0;
-               int y = 0;
-               int zoom_level = 0;
-               int preview_width = 0;
-               int preview_height = 0;
-
-               switch (attr_idx) {
-               case MM_CAM_CAMERA_FACE_ZOOM_X:
-                       /* check x coordinate of face zoom */
-                       mm_camcorder_get_attributes(handle, NULL,
-                                                   MMCAM_CAMERA_WIDTH, &preview_width,
-                                                   NULL);
-                       /* x coordinate should be smaller than width of preview */
-                       if (value->value.i_val < preview_width) {
-                               _mmcam_dbg_log("set face zoom x %d done", value->value.i_val);
-                               ret = TRUE;
-                       } else {
-                               _mmcam_dbg_err("invalid face zoom x %d", value->value.i_val);
-                               ret = FALSE;
-                       }
-                       break;
-               case MM_CAM_CAMERA_FACE_ZOOM_Y:
-                       /* check y coordinate of face zoom */
-                       mm_camcorder_get_attributes(handle, NULL,
-                                                   MMCAM_CAMERA_WIDTH, &preview_height,
-                                                   NULL);
-                       /* y coordinate should be smaller than height of preview */
-                       if (value->value.i_val < preview_height) {
-                               _mmcam_dbg_log("set face zoom y %d done", value->value.i_val);
-                               ret = TRUE;
-                       } else {
-                               _mmcam_dbg_err("invalid face zoom y %d", value->value.i_val);
-                               ret = FALSE;
-                       }
-                       break;
-               case MM_CAM_CAMERA_FACE_ZOOM_MODE:
-                       if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_ON) {
-                               int face_detect_mode = MM_CAMCORDER_DETECT_MODE_OFF;
-
-                               /* start face zoom */
-                               /* get x,y coordinate and zoom level */
-                               mm_camcorder_get_attributes(handle, NULL,
-                                                           MMCAM_CAMERA_FACE_ZOOM_X, &x,
-                                                           MMCAM_CAMERA_FACE_ZOOM_Y, &y,
-                                                           MMCAM_CAMERA_FACE_ZOOM_LEVEL, &zoom_level,
-                                                           MMCAM_DETECT_MODE, &face_detect_mode,
-                                                           NULL);
-
-                               if (face_detect_mode == MM_CAMCORDER_DETECT_MODE_ON) {
-                                       control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
-                                       __ta__("                gst_camera_control_start_face_zoom",
-                                       ret = gst_camera_control_start_face_zoom(control, x, y, zoom_level);
-                                       );
-                               } else {
-                                       _mmcam_dbg_err("face detect is OFF... could not start face zoom");
-                                       ret = FALSE;
-                               }
-                       } else if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_OFF) {
-                               /* stop face zoom */
-                               control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
-                               __ta__("                gst_camera_control_stop_face_zoom",
-                               ret = gst_camera_control_stop_face_zoom(control);
-                               );
-                       } else {
-                               /* should not be reached here */
-                               _mmcam_dbg_err("unknown command [%d]", value->value.i_val);
-                               ret = FALSE;
-                       }
-
-                       if (!ret) {
-                               _mmcam_dbg_err("face zoom[%d] failed", value->value.i_val);
-                               ret = FALSE;
-                       } else {
-                               _mmcam_dbg_log("");
-                               ret = TRUE;
-                       }
-                       break;
-               default:
-                       _mmcam_dbg_warn("should not be reached here. attr_idx %d", attr_idx);
-                       break;
-               }
-       } else {
-               _mmcam_dbg_err("invalid state[%d] or mode[%d]", current_state, hcamcorder->type);
-               ret = FALSE;
-       }
-
-       return ret;
-}
-
-
 bool _mmcamcorder_commit_audio_input_route (MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        _mmcam_dbg_log("Commit : Do nothing. this attr will be removed soon.");
@@ -3183,7 +3013,7 @@ bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const
 bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
        void *p_handle = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
@@ -3212,11 +3042,12 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const
                _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
                _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
 
-               if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) {
+               if (!strcmp(videosink_name, "xvimagesink") ||
+                   !strcmp(videosink_name, "ximagesink")) {
                        _mmcam_dbg_log("Commit : Set XID[%x]", *(int*)(p_handle));
-            gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle));
+                       gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle));
                } else if (!strcmp(videosink_name, "evasimagesink") ||
-                          !strcmp(videosink_name, "evaspixmapsink")) {
+                          !strcmp(videosink_name, "evaspixmapsink")) {
                        _mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
                } else {
@@ -3235,7 +3066,7 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const
 bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -3288,7 +3119,7 @@ bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, con
        /* check current state */
        current_state = _mmcamcorder_get_state(handle);
        if (current_state < MM_CAMCORDER_STATE_READY) {
-               _mmcam_dbg_log("NOT initialized. this will be applied later");
+               _mmcam_dbg_log("NOT initialized. this will be applied later [rotate:%d]", value->value.i_val);
                return TRUE;
        }
 
@@ -3313,7 +3144,7 @@ bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const m
        /* check current state */
        current_state = _mmcamcorder_get_state(handle);
        if (current_state < MM_CAMCORDER_STATE_READY) {
-               _mmcam_dbg_log("NOT initialized. this will be applied later");
+               _mmcam_dbg_log("NOT initialized. this will be applied later [flip:%d]", value->value.i_val);
                return TRUE;
        }
 
@@ -3324,7 +3155,7 @@ bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const m
 bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -3364,7 +3195,7 @@ bool _mmcamcorder_commit_display_geometry_method (MMHandleType handle, int attr_
 {
        int method = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -3404,7 +3235,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
        int method = 0;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -3511,7 +3342,7 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const
 {
        int zoom = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
        GstElement *vs_element = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
@@ -3540,7 +3371,7 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const
        if (!strcmp(videosink_name, "xvimagesink")) {
                vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
 
-               MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", zoom + 1);
+               MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
                _mmcam_dbg_log("Set display zoom to %d", zoom + 1);
 
                return TRUE;
@@ -3555,7 +3386,7 @@ bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_i
 {
        int current_state = MM_CAMCORDER_STATE_NONE;
        int do_scaling = 0;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER( handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -3607,11 +3438,13 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va
 
        //status check
        current_state = _mmcamcorder_get_state( handle);
-       
-       if (current_state < MM_CAMCORDER_STATE_PREPARE ||
-           current_state == MM_CAMCORDER_STATE_CAPTURING) {
-               //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+
+       if (current_state < MM_CAMCORDER_STATE_READY) {
+               _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
                return TRUE;
+       } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               _mmcam_dbg_warn("invalid state[capturing]");
+               return FALSE;
        }
 
        mslVal = value->value.i_val;
@@ -3702,7 +3535,9 @@ bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const mm
 
 bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value)
 {
+       int set_hdr_mode = MM_CAMCORDER_HDR_OFF;
        int current_state = MM_CAMCORDER_STATE_NONE;
+       _MMCamcorderSubContext *sc = NULL;
 
        if ((void *)handle == NULL) {
                _mmcam_dbg_warn("handle is NULL");
@@ -3724,6 +3559,45 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c
                return FALSE;
        }
 
+       if (current_state >= MM_CAMCORDER_STATE_READY) {
+               int current_value = 0;
+
+               set_hdr_mode = value->value.i_val;
+               mm_camcorder_get_attributes(handle, NULL,
+                                           MMCAM_CAMERA_HDR_CAPTURE, &current_value,
+                                           NULL);
+
+               if (set_hdr_mode == current_value) {
+                       _mmcam_dbg_log("same HDR value : %d, do nothing", set_hdr_mode);
+                       return TRUE;
+               }
+
+               sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+               if (sc) {
+                       if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
+                               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                       }
+
+                       set_hdr_mode = value->value.i_val;
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", set_hdr_mode);
+                       sc->info_image->hdr_capture_mode = set_hdr_mode;
+                       _mmcam_dbg_log("set HDR mode : %d", set_hdr_mode);
+
+                       if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+                               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+                       }
+               } else {
+                       _mmcam_dbg_err("sc is NULL. can not set HDR capture");
+                       return FALSE;
+               }
+       }
+
        return TRUE;
 }
 
@@ -3753,7 +3627,7 @@ bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const mmf_val
        /* state check */
        current_state = _mmcamcorder_get_state( handle);
        if (current_state < MM_CAMCORDER_STATE_READY) {
-               //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+               _mmcam_dbg_log("will be applied when preview starts");
                return TRUE;
        }
 
@@ -3858,13 +3732,12 @@ _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
 
        int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
 
-       int i = 0 ;
+       unsigned int i = 0 ;
        int ret = TRUE;
        int attr_idxs_default[] = {
                MM_CAM_CAMERA_DIGITAL_ZOOM
                , MM_CAM_CAMERA_OPTICAL_ZOOM
                , MM_CAM_CAMERA_WDR
-               , MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING
                , MM_CAM_FILTER_CONTRAST
                , MM_CAM_FILTER_HUE
                , MM_CAM_STROBE_MODE
@@ -3885,8 +3758,6 @@ _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
 
        _mmcam_dbg_log("Set all attribute again.");
 
-       MMTA_ACUM_ITEM_BEGIN("                _mmcamcorder_set_attribute_to_camsensor", 0);
-
        attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
        if (attr == NULL) {
                _mmcam_dbg_err("Get attribute handle failed.");
@@ -3924,8 +3795,6 @@ _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
                }
        }
 
-       MMTA_ACUM_ITEM_END("                _mmcamcorder_set_attribute_to_camsensor", 0);
-
        _mmcam_dbg_log("Done.");
 
        return ret;
@@ -3943,7 +3812,7 @@ int _mmcamcorder_lock_readonly_attributes(MMHandleType handle)
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
 
        attr = (mmf_attrs_t*) MMF_CAMCORDER_ATTRS(handle);
-       mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);       
+       mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        _mmcam_dbg_log("");
 
@@ -3952,7 +3821,7 @@ int _mmcamcorder_lock_readonly_attributes(MMHandleType handle)
        for (i = 0; i < table_size; i++)
        {
                int sCategory = readonly_attributes[i];
-               
+
                mmf_attribute_set_readonly(&(attr->items[sCategory]));
        }
 
@@ -3973,7 +3842,7 @@ int _mmcamcorder_set_disabled_attributes(MMHandleType handle)
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
 
        attr = (mmf_attrs_t*) MMF_CAMCORDER_ATTRS(handle);
-       mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);       
+       mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        _mmcam_dbg_log("");
 
@@ -4012,7 +3881,9 @@ static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width,
        mmf_return_val_if_fail(hcamcorder, FALSE);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
+       if (!sc) {
+               return TRUE;
+       }
 
        current_state = _mmcamcorder_get_state(handle);
 
@@ -4033,175 +3904,129 @@ static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width,
 }
 
 
-static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height)
-{
-       int fps = 0;
-       double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
-
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;
-       GstCaps *caps = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
-
-       mm_camcorder_get_attributes(handle, NULL,
-                                   MMCAM_CAMERA_FPS, &fps,
-                                   MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
-                                   NULL);
-
-       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
-               if(motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
-               } else {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
-               }
-       }
-
-       caps = gst_caps_new_simple("video/x-raw",
-                               "format", G_TYPE_STRING, sc->format_name,
-                                  "width", G_TYPE_INT, width,
-                                  "height", G_TYPE_INT, height,
-                                  "framerate", GST_TYPE_FRACTION, fps, 1,
-                                  NULL);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
-       gst_caps_unref(caps);
-
-       return TRUE;
-}
-
 static int
 __mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args )
 {
        #define INIT_VALUE            -1
-       #define CHECK_COUNT           2
-       #define CAMERA_RESOLUTION     0
-       #define CAPTURE_RESOLUTION    1
+       #define CHECK_COUNT           3
 
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        MMHandleType attrs = 0;
 
        int ret = MM_ERROR_NONE;
        int  i = 0, j = 0;
-       char *name = NULL;
-       char *check_pair_name[2][3] = {
-               { MMCAM_CAMERA_WIDTH,  MMCAM_CAMERA_HEIGHT,  "MMCAM_CAMERA_WIDTH and HEIGHT" },
-               { MMCAM_CAPTURE_WIDTH, MMCAM_CAPTURE_HEIGHT, "MMCAM_CAPTURE_WIDTH and HEIGHT" },
+       const char *name = NULL;
+       const char *check_pair_name[CHECK_COUNT][3] = {
+               {MMCAM_CAMERA_WIDTH,  MMCAM_CAMERA_HEIGHT,  "MMCAM_CAMERA_WIDTH and HEIGHT"},
+               {MMCAM_CAPTURE_WIDTH, MMCAM_CAPTURE_HEIGHT, "MMCAM_CAPTURE_WIDTH and HEIGHT"},
+               {MMCAM_VIDEO_WIDTH, MMCAM_VIDEO_HEIGHT, "MMCAM_VIDEO_WIDTH and HEIGHT"},
        };
 
-       int check_pair_value[2][2] = {
-               { INIT_VALUE, INIT_VALUE },
-               { INIT_VALUE, INIT_VALUE },
+       int check_pair_value[CHECK_COUNT][2] = {
+               {INIT_VALUE, INIT_VALUE},
+               {INIT_VALUE, INIT_VALUE},
+               {INIT_VALUE, INIT_VALUE},
        };
 
-       if( hcamcorder == NULL || attribute_name == NULL )
-       {
-               _mmcam_dbg_warn( "handle[%p] or attribute_name[%p] is NULL.",
-                                hcamcorder, attribute_name );
+       if (hcamcorder == NULL || attribute_name == NULL) {
+               _mmcam_dbg_warn("handle[%p] or attribute_name[%p] is NULL.",
+                               hcamcorder, attribute_name );
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        }
 
-       if( err_attr_name )
+       if (err_attr_name) {
                *err_attr_name = NULL;
+       }
 
        //_mmcam_dbg_log( "ENTER" );
 
        attrs = MMF_CAMCORDER_ATTRS(handle);
 
-       name = (char*)attribute_name;
+       name = attribute_name;
 
-       while( name )
-       {
+       while (name) {
                int idx = -1;
                MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID;
 
-               /*_mmcam_dbg_log( "NAME : %s", name );*/
+               /*_mmcam_dbg_log("NAME : %s", name);*/
 
                /* attribute name check */
-               if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE)
-               {
-                       if (err_attr_name)
+               if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) {
+                       if (err_attr_name) {
                                *err_attr_name = strdup(name);
+                       }
 
-                       if (ret == MM_ERROR_COMMON_OUT_OF_ARRAY)        //to avoid confusing
+                       if (ret == (int)MM_ERROR_COMMON_OUT_OF_ARRAY) { //to avoid confusing
                                return MM_ERROR_COMMON_ATTR_NOT_EXIST;
-                       else
+                       } else {
                                return ret;
+                       }
                }
 
                /* type check */
-               if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE)
+               if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE) {
                        return ret;
+               }
 
-               switch (attr_type)
+               switch (attr_type) {
+               case MM_ATTRS_TYPE_INT:
                {
-                       case MM_ATTRS_TYPE_INT:
-                       {
-                               gboolean matched = FALSE;
-                               for( i = 0 ; i < CHECK_COUNT ; i++ ) {
-                                       for( j = 0 ; j < 2 ; j++ ) {
-                                               if( !strcmp( name, check_pair_name[i][j] ) )
-                                               {
-                                                       check_pair_value[i][j] = va_arg( (var_args), int );
-                                                       _mmcam_dbg_log( "%s : %d", check_pair_name[i][j], check_pair_value[i][j] );
-                                                       matched = TRUE;
-                                                       break;
-                                               }
-                                       }
-                                       if( matched )
+                       gboolean matched = FALSE;
+                       for (i = 0 ; i < CHECK_COUNT ; i++) {
+                               for (j = 0 ; j < 2 ; j++) {
+                                       if (!strcmp(name, check_pair_name[i][j])) {
+                                               check_pair_value[i][j] = va_arg((var_args), int);
+                                               _mmcam_dbg_log("%s : %d", check_pair_name[i][j], check_pair_value[i][j]);
+                                               matched = TRUE;
                                                break;
+                                       }
+                               }
+                               if (matched) {
+                                       break;
                                }
-                               if( matched == FALSE )
-                               {
-                                       va_arg ((var_args), int);
-                               }                               
-                               break;
                        }
-                       case MM_ATTRS_TYPE_DOUBLE:
-                               va_arg ((var_args), double);
-                               break;
-                       case MM_ATTRS_TYPE_STRING:
-                               va_arg ((var_args), char*); /* string */
-                               va_arg ((var_args), int);   /* size */
-                               break;
-                       case MM_ATTRS_TYPE_DATA:
-                               va_arg ((var_args), void*); /* data */
-                               va_arg ((var_args), int);   /* size */
-                               break;
-                       case MM_ATTRS_TYPE_INVALID:
-                       default:
-                               _mmcam_dbg_err( "Not supported attribute type(%d, name:%s)", attr_type, name);
-                               if (err_attr_name)
-                                       *err_attr_name = strdup(name);
-                               return  MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+                       if (matched == FALSE) {
+                               va_arg((var_args), int);
+                       }
+                       break;
+               }
+               case MM_ATTRS_TYPE_DOUBLE:
+                       va_arg((var_args), double);
+                       break;
+               case MM_ATTRS_TYPE_STRING:
+                       va_arg((var_args), char*); /* string */
+                       va_arg((var_args), int);   /* size */
+                       break;
+               case MM_ATTRS_TYPE_DATA:
+                       va_arg((var_args), void*); /* data */
+                       va_arg((var_args), int);   /* size */
+                       break;
+               case MM_ATTRS_TYPE_INVALID:
+               default:
+                       _mmcam_dbg_err("Not supported attribute type(%d, name:%s)", attr_type, name);
+                       if (err_attr_name) {
+                               *err_attr_name = strdup(name);
+                       }
+                       return  MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
                }
 
                /* next name */
-               name = va_arg (var_args, char*);
+               name = va_arg(var_args, const char*);
        }
-       
-       for( i = 0 ; i < CHECK_COUNT ; i++ )
-       {
-               if( check_pair_value[i][0] != INIT_VALUE || check_pair_value[i][1] != INIT_VALUE )
-               {
+
+       for (i = 0 ; i < CHECK_COUNT ; i++) {
+               if (check_pair_value[i][0] != INIT_VALUE || check_pair_value[i][1] != INIT_VALUE) {
                        gboolean check_result = FALSE;
                        char *err_name = NULL;
                        MMCamAttrsInfo attr_info_0, attr_info_1;
 
-                       if( check_pair_value[i][0] == INIT_VALUE )
-                       {
-                               mm_attrs_get_int_by_name( attrs, check_pair_name[i][0], &check_pair_value[i][0] );
+                       if (check_pair_value[i][0] == INIT_VALUE) {
+                               mm_attrs_get_int_by_name(attrs, check_pair_name[i][0], &check_pair_value[i][0]);
                                err_name = strdup(check_pair_name[i][1]);
-                       }
-                       else if( check_pair_value[i][1] == INIT_VALUE )
-                       {
-                               mm_attrs_get_int_by_name( attrs, check_pair_name[i][1], &check_pair_value[i][1] );
+                       } else if (check_pair_value[i][1] == INIT_VALUE) {
+                               mm_attrs_get_int_by_name(attrs, check_pair_name[i][1], &check_pair_value[i][1]);
                                err_name = strdup(check_pair_name[i][0]);
-                       }
-                       else
-                       {
+                       } else {
                                err_name = strdup(check_pair_name[i][2]);
                        }
 
@@ -4211,24 +4036,30 @@ __mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const
                        check_result = FALSE;
 
                        for( j = 0 ; j < attr_info_0.int_array.count ; j++ ) {
-                               if( attr_info_0.int_array.array[j] == check_pair_value[i][0]
-                                && attr_info_1.int_array.array[j] == check_pair_value[i][1] )
-                               {
-                                       _mmcam_dbg_log( "Valid Pair[%s,%s] existed %dx%d[index:%d]",
-                                                       check_pair_name[i][0], check_pair_name[i][1],
-                                                       check_pair_value[i][0], check_pair_value[i][1], i );
+                               if (attr_info_0.int_array.array[j] == check_pair_value[i][0] &&
+                                   attr_info_1.int_array.array[j] == check_pair_value[i][1]) {
+                                       /*
+                                       _mmcam_dbg_log("Valid Pair[%s,%s] existed %dx%d[index:%d]",
+                                                      check_pair_name[i][0], check_pair_name[i][1],
+                                                      check_pair_value[i][0], check_pair_value[i][1], i);
+                                                                  */
                                        check_result = TRUE;
                                        break;
                                }
                        }
 
-                       if( check_result == FALSE )
-                       {
-                               _mmcam_dbg_err( "INVALID pair[%s,%s] %dx%d",
-                                               check_pair_name[i][0], check_pair_name[i][1],
-                                               check_pair_value[i][0], check_pair_value[i][1] );
-                               if (err_attr_name)
+                       if (check_result == FALSE) {
+                               _mmcam_dbg_err("INVALID pair[%s,%s] %dx%d",
+                                              check_pair_name[i][0], check_pair_name[i][1],
+                                              check_pair_value[i][0], check_pair_value[i][1]);
+                               if (err_attr_name) {
                                        *err_attr_name = err_name;
+                               } else {
+                                       if (err_name) {
+                                               free(err_name);
+                                               err_name = NULL;
+                                       }
+                               }
 
                                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
                        }
index ffdfb91..5afa857 100644 (file)
@@ -24,6 +24,7 @@
 =======================================================================================*/
 #include "mm_camcorder_internal.h"
 #include "mm_camcorder_audiorec.h"
+#include "mm_camcorder_util.h"
 #include <math.h>
 
 /*---------------------------------------------------------------------------------------
@@ -39,7 +40,8 @@
 #define _MMCAMCORDER_AUDIO_MARGIN_SPACE         (1*1024)
 #define _MMCAMCORDER_RETRIAL_COUNT              10
 #define _MMCAMCORDER_FRAME_WAIT_TIME            20000 /* micro second */
-#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL  5
+#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL  10
+
 /*---------------------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                |
 ---------------------------------------------------------------------------------------*/
@@ -60,8 +62,8 @@ static void __mmcamcorder_audiorec_pad_added_cb(GstElement *element, GstPad *pad
 static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
 {
        int err = MM_ERROR_NONE;
-       char *aenc_name = NULL;
-       char *mux_name = NULL;
+       const char *aenc_name = NULL;
+       const char *mux_name = NULL;
 
        GstBus *bus = NULL;
        GstPad *srcpad = NULL;
@@ -82,186 +84,165 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
        mmf_return_val_if_fail(sc->info_audio, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        info = (_MMCamcorderAudioInfo *)sc->info_audio;
-       
+
        _mmcam_dbg_log("");
 
        mux_elem = _mmcamcorder_get_type_element(handle, MM_CAM_FILE_FORMAT);
        err = _mmcamcorder_conf_get_value_element_name( mux_elem, &mux_name );
 
-       if (!mux_name || !strcmp( mux_name, "wavenc" ) ) /* IF MUX in not chosen then record in raw amr file */
-       {
-               //But shoud we support non-mux recording??
+       if (!mux_name || !strcmp(mux_name, "wavenc")) {
+               /* IF MUX in not chosen then record in raw file */
                _mmcam_dbg_log("Record without muxing.");
                info->bMuxing = FALSE;
-       }
-       else
-       {
+       } else {
                _mmcam_dbg_log("Record with mux.");
                info->bMuxing = TRUE;
        }
 
-       //Create gstreamer element
-       //Main pipeline
-       __ta__("            camcorder_pipeline",  
-       _MMCAMCORDER_PIPELINE_MAKE(sc, _MMCAMCORDER_MAIN_PIPE, "camcorder_pipeline", err);
-       );
+       /* Create GStreamer pipeline */
+       _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "camcorder_pipeline", err);
 
-       __ta__("        __mmcamcorder_create_audiosrc_bin",
        err = _mmcamcorder_create_audiosrc_bin(handle);
-       );
        if (err != MM_ERROR_NONE) {
                return err;
        }
 
        if (info->bMuxing) {
                /* Muxing. can use encodebin. */
-               __ta__("        _mmcamcorder_create_encodesink_bin",
                err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_AUDIO);
-               );
-               if (err != MM_ERROR_NONE ) {
+               if (err != MM_ERROR_NONE) {
                        return err;
                }
        } else {
                /* without muxing. can't use encodebin. */
                aenc_elem = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER);
-               if (!aenc_elem)
-               {
+               if (!aenc_elem) {
                        _mmcam_dbg_err("Fail to get type element");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
 
                err = _mmcamcorder_conf_get_value_element_name(aenc_elem, &aenc_name);
-
-               if ((!err) || (!aenc_name))
-               {
+               if ((!err) || (!aenc_name)) {
                        _mmcam_dbg_err("Fail to get element name");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                        goto pipeline_creation_error;
                }
 
-               __ta__("        audiopipeline_audioqueue",  
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_AQUE, "queue",  NULL, element_list, err);
-               );
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_AQUE, "queue",  NULL, element_list, err);
 
-               if( strcmp( aenc_name, "wavenc" ) != 0 )
-               {
-                       __ta__("        audiopipeline_audioconvertor",
-                       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_CONV, "audioconvert",  NULL, element_list, err);
-                       );
+               if (strcmp(aenc_name, "wavenc") != 0) {
+                       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_CONV, "audioconvert",  NULL, element_list, err);
                }
 
-               __ta__("        audiopipeline_audioencoder",  
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_AENC, aenc_name, NULL, element_list, err);
-               );
-
-               __ta__("        audiopipeline_filesink",  
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, "filesink", NULL, element_list, err);
-               );
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_AENC, aenc_name, NULL, element_list, err);
 
-               /* audio encoder attribute setting */
-               if(strcmp(aenc_name,"ari_amrnbenc") == 0) //ari_armnbenc supports attatching amr header
-               {
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "write-header", TRUE);
-               }
-               
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, "filesink", NULL, element_list, err);
        }
 
-       //Set basic infomation
-
-       if (info->bMuxing) /* IF MUX is indicated create MUX */
-       {
-               gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                                                                sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
-                                                                sc->element[_MMCAMCORDER_ENCSINK_BIN].gst,
-                                                                NULL);
-
-               srcpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
-               sinkpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+       /* Add and link elements */
+       if (info->bMuxing) {
+               /* IF MUX is indicated create MUX */
+               gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                                sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+                                sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
+                                NULL);
+
+               srcpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+               sinkpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
                _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
-       }
-       else /* IF MUX in not chosen then record in raw amr file */
-       {
-               if( !strcmp( aenc_name, "wavenc" ) )
-               {
-                       gst_bin_add_many( GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                                         sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
-                                         NULL );
-
-                       if (!_MM_GST_ELEMENT_LINK_MANY( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
-                                                       NULL ))
-                       {
+       } else {
+               /* IF MUX in not chosen then record in raw amr file */
+               if (!strcmp(aenc_name, "wavenc")) {
+                       gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                                        sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+                                        NULL);
+
+                       if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+                                                      NULL)) {
                                err = MM_ERROR_CAMCORDER_GST_LINK;
                                goto pipeline_creation_error;
                        }
-               }
-               else
-               {
-                       gst_bin_add_many( GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                                         sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_CONV].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
-                                         sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
-                                         NULL );
-
-                       if (!_MM_GST_ELEMENT_LINK_MANY( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_CONV].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
-                                                       sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
-                                                       NULL ))
-                       {
+               } else {
+                       gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                                        sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+                                        sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+                                        NULL);
+
+                       if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+                                                      sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+                                                      NULL)) {
                                err = MM_ERROR_CAMCORDER_GST_LINK;
                                goto pipeline_creation_error;
                        }
                }
-       }       
-
+       }
 
-       //set data probe function
-       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
+       /* set data probe function */
+       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
        MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_AUDIOREC,
-               __mmcamcorder_audio_dataprobe_voicerecorder, hcamcorder);       
+                                    __mmcamcorder_audio_dataprobe_voicerecorder, hcamcorder);
        gst_object_unref(srcpad);
        srcpad = NULL;
 
-       if(info->bMuxing)
-       {
-               MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, 
-                                                                               _MMCAMCORDER_HANDLER_AUDIOREC, 
-                                                                               "pad-added", 
-                                                                               __mmcamcorder_audiorec_pad_added_cb, 
-                                                                               hcamcorder);            
-       }
-       else
-       {
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
+       if (info->bMuxing) {
+               MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst,
+                                          _MMCAMCORDER_HANDLER_AUDIOREC,
+                                          "pad-added",
+                                          __mmcamcorder_audiorec_pad_added_cb,
+                                          hcamcorder);
+       } else {
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
                MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_AUDIOREC,
-                       __mmcamcorder_audio_dataprobe_record, hcamcorder);
+                                            __mmcamcorder_audio_dataprobe_record, hcamcorder);
                gst_object_unref(srcpad);
-               srcpad = NULL;          
+               srcpad = NULL;
        }
 
-       /*
-        * To get the message callback from the gstreamer.
-        * This can be used to make the API calls asynchronous
-        * as per LiMO compliancy
-        */
-       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
-       hcamcorder->pipeline_cb_event_id = gst_bus_add_watch( bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder );
-    gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, hcamcorder, NULL);
+       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
+       /* register message callback  */
+       hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder);
+
+       /* set sync callback */
+       gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, hcamcorder, NULL);
+
        gst_object_unref(bus);
+       bus = NULL;
+
+       if (element_list) {
+               g_list_free(element_list);
+               element_list = NULL;
+       }
 
        return MM_ERROR_NONE;
 
 pipeline_creation_error:
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AQUE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_CONV);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AENC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SINK);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_BIN);
+
+       if (element_list) {
+               g_list_free(element_list);
+               element_list = NULL;
+       }
+
        return err;
 }
 
@@ -271,7 +252,7 @@ _mmcamcorder_create_audio_pipeline(MMHandleType handle)
 {
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
@@ -303,36 +284,38 @@ _mmcamcorder_destroy_audio_pipeline(MMHandleType handle)
        mmf_return_if_fail(sc->element);
 
        info = sc->info_audio;
-       
-       _mmcam_dbg_log("");
 
-       if(sc->element[_MMCAMCORDER_MAIN_PIPE].gst)
-       {
-               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
+       _mmcam_dbg_log("start");
+
+       if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+               _mmcam_dbg_warn("release audio pipeline");
+
+               _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
 
                _mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
-               
-               if( info->bMuxing)
-               {
+
+               if (info->bMuxing) {
                        GstPad *reqpad = NULL;
-                       //release request pad
-                       /* FIXME */
-                       /*
-                           The ref_count of mux is always # of streams in here, i don't know why it happens. 
-                           So, i unref the mux manually 
-                       */                              
-                       reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
-                       gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
-                       gst_object_unref(reqpad);       
-                       
-                       if(GST_IS_ELEMENT(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst) && \
-                               GST_OBJECT_REFCOUNT_VALUE(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst) > 1)                                       
-                               gst_object_unref(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst);
+                       /* FIXME:
+                           Release request pad
+                           The ref_count of mux is always # of streams in here, i don't know why it happens.
+                           So, i unref the mux manually
+                       */
+                       reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+                       gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+                       gst_object_unref(reqpad);
+
+                       if(GST_IS_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst) &&
+                          GST_OBJECT_REFCOUNT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst) > 1) {
+                               gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst);
+                       }
                }
-               gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
-//             sc->element[_MMCAMCORDER_MAIN_PIPE].gst = NULL;
+               gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
        }
 
+       _mmcam_dbg_log("done");
+
+       return;
 }
 
 
@@ -361,7 +344,7 @@ void* _MMCamcorderStartHelperFunc(void *handle)
 
 void* _MMCamcorderStopHelperFunc(void *handle)
 {
-       mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);     
+       mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _mmcamcorder_set_state((MMHandleType)hcamcorder, hcamcorder->target_state);
 
        return NULL;
@@ -397,327 +380,275 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
 
        _mmcam_dbg_log("");
 
-       pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
-       audioSrc = sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst;
-       switch(cmd)
-       {
-               case _MMCamcorder_CMD_RECORD:
-                       //check status for resume case
-                       if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED) 
-                       {
-                               guint imax_size = 0;
-                               guint imax_time = 0;
-                               char *temp_filename = NULL;
-
-                               if(sc->pipeline_time) {
-                    gst_element_set_start_time(GST_ELEMENT(pipeline), sc->pipeline_time);
-                               }
-                               sc->pipeline_time = RESET_PAUSE_TIME;
-
-                               ret = mm_camcorder_get_attributes(handle, &err_attr_name,
-                                                                 MMCAM_TARGET_MAX_SIZE, &imax_size,
-                                                                 MMCAM_TARGET_TIME_LIMIT, &imax_time,
-                                                                 MMCAM_FILE_FORMAT, &(info->fileformat),
-                                                                 MMCAM_TARGET_FILENAME, &temp_filename, &size,
-                                                                 NULL);
-                               if (ret != MM_ERROR_NONE) {
-                                       _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
-                                       SAFE_FREE (err_attr_name);
-                                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
-                               }
+       pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst;
+       audioSrc = sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst;
+       switch (cmd) {
+       case _MMCamcorder_CMD_RECORD:
+               /* check status for resume case */
+               if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED) {
+                       guint imax_size = 0;
+                       guint imax_time = 0;
+                       char *temp_filename = NULL;
+                       int file_system_type = 0;
+
+                       if(sc->pipeline_time) {
+                               gst_element_set_start_time(pipeline, sc->pipeline_time);
+                       }
+                       sc->pipeline_time = RESET_PAUSE_TIME;
+
+                       ret = mm_camcorder_get_attributes(handle, &err_attr_name,
+                                                         MMCAM_TARGET_MAX_SIZE, &imax_size,
+                                                         MMCAM_TARGET_TIME_LIMIT, &imax_time,
+                                                         MMCAM_FILE_FORMAT, &(info->fileformat),
+                                                         MMCAM_TARGET_FILENAME, &temp_filename, &size,
+                                                         NULL);
+                       if (ret != MM_ERROR_NONE) {
+                               _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
+                               SAFE_FREE(err_attr_name);
+                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
+                       }
 
-                               info->filename = strdup(temp_filename);
-                               if (!info->filename)
-                               {
-                                       _mmcam_dbg_err("STRDUP was failed");
-                                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
-                               }
-                               
-                               _mmcam_dbg_log("Record start : set file name using attribute - %s\n ",info->filename);
+                       if (temp_filename == NULL) {
+                               _mmcam_dbg_err("filename is not set");
+                               ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
+                       }
 
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
+                       info->filename = strdup(temp_filename);
+                       if (!info->filename) {
+                               _mmcam_dbg_err("STRDUP was failed");
+                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
+                       }
 
-                               sc->ferror_send = FALSE;
-                               sc->ferror_count = 0;
-                               sc->bget_eos = FALSE;
-                               info->filesize =0;
+                       _mmcam_dbg_log("Record start : set file name using attribute - %s\n ",info->filename);
 
-                               /* set max size */
-                               if (imax_size <= 0) {
-                                       info->max_size = 0; /* do not check */
-                               } else {
-                                       info->max_size = ((guint64)imax_size) << 10; /* to byte */
-                               }
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
 
-                               /* set max time */
-                               if (imax_time <= 0) {
-                                       info->max_time = 0; /* do not check */
-                               } else {
-                                       info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
-                               }
+                       sc->ferror_send = FALSE;
+                       sc->ferror_count = 0;
+                       sc->bget_eos = FALSE;
+                       info->filesize =0;
 
-                               dir_name = g_path_get_dirname(info->filename);
-                               if (dir_name) {
-                                       err = _mmcamcorder_get_freespace(dir_name, &free_space);
+                       /* set max size */
+                       if (imax_size <= 0) {
+                               info->max_size = 0; /* do not check */
+                       } else {
+                               info->max_size = ((guint64)imax_size) << 10; /* to byte */
+                       }
 
-                                       _mmcam_dbg_warn("current space for recording - %s : [%" G_GUINT64_FORMAT "]",
-                                                       dir_name, free_space);
+                       /* set max time */
+                       if (imax_time <= 0) {
+                               info->max_time = 0; /* do not check */
+                       } else {
+                               info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+                       }
 
-                                       g_free(dir_name);
-                                       dir_name = NULL;
+                       /* TODO : check free space before recording start */
+                       dir_name = g_path_get_dirname(info->filename);
+                       if (dir_name) {
+                               err = _mmcamcorder_get_freespace(dir_name, &free_space);
+                               _mmcam_dbg_warn("current space for recording - %s :[%" G_GUINT64_FORMAT "]" ,dir_name, free_space);
+
+                               if (_mmcamcorder_get_file_system_type(dir_name, &file_system_type) == 0) {
+                                       /* MSDOS_SUPER_MAGIC : 0x4d44 */
+                                       if (file_system_type == MSDOS_SUPER_MAGIC &&
+                                           (info->max_size == 0 || info->max_size > FAT32_FILE_SYSTEM_MAX_SIZE)) {
+                                               _mmcam_dbg_warn("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %"G_GUINT64_FORMAT,
+                                                               info->max_size, FAT32_FILE_SYSTEM_MAX_SIZE);
+                                               info->max_size = FAT32_FILE_SYSTEM_MAX_SIZE;
+                                       } else {
+                                               _mmcam_dbg_warn("file system 0x%x, max size %"G_GUINT64_FORMAT,
+                                                               file_system_type, info->max_size);
+                                       }
                                } else {
-                                       _mmcam_dbg_err("failed to get directory name");
-                                       err = -1;
+                                       _mmcam_dbg_warn("_mmcamcorder_get_file_system_type failed");
                                }
 
-                               if ((err == -1) || free_space <= (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024))) {
-                                       _mmcam_dbg_err("OUT of STORAGE [err:%d or free space [%" G_GUINT64_FORMAT "] is smaller than [%d]",
-                                                      err, free_space, (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024)));
-                                       return MM_ERROR_OUT_OF_STORAGE;
-                               }
+                               g_free(dir_name);
+                               dir_name = NULL;
+                       } else {
+                               _mmcam_dbg_err("failed to get directory name");
+                               err = -1;
                        }
 
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-                       if(ret<0) {
-                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
+                       if ((err == -1) || free_space <= (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024))) {
+                               _mmcam_dbg_err("OUT of STORAGE [err:%d or free space [%" G_GUINT64_FORMAT "] is smaller than [%d]",
+                                              err, free_space, (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024)));
+                               return MM_ERROR_OUT_OF_STORAGE;
                        }
-                       break;
+               }
 
-               case _MMCamcorder_CMD_PAUSE:
-                       {
-                               GstClock *clock = NULL;
-                               int count = 0;
-                               
-                               if (info->b_commiting)
-                               {
-                                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                                       return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
-                               }
+               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+               if (ret != MM_ERROR_NONE) {
+                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
+               }
+               break;
 
-                               for(count=0; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++)
-                               {
-                                       if(info->filesize > 0)
-                                       {
-                                               break;
-                                       }
-                                       else if(count == _MMCAMCORDER_RETRIAL_COUNT)
-                                       {
-                                               _mmcam_dbg_err("Pause fail, we are waiting for 100 milisecond, but still file size is %" G_GUINT64_FORMAT "", 
-                                                                       info->filesize);
-                                               return MM_ERROR_CAMCORDER_INVALID_CONDITION;
-                                       }
-                                       else
-                                       {
-                                               _mmcam_dbg_warn("Pause is Waiting for enough audio frame, retrial count[%d], file size is %" G_GUINT64_FORMAT "", 
-                                                                       count, info->filesize);                                 
-                                       }
-                                       usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
-                               }
+       case _MMCamcorder_CMD_PAUSE:
+       {
+               GstClock *pipe_clock = NULL;
+               int count = 0;
 
-                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
-                               if(ret<0) {
-                                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
-                               }       
-                               //fixed me. consider delay.
-                               clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
-                               sc->pipeline_time = gst_clock_get_time(clock) - gst_element_get_base_time(GST_ELEMENT(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
-                       }
-                       break;
+               if (info->b_commiting) {
+                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+               }
 
-               case _MMCamcorder_CMD_CANCEL:
-                       if (info->b_commiting)
-                       {
-                               _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                               return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
-                       }
-                       
-//                     ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-                       if(ret<0) {
-                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
+               for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
+                       if (info->filesize > 0) {
+                               break;
+                       } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
+                               _mmcam_dbg_err("Pause fail, wait 200 ms, but file size is %lld",
+                                              info->filesize);
+                               return MM_ERROR_CAMCORDER_INVALID_CONDITION;
+                       } else {
+                               _mmcam_dbg_warn("Wait for enough audio frame, retry count[%d], file size is %lld",
+                                               count, info->filesize);
                        }
+                       usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+               }
 
-                       if(info->bMuxing)
-                       {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
-                       }
-                       else
-                       {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
-                       }
+               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
+               if (ret != MM_ERROR_NONE) {
+                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
+               }
 
-                       _mmcamcorder_gst_set_state(handle,  sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
-
-                       sc->pipeline_time = 0;
-                       sc->pause_time = 0;
-                       sc->isMaxsizePausing = FALSE;
-                       sc->isMaxtimePausing = FALSE;
-                       
-                       if(info->filename)
-                       {
-                               _mmcam_dbg_log("file delete(%s)", info->filename);
-                               unlink(info->filename);
-                               g_free(info->filename);
-                               info->filename = NULL;                                  
-                       }
+               /* FIXME: consider delay. */
+               pipe_clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
+               sc->pipeline_time = gst_clock_get_time(pipe_clock) - gst_element_get_base_time(GST_ELEMENT(pipeline));
+               break;
+       }
 
-                       break;
-               case _MMCamcorder_CMD_COMMIT:
-               {
-                       int count = 0;
-                       g_print("\n\n _MMCamcorder_CMD_COMMIT\n\n");
+       case _MMCamcorder_CMD_CANCEL:
+               if (info->b_commiting) {
+                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+               }
 
-                       if (info->b_commiting)
-                       {
-                               _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                               return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
-                       }
-                       else
-                       {
-                               _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
-                               info->b_commiting = TRUE;
-                       }                       
-                       
-                       for(count=0; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++)
-                       {
-                               if(info->filesize > 0)
-                               {
-                                       break;
-                               }
-                               else if(count == _MMCAMCORDER_RETRIAL_COUNT)
-                               {
-                                       _mmcam_dbg_err("Commit fail, we are waiting for 100 milisecond, but still file size is %" G_GUINT64_FORMAT "", 
-                                                               info->filesize);
+               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+               if (ret != MM_ERROR_NONE) {
+                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
+               }
+
+               if (info->bMuxing) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+               } else {
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
+               }
+
+               _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
+
+               sc->pipeline_time = 0;
+               sc->pause_time = 0;
+               sc->isMaxsizePausing = FALSE;
+               sc->isMaxtimePausing = FALSE;
+
+               if (info->filename) {
+                       _mmcam_dbg_log("file delete(%s)", info->filename);
+                       unlink(info->filename);
+                       g_free(info->filename);
+                       info->filename = NULL;
+               }
+               break;
+
+       case _MMCamcorder_CMD_COMMIT:
+       {
+               int count = 0;
+
+               _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT");
+
+               if (info->b_commiting) {
+                       _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+                       return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+               } else {
+                       _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
+                       info->b_commiting = TRUE;
+               }
+
+               for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
+                       if (info->filesize > 0) {
+                               break;
+                       } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
+                               _mmcam_dbg_err("Commit fail, waited 200 ms, but file size is %lld", info->filesize);
                                        info->b_commiting = FALSE;
-                                       return MM_ERROR_CAMCORDER_INVALID_CONDITION;                                            
-                               }
-                               else
-                               {
-                                       _mmcam_dbg_warn("Commit is Waiting for enough audio frame, retrial count[%d], file size is %" G_GUINT64_FORMAT "", 
-                                                               count, info->filesize);                                 
-                               }
-                               usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
-                       }
-                       
-                       if (audioSrc) {
-                               GstPad *pad = gst_element_get_static_pad (audioSrc, "src");
-//                             gst_pad_push_event (pad, gst_event_new_eos());
-                               ret = gst_element_send_event(audioSrc, gst_event_new_eos());
-                               gst_object_unref(pad);
-                               pad = NULL;                                     
-                               if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) // for pause -> commit case
-                               {                               
-                                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);  
-                                       if(ret<0) {
-                                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
-                                       }                               
-                               }
-                               
+                               return MM_ERROR_CAMCORDER_INVALID_CONDITION;
+                       } else {
+                               _mmcam_dbg_warn("Waiting for enough audio frame, re-count[%d], file size is %lld",
+                                                count, info->filesize);
                        }
+                       usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+               }
 
-                       //wait until finishing EOS
-                       _mmcam_dbg_log("Start to wait EOS");
-                       if ((ret =_mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE)
-                       {
-                               goto _ERR_CAMCORDER_AUDIO_COMMAND;
-                       }
-/*
-                        while ((!sc->get_eos)&&((retry_cnt--) > 0)) {
-                               if ((gMessage = gst_bus_timed_pop (bus, timeout)) != NULL)
-                               {
-                                       if (GST_MESSAGE_TYPE(gMessage) ==GST_MESSAGE_EOS)
-                                       {
-                                               _mmcam_dbg_log("Get a EOS message");
-                                               gst_message_unref(gMessage);
-                                               break;
-                                       }
-                                       else
-                                       {
-                                               _mmcam_dbg_log("Get another message(%x). Post this message to bus again.", GST_MESSAGE_TYPE(gMessage));
-                                               gst_bus_post(bus, gMessage);
-                                       }
+               if (audioSrc) {
+                       ret = gst_element_send_event(audioSrc, gst_event_new_eos());
+                       /* for pause -> commit case */
+                       if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) {
+                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+                               if (ret != MM_ERROR_NONE) {
+                                       info->b_commiting = FALSE;
+                                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
                                }
-                               else
-                               {
-                                       _mmcam_dbg_log("timeout of gst_bus_timed_pop()");
-                                       break;
-                               }                                       
-                               
-                               usleep(100);            //To Prevent busy waiting
                        }
+               }
 
-                       _mmcamcorder_audio_handle_eos((MMHandleType)hcamcorder);
-*/
-
-
+               /* wait until finishing EOS */
+               _mmcam_dbg_log("Start to wait EOS");
+               if ((ret =_mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE) {
+                       info->b_commiting = FALSE;
+                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
                }
-                       break;
+               break;
+       }
 
-               case _MMCamcorder_CMD_PREVIEW_START:
-               //      MM_CAMCORDER_START_CHANGE_STATE; 
-                       break;
-               case _MMCamcorder_CMD_PREVIEW_STOP:
-               //      MM_CAMCORDER_STOP_CHANGE_STATE; 
-                       //void
-                       break;
+       case _MMCamcorder_CMD_PREVIEW_START:
+               //MM_CAMCORDER_START_CHANGE_STATE;
+               break;
 
-               default:
-                       ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
-                       break;
+       case _MMCamcorder_CMD_PREVIEW_STOP:
+               //MM_CAMCORDER_STOP_CHANGE_STATE;
+               //void
+               break;
+
+       default:
+               ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+               break;
        }
 
 _ERR_CAMCORDER_AUDIO_COMMAND:
        return ret;
-
 }
 
-int
-_mmcamcorder_audio_handle_eos(MMHandleType handle)
+int _mmcamcorder_audio_handle_eos(MMHandleType handle)
 {
+       int err = MM_ERROR_NONE;
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       _MMCamcorderAudioInfo   *info   = NULL;
-       GstElement                              *pipeline = NULL;
+       _MMCamcorderAudioInfo *info = NULL;
+       GstElement *pipeline = NULL;
        _MMCamcorderMsgItem msg;
        MMCamRecordingReport * report;
 
-       int err = MM_ERROR_NONE;
-               
        mmf_return_val_if_fail(hcamcorder, FALSE);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
        mmf_return_val_if_fail(sc, FALSE);
        mmf_return_val_if_fail(sc->info_audio, FALSE);
-       
+
        _mmcam_dbg_err("");
 
        info = sc->info_audio;
 
-       //changing pipeline for display
-       pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
-       
+       pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst;
 
-       __ta__("        _MMCamcorder_CMD_COMMIT:GST_STATE_READY",  
        err = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-       );
-
-       if( err != MM_ERROR_NONE )
-       {
-               _mmcam_dbg_warn( "Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err );
+       if (err != MM_ERROR_NONE) {
+               _mmcam_dbg_warn("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err);
        }
 
-//     __ta__("        _MMCamcorder_CMD_COMMIT:GST_STATE_NULL",  
-//     _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
-//     )       
-
-       //Send message  
-       //Send recording report to application
+       /* Send recording report message to application */
        msg.id = MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED;
-
-       report = (MMCamRecordingReport*) malloc(sizeof(MMCamRecordingReport));  //who free this?
-       if (!report)
-       {
-               //think more.
+       report = (MMCamRecordingReport*) malloc(sizeof(MMCamRecordingReport));
+       if (!report) {
                _mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename);
                return FALSE;
        }
@@ -727,16 +658,13 @@ _mmcamcorder_audio_handle_eos(MMHandleType handle)
 
        _mmcamcroder_send_message(handle, &msg);
 
-       
-       if(info->bMuxing)
-       {
-               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+       if (info->bMuxing) {
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+       } else {
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
        }
-       else
-       {
-               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
-       }       
-       _mmcamcorder_gst_set_state(handle,  sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
+
+       _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
 
        sc->pipeline_time = 0;
        sc->pause_time = 0;
@@ -757,8 +685,9 @@ _mmcamcorder_audio_handle_eos(MMHandleType handle)
 static float
 __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat format)
 {
-       #define MAX_AMPLITUDE_MEAN_16BIT 23170.115738161934
-       #define MAX_AMPLITUDE_MEAN_08BIT    89.803909382810
+       #define MAX_AMPLITUDE_MEAN_16BIT (23170.115738161934)
+       #define MAX_AMPLITUDE_MEAN_08BIT (89.803909382810)
+       #define DEFAULT_DECIBEL          (-80.0)
 
        int i = 0;
        int depthByte = 0;
@@ -767,7 +696,7 @@ __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat f
        short* pcm16 = 0;
        char* pcm8 = 0;
 
-       float db = 0.0;
+       float db = DEFAULT_DECIBEL;
        float rms = 0.0;
        unsigned long long square_sum = 0;
 
@@ -792,12 +721,14 @@ __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat f
                count++;
        }
 
-       rms = sqrt( square_sum/count );
-
-       if (depthByte == 1)
-               db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT );
-       else
-               db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_16BIT );
+       if (count > 0) {
+               rms = sqrt( square_sum/count );
+               if (depthByte == 1) {
+                       db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT );
+               } else {
+                       db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_16BIT );
+               }
+       }
 
        /*
        _mmcam_dbg_log("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]",
@@ -818,10 +749,10 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
        _MMCamcorderMsgItem msg;
        int err = MM_ERROR_UNKNOWN;
        char *err_name = NULL;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
-    GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstMapInfo mapinfo = GST_MAP_INFO_INIT;
 
-       mmf_return_val_if_fail(hcamcorder, FALSE);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
 
        /* Set volume to audio input */
        err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_name,
@@ -829,41 +760,35 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
                                                                        MMCAM_AUDIO_FORMAT, &format,
                                                                        MMCAM_AUDIO_CHANNEL, &channel,
                                                                        NULL);
-       if (err < 0) 
-       {
+       if (err < 0) {
                _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
-               SAFE_FREE (err_name);
+               SAFE_FREE(err_name);
                return err;
        }
-       
-       if(volume == 0) //mute
-    {
-        gst_buffer_map(buffer, &mapinfo, GST_MAP_WRITE);
-        memset(mapinfo.data, 0, mapinfo.size);
-        gst_buffer_unmap(buffer, &mapinfo);
-    }
+
+       gst_buffer_map(buffer, &mapinfo, GST_MAP_READWRITE);
+
+       if(volume == 0){
+               memset(mapinfo.data, 0, mapinfo.size);
+       }
 
        /* Get current volume level of real input stream */
-    gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
-//     currms = __mmcamcorder_get_RMS(GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer), depth);
-       __ta__( "__mmcamcorder_get_decibel",
-    curdcb = __mmcamcorder_get_decibel(mapinfo.data, mapinfo.size, format);
-       );
+       curdcb = __mmcamcorder_get_decibel(mapinfo.data, mapinfo.size, format);
 
        msg.id = MM_MESSAGE_CAMCORDER_CURRENT_VOLUME;
        msg.param.rec_volume_dB = curdcb;
        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
        /* CALL audio stream callback */
-    if ((hcamcorder->astream_cb) && buffer && mapinfo.data && mapinfo.size > 0)
+       if ((hcamcorder->astream_cb) && buffer && mapinfo.data && mapinfo.size > 0)
        {
                MMCamcorderAudioStreamDataType stream;
 
                if (_mmcamcorder_get_state((MMHandleType)hcamcorder) < MM_CAMCORDER_STATE_PREPARE)
                {
                        _mmcam_dbg_warn("Not ready for stream callback");
-            gst_buffer_unmap(buffer, &mapinfo);
-            return GST_PAD_PROBE_OK;
+                       gst_buffer_unmap(buffer, &mapinfo);
+                       return GST_PAD_PROBE_OK;
                }
 
                /*
@@ -871,11 +796,11 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
                               GST_BUFFER_DATA(buffer), format, channel, GST_BUFFER_SIZE(buffer), curdcb);
                */
 
-        stream.data = mapinfo.data;
+               stream.data = (void *)mapinfo.data;
                stream.format = format;
                stream.channel = channel;
-        stream.length = mapinfo.size;
-               stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000);        //nano -> msecond
+               stream.length = mapinfo.size;
+               stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000);      //nano -> msecond
                stream.volume_dB = curdcb;
 
                _MMCAMCORDER_LOCK_ASTREAM_CALLBACK( hcamcorder );
@@ -887,9 +812,9 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad
 
                _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK( hcamcorder );
        }
-    gst_buffer_unmap(buffer, &mapinfo);
 
-    return GST_PAD_PROBE_OK;
+       gst_buffer_unmap(buffer, &mapinfo);
+       return GST_PAD_PROBE_OK;
 }
 
 
@@ -907,7 +832,7 @@ __mmcamcorder_audiorec_pad_added_cb(GstElement *element, GstPad *pad,  MMHandleT
        }
        else
        {
-               _mmcam_dbg_warn("Unknow pad is added, check it : [%s]", GST_PAD_NAME(pad));     
+               _mmcam_dbg_warn("Unknow pad is added, check it : [%s]", GST_PAD_NAME(pad));
        }
 
        return;
@@ -926,52 +851,52 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
 
        _MMCamcorderSubContext *sc = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
-    _MMCamcorderAudioInfo *audioinfo = NULL;
+       _MMCamcorderAudioInfo *audioinfo = NULL;
        _MMCamcorderMsgItem msg;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
 
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-       mmf_return_val_if_fail(buffer, FALSE);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
-       mmf_return_val_if_fail(sc && sc->info_audio, FALSE);
-    audioinfo = sc->info_audio;
+       mmf_return_val_if_fail(sc && sc->info_audio, GST_PAD_PROBE_DROP);
+       audioinfo = sc->info_audio;
 
        if (sc->isMaxtimePausing || sc->isMaxsizePausing) {
                _mmcam_dbg_warn("isMaxtimePausing[%d],isMaxsizePausing[%d]",
                                sc->isMaxtimePausing, sc->isMaxsizePausing);
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
-    buffer_size = gst_buffer_get_size(buffer);
+       buffer_size = gst_buffer_get_size(buffer);
 
-    if (audioinfo->filesize == 0) {
-        if (audioinfo->fileformat == MM_FILE_FORMAT_WAV) {
-            audioinfo->filesize += 44; /* wave header size */
-        } else if (audioinfo->fileformat == MM_FILE_FORMAT_AMR) {
-            audioinfo->filesize += 6; /* amr header size */
+       if (audioinfo->filesize == 0) {
+               if (audioinfo->fileformat == MM_FILE_FORMAT_WAV) {
+                       audioinfo->filesize += 44; /* wave header size */
+               } else if (audioinfo->fileformat == MM_FILE_FORMAT_AMR) {
+                       audioinfo->filesize += 6; /* amr header size */
                }
 
-        audioinfo->filesize += buffer_size;
-        return GST_PAD_PROBE_OK;
+               audioinfo->filesize += buffer_size;
+               return GST_PAD_PROBE_OK;
        }
 
        if (sc->ferror_send) {
                _mmcam_dbg_warn("file write error, drop frames");
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        /* get trailer size */
-    if (audioinfo->fileformat == MM_FILE_FORMAT_3GP ||
-        audioinfo->fileformat == MM_FILE_FORMAT_MP4 ||
-        audioinfo->fileformat == MM_FILE_FORMAT_AAC) {
-               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+       if (audioinfo->fileformat == MM_FILE_FORMAT_3GP ||
+                       audioinfo->fileformat == MM_FILE_FORMAT_MP4 ||
+                       audioinfo->fileformat == MM_FILE_FORMAT_AAC) {
+               MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
                /*_mmcam_dbg_log("trailer_size %d", trailer_size);*/
        } else {
                trailer_size = 0; /* no trailer */
        }
 
-    filename = audioinfo->filename;
+       filename = audioinfo->filename;
 
        /* to minimizing free space check overhead */
        count = count % _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL;
@@ -997,44 +922,44 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                                sc->ferror_count++;
                        }
 
-            return GST_PAD_PROBE_DROP; /* skip this buffer */
+                       return GST_PAD_PROBE_DROP; /* skip this buffer */
 
                default: /* succeeded to get free space */
                        /* check free space for recording */
                        if (free_space < (guint64)(_MMCAMCORDER_AUDIO_MINIMUM_SPACE + buffer_size + trailer_size)) {
                                _mmcam_dbg_warn("No more space for recording!!!");
                                _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]",
-                                free_space, audioinfo->filesize);
+                                               free_space, audioinfo->filesize);
 
-                if (audioinfo->bMuxing) {
-                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+                               if (audioinfo->bMuxing) {
+                                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
                                } else {
-                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+                                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
                                }
 
                                sc->isMaxsizePausing = TRUE;
                                msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
                                _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
-                return GST_PAD_PROBE_DROP; /* skip this buffer */
+                               return GST_PAD_PROBE_DROP; /* skip this buffer */
                        }
                        break;
                }
        }
 
-       if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(buffer))) {
+       if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) {
                _mmcam_dbg_err("Buffer timestamp is invalid, check it");
-               return FALSE;
+               return GST_PAD_PROBE_DROP;
        }
 
-       rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer));
+       rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer));
 
        /* calculate remained time can be recorded */
-    if (audioinfo->max_time > 0 && audioinfo->max_time < (remained_time + rec_pipe_time)) {
-        remained_time = audioinfo->max_time - rec_pipe_time;
-    } else if (audioinfo->max_size > 0) {
-        long double max_size = (long double)audioinfo->max_size;
-        long double current_size = (long double)(audioinfo->filesize + buffer_size + trailer_size);
+       if (audioinfo->max_time > 0 && audioinfo->max_time < (remained_time + rec_pipe_time)) {
+               remained_time = audioinfo->max_time - rec_pipe_time;
+       } else if (audioinfo->max_size > 0) {
+               long double max_size = (long double)audioinfo->max_size;
+               long double current_size = (long double)(audioinfo->filesize + buffer_size + trailer_size);
 
                remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
        }
@@ -1042,44 +967,44 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
        /*_mmcam_dbg_log("remained time : %u", remained_time);*/
 
        /* check max size of recorded file */
-    if (audioinfo->max_size > 0 &&
-        audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+       if (audioinfo->max_size > 0 &&
+                       audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
                _mmcam_dbg_warn("Max size!!! Recording is paused.");
                _mmcam_dbg_warn("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \
-                        audioinfo->max_size, audioinfo->filesize, trailer_size);
+                               audioinfo->max_size, audioinfo->filesize, trailer_size);
 
                /* just same as pause status. After blocking two queue, this function will not call again. */
-        if (audioinfo->bMuxing) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+               if (audioinfo->bMuxing) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
                } else {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
                }
 
                msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
                msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-        msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
+               msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
                msg.param.recording_status.remained_time = 0;
                _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
-        _mmcam_dbg_log("Last filesize sent by message : %d", audioinfo->filesize + trailer_size);
+               _mmcam_dbg_warn("Last filesize sent by message : %d", audioinfo->filesize + trailer_size);
 
                sc->isMaxsizePausing = TRUE;
                msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
                _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
                /* skip this buffer */
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        /* check recording time limit and send recording status message */
-    if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
+       if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
                _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
-                        rec_pipe_time, audioinfo->max_time);
+                               rec_pipe_time, audioinfo->max_time);
 
-        if (audioinfo->bMuxing) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+               if (audioinfo->bMuxing) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
                } else {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
                }
 
                sc->isMaxtimePausing = TRUE;
@@ -1087,22 +1012,22 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa
                _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
                /* skip this buffer */
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        /* send message for recording time and recorded file size */
-    if (audioinfo->b_commiting == FALSE) {
-        audioinfo->filesize += buffer_size;
+       if (audioinfo->b_commiting == FALSE) {
+               audioinfo->filesize += buffer_size;
 
                msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
                msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-        msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
+               msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
                msg.param.recording_status.remained_time = remained_time;
                _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
-        return GST_PAD_PROBE_OK;
+               return GST_PAD_PROBE_OK;
        } else {
                /* skip this buffer if commit process has been started */
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 }
index 0aeb36e..168ec19 100644 (file)
 /*-----------------------------------------------------------------------
 |    LOCAL VARIABLE DEFINITIONS                                                |
 -----------------------------------------------------------------------*/
-static int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM] = { 0, };
-static int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM] = { 0, };
 
-static conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM] = { NULL, };
-static conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM] = { NULL, };
-
-/*
- * Videosrc element default value
- */
-static type_element _videosrc_element_default = {
-       "VideosrcElement",
-       "videotestsrc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- * Audiosrc element default value
- */
-static type_int  ___audiosrc_default_channel           = { "Channel", 1 };
-static type_int  ___audiosrc_default_bitrate           = { "BitRate", 8000 };
-static type_int  ___audiosrc_default_depth             = { "Depth", 16 };
-static type_int  ___audiosrc_default_blocksize = { "BlockSize", 1280 };
-static type_int* __audiosrc_default_int_array[]        = {
-       &___audiosrc_default_channel,
-       &___audiosrc_default_bitrate,
-       &___audiosrc_default_depth,
-       &___audiosrc_default_blocksize,
-};
-static type_string  ___audiosrc_default_device = { "Device", "default" };
-static type_string* __audiosrc_default_string_array[]  = {
-       &___audiosrc_default_device,
-};
-static type_element _audiosrc_element_default = {
-       "AudiosrcElement",
-       "audiotestsrc",
-       __audiosrc_default_int_array,
-       sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
-       __audiosrc_default_string_array,
-       sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
-};
-
-static type_element _audiomodemsrc_element_default = {
-       "AudiomodemsrcElement",
-       "audiotestsrc",
-       __audiosrc_default_int_array,
-       sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
-       __audiosrc_default_string_array,
-       sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
-};
-
-
-/*
- * Videosink element default value
- */
-static type_int  ___videosink_default_display_id       = { "display-id", 3 };
-static type_int  ___videosink_default_x                        = { "x", 0 };
-static type_int  ___videosink_default_y                        = { "y", 0 };
-static type_int  ___videosink_default_width            = { "width", 800 };
-static type_int  ___videosink_default_height   = { "height", 480 };
-static type_int  ___videosink_default_rotation = { "rotation", 1 };
-static type_int* __videosink_default_int_array[]       = {
-       &___videosink_default_display_id,
-       &___videosink_default_x,
-       &___videosink_default_y,
-       &___videosink_default_width,
-       &___videosink_default_height,
-       &___videosink_default_rotation,
-};
-static type_string* __videosink_default_string_array[] = { NULL };
-static type_element _videosink_element_x_default = {
-       "VideosinkElementX",
-       "xvimagesink",
-       __videosink_default_int_array,
-       sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
-       __videosink_default_string_array,
-       sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_evas_default = {
-       "VideosinkElementEvas",
-       "evasimagesink",
-       __videosink_default_int_array,
-       sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
-       __videosink_default_string_array,
-       sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_gl_default = {
-       "VideosinkElementGL",
-       "glimagesink",
-       __videosink_default_int_array,
-       sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
-       __videosink_default_string_array,
-       sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_null_default = {
-       "VideosinkElementNull",
-       "fakesink",
-       __videosink_default_int_array,
-       sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
-       __videosink_default_string_array,
-       sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-
-/*
- * Videoscale element default value
- */
-static type_element _videoscale_element_default = {
-       "VideoscaleElement",
-       "videoscale",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- * Record sink element default value
- */
-static type_element _recordsink_element_default = {
-       "RecordsinkElement",
-       "fakesink",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  H263 element default value
- */
-static type_element _h263_element_default = {
-       "H263",
-       "avenc_h263",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  H264 element default value
- */
-static type_element _h264_element_default = {
-       "H264",
-       "savsenc_h264",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  H26L element default value
- */
-static type_element _h26l_element_default = {
-       "H26L",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MPEG4 element default value
- */
-static type_element _mpeg4_element_default = {
-       "MPEG4",
-       "avenc_mpeg4",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MPEG1 element default value
- */
-static type_element _mpeg1_element_default = {
-       "MPEG1",
-       "avenc_mpeg1video",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  THEORA element default value
- */
-static type_element _theora_element_default = {
-       "THEORA",
-       "theoraenc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  AMR element default value
- */
-static type_element _amr_element_default = {
-       "AMR",
-       "secenc_amr",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  G723_1 element default value
- */
-static type_element _g723_1_element_default = {
-       "G723_1",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MP3 element default value
- */
-static type_element _mp3_element_default = {
-       "MP3",
-       "lame",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  AAC element default value
- */
-static type_element _aac_element_default = {
-       "AAC",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MMF element default value
- */
-static type_element _mmf_element_default = {
-       "MMF",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  ADPCM element default value
- */
-static type_element _adpcm_element_default = {
-       "ADPCM",
-       "avenc_adpcm_ima_qt",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  WAVE element default value
- */
-static type_element _wave_element_default = {
-       "WAVE",
-       "wavenc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-static type_element _vorbis_element_default = {
-       "VORBIS",
-       "vorbisenc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MIDI element default value
- */
-static type_element _midi_element_default = {
-       "MIDI",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  IMELODY element default value
- */
-static type_element _imelody_element_default = {
-       "IMELODY",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  JPEG element default value
- */
-static type_element _jpeg_element_default = {
-       "JPEG",
-       "secjpeg_enc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  PNG element default value
- */
-static type_element _png_element_default = {
-       "PNG",
-       "pngenc",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  BMP element default value
- */
-static type_element _bmp_element_default = {
-       "BMP",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  WBMP element default value
- */
-static type_element _wbmp_element_default = {
-       "WBMP",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  TIFF element default value
- */
-static type_element _tiff_element_default = {
-       "TIFF",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  PCX element default value
- */
-static type_element _pcx_element_default = {
-       "PCX",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  GIF element default value
- */
-static type_element _gif_element_default = {
-       "GIF",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  ICO element default value
- */
-static type_element _ico_element_default = {
-       "ICO",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  RAS element default value
- */
-static type_element _ras_element_default = {
-       "RAS",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  TGA element default value
- */
-static type_element _tga_element_default = {
-       "TGA",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  XBM element default value
- */
-static type_element _xbm_element_default = {
-       "XBM",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  XPM element default value
- */
-static type_element _xpm_element_default = {
-       "XPM",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  3GP element default value
- */
-static type_element _3gp_element_default = {
-       "3GP",
-       "avmux_3gp",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  AMR mux element default value
- */
-static type_element _amrmux_element_default = {
-       "AMR",
-       "avmux_amr",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MP4 element default value
- */
-static type_element _mp4_element_default = {
-       "MP4",
-       "avmux_mp4",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  AAC mux element default value
- */
-static type_element _aacmux_element_default = {
-       "AAC",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MP3 mux element default value
- */
-static type_element _mp3mux_element_default = {
-       "MP3",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  OGG element default value
- */
-static type_element _ogg_element_default = {
-       "OGG",
-       "oggmux",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  WAV element default value
- */
-static type_element _wav_element_default = {
-       "WAV",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  AVI element default value
- */
-static type_element _avi_element_default = {
-       "AVI",
-       "avimux",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  WMA element default value
- */
-static type_element _wma_element_default = {
-       "WMA",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  WMV element default value
- */
-static type_element _wmv_element_default = {
-       "WMV",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MID element default value
- */
-static type_element _mid_element_default = {
-       "MID",
-       NULL,
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MMF mux element default value
- */
-static type_element _mmfmux_element_default = {
-       "MMF",
-       "avmux_mmf",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- *  MATROSKA element default value
- */
-static type_element _matroska_element_default = {
-       "MATROSKA",
-       "matroskamux",
-       NULL,
-       0,
-       NULL,
-       0,
-};
-
-/*
- * [General] matching table
- */
-static conf_info_table conf_main_general_table[] = {
-       { "SyncStateChange", CONFIGURE_VALUE_INT,           {1} },
-       { "GSTInitOption",   CONFIGURE_VALUE_STRING_ARRAY,  {(int)NULL} },
-       { "ModelName",       CONFIGURE_VALUE_STRING,        {(int)"Samsung Camera"} },
-       { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY,  {(int)NULL} },
-};
-
-/*
- * [VideoInput] matching table
- */
-static conf_info_table conf_main_video_input_table[] = {
-       { "UseConfCtrl",        CONFIGURE_VALUE_INT,            {1} },
-       { "ConfCtrlFile0",      CONFIGURE_VALUE_STRING,         {(int)"mmfw_camcorder_dev_video_pri.ini"} },
-       { "ConfCtrlFile1",      CONFIGURE_VALUE_STRING,         {(int)"mmfw_camcorder_dev_video_sec.ini"} },
-       { "VideosrcElement",    CONFIGURE_VALUE_ELEMENT,        {(int)&_videosrc_element_default} },
-       { "UseVideoscale",      CONFIGURE_VALUE_INT,            {0} },
-       { "VideoscaleElement",  CONFIGURE_VALUE_ELEMENT,        {(int)&_videoscale_element_default} },
-       { "UseZeroCopyFormat",  CONFIGURE_VALUE_INT,            {0} },
-       { "DeviceCount",        CONFIGURE_VALUE_INT,            {MM_VIDEO_DEVICE_NUM} },
-};
-
-/*
- * [AudioInput] matching table
- */
-static conf_info_table conf_main_audio_input_table[] = {
-       { "AudiosrcElement",      CONFIGURE_VALUE_ELEMENT, {(int)&_audiosrc_element_default} },
-       { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {(int)&_audiomodemsrc_element_default} },
-};
-
-/*
- * [VideoOutput] matching table
- */
-static conf_info_table conf_main_video_output_table[] = {
-       { "DisplayDevice",         CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "DisplayMode",           CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "Videosink",             CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "VideosinkElementX",     CONFIGURE_VALUE_ELEMENT,   {(int)&_videosink_element_x_default} },
-       { "VideosinkElementEvas",  CONFIGURE_VALUE_ELEMENT,   {(int)&_videosink_element_evas_default} },
-       { "VideosinkElementGL",    CONFIGURE_VALUE_ELEMENT,   {(int)&_videosink_element_gl_default} },
-       { "VideosinkElementNull",  CONFIGURE_VALUE_ELEMENT,   {(int)&_videosink_element_null_default} },
-       { "UseVideoscale",         CONFIGURE_VALUE_INT,       {0} },
-       { "VideoscaleElement",     CONFIGURE_VALUE_ELEMENT,   {(int)&_videoscale_element_default} },
-};
-
-/*
- * [Capture] matching table
- */
-static conf_info_table conf_main_capture_table[] = {
-       { "UseEncodebin",           CONFIGURE_VALUE_INT,     {0} },
-       { "UseCaptureMode",         CONFIGURE_VALUE_INT,     {0} },
-       { "VideoscaleElement",      CONFIGURE_VALUE_ELEMENT, {(int)&_videoscale_element_default} },
-       { "PlayCaptureSound",       CONFIGURE_VALUE_INT,     {1} },
-};
-
-/*
- * [Record] matching table
- */
-static conf_info_table conf_main_record_table[] = {
-       { "UseAudioEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },
-       { "UseVideoEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },
-       { "VideoProfile",           CONFIGURE_VALUE_INT,     {0} },
-       { "VideoAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
-       { "VideoAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
-       { "VideoAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
-       { "AudioProfile",           CONFIGURE_VALUE_INT,     {0} },
-       { "AudioAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
-       { "AudioAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
-       { "AudioAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
-       { "ImageProfile",           CONFIGURE_VALUE_INT,     {0} },
-       { "ImageAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
-       { "ImageAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
-       { "ImageAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
-       { "RecordsinkElement",      CONFIGURE_VALUE_ELEMENT, {(int)&_recordsink_element_default} },
-       { "UseNoiseSuppressor",     CONFIGURE_VALUE_INT,     {0} },
-       { "DropVideoFrame",         CONFIGURE_VALUE_INT,     {0} },
-       { "PassFirstVideoFrame",    CONFIGURE_VALUE_INT,     {0} },
-};
-
-/*
- * [VideoEncoder] matching table
- */
-static conf_info_table conf_main_video_encoder_table[] = {
-       { "H263",    CONFIGURE_VALUE_ELEMENT, {(int)&_h263_element_default} },
-       { "H264",    CONFIGURE_VALUE_ELEMENT, {(int)&_h264_element_default} },
-       { "H26L",    CONFIGURE_VALUE_ELEMENT, {(int)&_h26l_element_default} },
-       { "MPEG4",   CONFIGURE_VALUE_ELEMENT, {(int)&_mpeg4_element_default} },
-       { "MPEG1",   CONFIGURE_VALUE_ELEMENT, {(int)&_mpeg1_element_default} },
-       { "THEORA",  CONFIGURE_VALUE_ELEMENT, {(int)&_theora_element_default} },
-};
-
-/*
- * [AudioEncoder] matching table
- */
-static conf_info_table conf_main_audio_encoder_table[] = {
-       { "AMR",     CONFIGURE_VALUE_ELEMENT, {(int)&_amr_element_default} },
-       { "G723_1",  CONFIGURE_VALUE_ELEMENT, {(int)&_g723_1_element_default} },
-       { "MP3",     CONFIGURE_VALUE_ELEMENT, {(int)&_mp3_element_default} },
-       { "AAC",     CONFIGURE_VALUE_ELEMENT, {(int)&_aac_element_default} },
-       { "MMF",     CONFIGURE_VALUE_ELEMENT, {(int)&_mmf_element_default} },
-       { "ADPCM",   CONFIGURE_VALUE_ELEMENT, {(int)&_adpcm_element_default} },
-       { "WAVE",    CONFIGURE_VALUE_ELEMENT, {(int)&_wave_element_default} },
-       { "MIDI",    CONFIGURE_VALUE_ELEMENT, {(int)&_midi_element_default} },
-       { "IMELODY", CONFIGURE_VALUE_ELEMENT, {(int)&_imelody_element_default} },
-       { "VORBIS",  CONFIGURE_VALUE_ELEMENT, {(int)&_vorbis_element_default} },
-};
-
-/*
- * [ImageEncoder] matching table
- */
-static conf_info_table conf_main_image_encoder_table[] = {
-       { "JPEG", CONFIGURE_VALUE_ELEMENT, {(int)&_jpeg_element_default} },
-       { "PNG",  CONFIGURE_VALUE_ELEMENT, {(int)&_png_element_default} },
-       { "BMP",  CONFIGURE_VALUE_ELEMENT, {(int)&_bmp_element_default} },
-       { "WBMP", CONFIGURE_VALUE_ELEMENT, {(int)&_wbmp_element_default} },
-       { "TIFF", CONFIGURE_VALUE_ELEMENT, {(int)&_tiff_element_default} },
-       { "PCX",  CONFIGURE_VALUE_ELEMENT, {(int)&_pcx_element_default} },
-       { "GIF",  CONFIGURE_VALUE_ELEMENT, {(int)&_gif_element_default} },
-       { "ICO",  CONFIGURE_VALUE_ELEMENT, {(int)&_ico_element_default} },
-       { "RAS",  CONFIGURE_VALUE_ELEMENT, {(int)&_ras_element_default} },
-       { "TGA",  CONFIGURE_VALUE_ELEMENT, {(int)&_tga_element_default} },
-       { "XBM",  CONFIGURE_VALUE_ELEMENT, {(int)&_xbm_element_default} },
-       { "XPM",  CONFIGURE_VALUE_ELEMENT, {(int)&_xpm_element_default} },
-};
-
-/*
- * [Mux] matching table
- */
-static conf_info_table conf_main_mux_table[] = {
-       { "3GP",      CONFIGURE_VALUE_ELEMENT, {(int)&_3gp_element_default} },
-       { "AMR",      CONFIGURE_VALUE_ELEMENT, {(int)&_amrmux_element_default} },
-       { "MP4",      CONFIGURE_VALUE_ELEMENT, {(int)&_mp4_element_default} },
-       { "AAC",      CONFIGURE_VALUE_ELEMENT, {(int)&_aacmux_element_default} },
-       { "MP3",      CONFIGURE_VALUE_ELEMENT, {(int)&_mp3mux_element_default} },
-       { "OGG",      CONFIGURE_VALUE_ELEMENT, {(int)&_ogg_element_default} },
-       { "WAV",      CONFIGURE_VALUE_ELEMENT, {(int)&_wav_element_default} },
-       { "AVI",      CONFIGURE_VALUE_ELEMENT, {(int)&_avi_element_default} },
-       { "WMA",      CONFIGURE_VALUE_ELEMENT, {(int)&_wma_element_default} },
-       { "WMV",      CONFIGURE_VALUE_ELEMENT, {(int)&_wmv_element_default} },
-       { "MID",      CONFIGURE_VALUE_ELEMENT, {(int)&_mid_element_default} },
-       { "MMF",      CONFIGURE_VALUE_ELEMENT, {(int)&_mmfmux_element_default} },
-       { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {(int)&_matroska_element_default} },
-};
-
-
-/*******************
- *  Camera control *
- *******************/
-
-/*
- * [Camera] matching table
- */
-static conf_info_table conf_ctrl_camera_table[] = {
-       { "InputIndex",        CONFIGURE_VALUE_INT_ARRAY,      {(int)NULL} },
-       { "DeviceName",        CONFIGURE_VALUE_STRING,         {(int)NULL} },
-       { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
-       { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
-       { "FPS",               CONFIGURE_VALUE_INT_ARRAY,      {(int)NULL} },
-       { "PictureFormat",     CONFIGURE_VALUE_INT_ARRAY,      {(int)NULL} },
-       { "Overlay",           CONFIGURE_VALUE_INT_RANGE,      {(int)NULL} },
-       { "RecommendDisplayRotation", CONFIGURE_VALUE_INT,     {3}    },
-       { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} },
-       { "RecommendPreviewFormatRecord",  CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} },
-       { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
-       { "FacingDirection", CONFIGURE_VALUE_INT, {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
-};
-
-/*
- * [Strobe] matching table
- */
-static conf_info_table conf_ctrl_strobe_table[] = {
-       { "StrobeControl",        CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "StrobeMode",           CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "StrobeEV",             CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-/*
- * [Effect] matching table
- */
-static conf_info_table conf_ctrl_effect_table[] = {
-       { "Brightness",           CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "Contrast",             CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "Saturation",           CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "Sharpness",            CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "WhiteBalance",         CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "ColorTone",            CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "Flip",                 CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "WDR",                  CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "PartColorMode",        CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "PartColor",            CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-};
-
-/*
- * [Photograph] matching table
- */
-static conf_info_table conf_ctrl_photograph_table[] = {
-       { "LensInit",             CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "DigitalZoom",          CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "OpticalZoom",          CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "FocusMode",            CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "AFType",               CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "AEType",               CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "ExposureValue",        CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "FNumber",              CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "ShutterSpeed",         CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "ISO",                  CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "ProgramMode",          CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "AntiHandshake",        CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "VideoStabilization",   CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "FaceZoomMode",         CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "FaceZoomLevel",        CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-/*
- * [Capture] matching table
- */
-static conf_info_table conf_ctrl_capture_table[] = {
-       { "OutputMode",           CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "JpegQuality",          CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "MultishotNumber",      CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "SensorEncodedCapture", CONFIGURE_VALUE_INT,       {1} },
-       { "SupportHDR",           CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-};
-
-/*
- * [Detect] matching table
- */
-static conf_info_table conf_ctrl_detect_table[] = {
-       { "DetectMode",         CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-       { "DetectNumber",       CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "DetectSelect",       CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-       { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-
-
-char*
-get_new_string( char* src_string )
+char *get_new_string(char* src_string)
 {
        return strdup(src_string);
 }
 
-void _mmcamcorder_conf_init(int type, camera_conf** configure_info)
+void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
 {
        int i = 0;
        int info_table_size = sizeof(conf_info_table);
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       /* Videosrc element default value */
+       static type_element _videosrc_element_default = {
+               "VideosrcElement",
+               "videotestsrc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* Audiosrc element default value */
+       static type_int  ___audiosrc_default_channel = { "Channel", 1 };
+       static type_int  ___audiosrc_default_bitrate = { "BitRate", 8000 };
+       static type_int  ___audiosrc_default_depth = { "Depth", 16 };
+       static type_int  ___audiosrc_default_blocksize = { "BlockSize", 1280 };
+       static type_int* __audiosrc_default_int_array[] = {
+               &___audiosrc_default_channel,
+               &___audiosrc_default_bitrate,
+               &___audiosrc_default_depth,
+               &___audiosrc_default_blocksize,
+       };
+       static type_string  ___audiosrc_default_device = { "Device", "default" };
+       static type_string* __audiosrc_default_string_array[] = {
+               &___audiosrc_default_device,
+       };
+       static type_element _audiosrc_element_default = {
+               "AudiosrcElement",
+               "audiotestsrc",
+               __audiosrc_default_int_array,
+               sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
+               __audiosrc_default_string_array,
+               sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
+       };
+
+       static type_element _audiomodemsrc_element_default = {
+               "AudiomodemsrcElement",
+               "audiotestsrc",
+               __audiosrc_default_int_array,
+               sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
+               __audiosrc_default_string_array,
+               sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
+       };
+
+
+       /* Videosink element default value */
+       static type_int  ___videosink_default_display_id = { "display-id", 3 };
+       static type_int  ___videosink_default_x = { "x", 0 };
+       static type_int  ___videosink_default_y = { "y", 0 };
+       static type_int  ___videosink_default_width = { "width", 800 };
+       static type_int  ___videosink_default_height = { "height", 480 };
+       static type_int  ___videosink_default_rotation = { "rotation", 1 };
+       static type_int* __videosink_default_int_array[] = {
+               &___videosink_default_display_id,
+               &___videosink_default_x,
+               &___videosink_default_y,
+               &___videosink_default_width,
+               &___videosink_default_height,
+               &___videosink_default_rotation,
+       };
+       static type_string* __videosink_default_string_array[] = { NULL };
+       static type_element _videosink_element_x_default = {
+               "VideosinkElementX",
+               "xvimagesink",
+               __videosink_default_int_array,
+               sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+               __videosink_default_string_array,
+               sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+       };
+       static type_element _videosink_element_evas_default = {
+               "VideosinkElementEvas",
+               "evasimagesink",
+               __videosink_default_int_array,
+               sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+               __videosink_default_string_array,
+               sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+       };
+       static type_element _videosink_element_gl_default = {
+               "VideosinkElementGL",
+               "glimagesink",
+               __videosink_default_int_array,
+               sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+               __videosink_default_string_array,
+               sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+       };
+       static type_element _videosink_element_null_default = {
+               "VideosinkElementNull",
+               "fakesink",
+               __videosink_default_int_array,
+               sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+               __videosink_default_string_array,
+               sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+       };
+
+       /* Videoscale element default value */
+       static type_element _videoscale_element_default = {
+               "VideoscaleElement",
+               "videoscale",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* Videoconvert element default value */
+       static type_element _videoconvert_element_default = {
+               "VideoconvertElement",
+               "videoconvert",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* Record sink element default value */
+       static type_element _recordsink_element_default = {
+               "RecordsinkElement",
+               "fakesink",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* H263 element default value */
+       static type_element _h263_element_default = {
+               "H263",
+               "avenc_h263",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* H264 element default value */
+       static type_element _h264_element_default = {
+               "H264",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* H26L element default value */
+       static type_element _h26l_element_default = {
+               "H26L",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MPEG4 element default value */
+       static type_element _mpeg4_element_default = {
+               "MPEG4",
+               "avenc_mpeg4",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MPEG1 element default value */
+       static type_element _mpeg1_element_default = {
+               "MPEG1",
+               "avenc_mpeg1video",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* THEORA element default value */
+       static type_element _theora_element_default = {
+               "THEORA",
+               "theoraenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* AMR element default value */
+       static type_element _amr_element_default = {
+               "AMR",
+               "amrnbenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* G723_1 element default value */
+       static type_element _g723_1_element_default = {
+               "G723_1",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MP3 element default value */
+       static type_element _mp3_element_default = {
+               "MP3",
+               "lamemp3enc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* AAC element default value */
+       static type_element _aac_element_default = {
+               "AAC",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MMF element default value */
+       static type_element _mmf_element_default = {
+               "MMF",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* ADPCM element default value */
+       static type_element _adpcm_element_default = {
+               "ADPCM",
+               "avenc_adpcm_ima_qt",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* WAVE element default value */
+       static type_element _wave_element_default = {
+               "WAVE",
+               "wavenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* VORBIS element default value */
+       static type_element _vorbis_element_default = {
+               "VORBIS",
+               "vorbisenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MIDI element default value */
+       static type_element _midi_element_default = {
+               "MIDI",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* IMELODY element default value */
+       static type_element _imelody_element_default = {
+               "IMELODY",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* JPEG element default value */
+       static type_element _jpeg_element_default = {
+               "JPEG",
+               "jpegenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* PNG element default value */
+       static type_element _png_element_default = {
+               "PNG",
+               "pngenc",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* BMP element default value */
+       static type_element _bmp_element_default = {
+               "BMP",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* WBMP element default value */
+       static type_element _wbmp_element_default = {
+               "WBMP",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* TIFF element default value */
+       static type_element _tiff_element_default = {
+               "TIFF",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* PCX element default value */
+       static type_element _pcx_element_default = {
+               "PCX",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* GIF element default value */
+       static type_element _gif_element_default = {
+               "GIF",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* ICO element default value */
+       static type_element _ico_element_default = {
+               "ICO",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* RAS element default value */
+       static type_element _ras_element_default = {
+               "RAS",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* TGA element default value */
+       static type_element _tga_element_default = {
+               "TGA",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* XBM element default value */
+       static type_element _xbm_element_default = {
+               "XBM",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* XPM element default value */
+       static type_element _xpm_element_default = {
+               "XPM",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* 3GP element default value */
+       static type_element _3gp_element_default = {
+               "3GP",
+               "avmux_3gp",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* AMR mux element default value */
+       static type_element _amrmux_element_default = {
+               "AMR",
+               "avmux_amr",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MP4 element default value */
+       static type_element _mp4_element_default = {
+               "MP4",
+               "avmux_mp4",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* AAC mux element default value */
+       static type_element _aacmux_element_default = {
+               "AAC",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MP3 mux element default value */
+       static type_element _mp3mux_element_default = {
+               "MP3",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* OGG element default value */
+       static type_element _ogg_element_default = {
+               "OGG",
+               "oggmux",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* WAV element default value */
+       static type_element _wav_element_default = {
+               "WAV",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* AVI element default value */
+       static type_element _avi_element_default = {
+               "AVI",
+               "avimux",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* WMA element default value */
+       static type_element _wma_element_default = {
+               "WMA",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* WMV element default value */
+       static type_element _wmv_element_default = {
+               "WMV",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MID element default value */
+       static type_element _mid_element_default = {
+               "MID",
+               NULL,
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MMF mux element default value */
+       static type_element _mmfmux_element_default = {
+               "MMF",
+               "avmux_mmf",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* MATROSKA element default value */
+       static type_element _matroska_element_default = {
+               "MATROSKA",
+               "matroskamux",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* M2TS element default value */
+       static type_element _m2ts_element_default = {
+               "M2TS",
+               "mpegtsmux",
+               NULL,
+               0,
+               NULL,
+               0,
+       };
+
+       /* [General] matching table */
+       static conf_info_table conf_main_general_table[] = {
+               { "SyncStateChange", CONFIGURE_VALUE_INT,           {1} },
+               { "GSTInitOption",   CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
+               { "ModelName",       CONFIGURE_VALUE_STRING,        {NULL} },
+               { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
+       };
+
+       /* [VideoInput] matching table */
+       static conf_info_table conf_main_video_input_table[] = {
+               { "UseConfCtrl",        CONFIGURE_VALUE_INT,            {1} },
+               { "ConfCtrlFile0",      CONFIGURE_VALUE_STRING,         {0} },
+               { "ConfCtrlFile1",      CONFIGURE_VALUE_STRING,         {0} },
+               { "VideosrcElement",    CONFIGURE_VALUE_ELEMENT,        {&_videosrc_element_default} },
+               { "UseVideoscale",      CONFIGURE_VALUE_INT,            {0} },
+               { "VideoscaleElement",  CONFIGURE_VALUE_ELEMENT,        {&_videoscale_element_default} },
+               { "UseZeroCopyFormat",  CONFIGURE_VALUE_INT,            {0} },
+               { "DeviceCount",        CONFIGURE_VALUE_INT,            {MM_VIDEO_DEVICE_NUM} },
+               { "SupportMediaPacketPreviewCb",  CONFIGURE_VALUE_INT,  {0} },
+       };
+
+       /* [AudioInput] matching table */
+       static conf_info_table conf_main_audio_input_table[] = {
+               { "AudiosrcElement",      CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
+               { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
+       };
+
+       /* [VideoOutput] matching table */
+       static conf_info_table conf_main_video_output_table[] = {
+               { "DisplayDevice",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "DisplayMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "Videosink",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "VideosinkElementX",     CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_x_default} },
+               { "VideosinkElementEvas",  CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_evas_default} },
+               { "VideosinkElementGL",    CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_gl_default} },
+               { "VideosinkElementNull",  CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_null_default} },
+               { "UseVideoscale",         CONFIGURE_VALUE_INT,       {0} },
+               { "VideoscaleElement",     CONFIGURE_VALUE_ELEMENT,   {&_videoscale_element_default} },
+               { "VideoconvertElement",   CONFIGURE_VALUE_ELEMENT,   {&_videoconvert_element_default} },
+       };
+
+       /* [Capture] matching table */
+       static conf_info_table conf_main_capture_table[] = {
+               { "UseEncodebin",           CONFIGURE_VALUE_INT,     {0} },
+               { "UseCaptureMode",         CONFIGURE_VALUE_INT,     {0} },
+               { "VideoscaleElement",      CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
+               { "PlayCaptureSound",       CONFIGURE_VALUE_INT,     {1} },
+       };
+
+       /* [Record] matching table */
+       static conf_info_table conf_main_record_table[] = {
+               { "UseAudioEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },
+               { "UseVideoEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },
+               { "VideoProfile",           CONFIGURE_VALUE_INT,     {0} },
+               { "VideoAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
+               { "VideoAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
+               { "VideoAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
+               { "AudioProfile",           CONFIGURE_VALUE_INT,     {0} },
+               { "AudioAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
+               { "AudioAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
+               { "AudioAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
+               { "ImageProfile",           CONFIGURE_VALUE_INT,     {0} },
+               { "ImageAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
+               { "ImageAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
+               { "ImageAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
+               { "RecordsinkElement",      CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
+               { "UseNoiseSuppressor",     CONFIGURE_VALUE_INT,     {0} },
+               { "DropVideoFrame",         CONFIGURE_VALUE_INT,     {0} },
+               { "PassFirstVideoFrame",    CONFIGURE_VALUE_INT,     {0} },
+               { "SupportDualStream",      CONFIGURE_VALUE_INT,     {FALSE} },
+       };
+
+       /* [VideoEncoder] matching table */
+       static conf_info_table conf_main_video_encoder_table[] = {
+               { "H263",    CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
+               { "H264",    CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
+               { "H26L",    CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
+               { "MPEG4",   CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
+               { "MPEG1",   CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
+               { "THEORA",  CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
+       };
+
+       /* [AudioEncoder] matching table */
+       static conf_info_table conf_main_audio_encoder_table[] = {
+               { "AMR",     CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
+               { "G723_1",  CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
+               { "MP3",     CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
+               { "AAC",     CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
+               { "MMF",     CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
+               { "ADPCM",   CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
+               { "WAVE",    CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
+               { "MIDI",    CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
+               { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
+               { "VORBIS",  CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
+       };
+
+       /* [ImageEncoder] matching table */
+       static conf_info_table conf_main_image_encoder_table[] = {
+               { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
+               { "PNG",  CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
+               { "BMP",  CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
+               { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
+               { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
+               { "PCX",  CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
+               { "GIF",  CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
+               { "ICO",  CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
+               { "RAS",  CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
+               { "TGA",  CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
+               { "XBM",  CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
+               { "XPM",  CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
+       };
+
+       /* [Mux] matching table */
+       static conf_info_table conf_main_mux_table[] = {
+               { "3GP",      CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
+               { "AMR",      CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
+               { "MP4",      CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
+               { "AAC",      CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
+               { "MP3",      CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
+               { "OGG",      CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
+               { "WAV",      CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
+               { "AVI",      CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
+               { "WMA",      CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
+               { "WMV",      CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
+               { "MID",      CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
+               { "MMF",      CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
+               { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
+               { "M2TS",     CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
+       };
+
+
+       /*******************
+       *  Camera control *
+       *******************/
+
+       /* [Camera] matching table */
+       static conf_info_table conf_ctrl_camera_table[] = {
+               { "InputIndex",        CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
+               { "DeviceName",        CONFIGURE_VALUE_STRING,         {NULL} },
+               { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+               { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+               { "VideoResolution",   CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+               { "FPS",               CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
+               { "PictureFormat",     CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
+               { "Overlay",           CONFIGURE_VALUE_INT_RANGE,      {NULL} },
+               { "RecommendDisplayRotation", CONFIGURE_VALUE_INT,     {3}    },
+               { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} },
+               { "RecommendPreviewFormatRecord",  CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} },
+               { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+               { "FacingDirection", CONFIGURE_VALUE_INT, {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
+       };
+
+       /* [Strobe] matching table */
+       static conf_info_table conf_ctrl_strobe_table[] = {
+               { "StrobeControl",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "StrobeMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "StrobeEV",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
+       };
+
+       /* [Effect] matching table */
+       static conf_info_table conf_ctrl_effect_table[] = {
+               { "Brightness",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {2} },
+               { "Contrast",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "Saturation",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "Sharpness",            CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "WhiteBalance",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "ColorTone",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "Flip",                 CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "Rotation",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "WDR",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "PartColorMode",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "PartColor",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+       };
+
+       /* [Photograph] matching table */
+       static conf_info_table conf_ctrl_photograph_table[] = {
+               { "LensInit",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "DigitalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "OpticalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "FocusMode",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "AFType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "AEType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "ExposureValue",        CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "FNumber",              CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "ShutterSpeed",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "ISO",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "ProgramMode",          CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "AntiHandshake",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "VideoStabilization",   CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "FaceZoomMode",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "FaceZoomLevel",        CONFIGURE_VALUE_INT_RANGE, {NULL} },
+       };
+
+       /* [Capture] matching table */
+       static conf_info_table conf_ctrl_capture_table[] = {
+               { "OutputMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "JpegQuality",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "MultishotNumber",      CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "SensorEncodedCapture", CONFIGURE_VALUE_INT,       {1} },
+               { "SupportHDR",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "SupportZSL",           CONFIGURE_VALUE_INT,       {FALSE} },
+       };
+
+       /* [Detect] matching table */
+       static conf_info_table conf_ctrl_detect_table[] = {
+               { "DetectMode",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+               { "DetectNumber",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "DetectSelect",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
+               { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+       };
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return;
+       }
+
        _mmcam_dbg_log("Entered...");
 
        if (type == CONFIGURE_TYPE_MAIN) {
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL]       = conf_main_general_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = conf_main_video_input_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = conf_main_audio_input_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = conf_main_video_output_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = conf_main_capture_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD]        = conf_main_record_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
-               conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX]           = conf_main_mux_table;
-
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL]       = sizeof( conf_main_general_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = sizeof( conf_main_video_input_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = sizeof( conf_main_audio_input_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = sizeof( conf_main_video_output_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = sizeof( conf_main_capture_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD]        = sizeof( conf_main_record_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
-               conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX]           = sizeof( conf_main_mux_table ) / info_table_size;
-
-               (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_MAIN_NUM );
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL]       = conf_main_general_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = conf_main_video_input_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = conf_main_audio_input_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = conf_main_video_output_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = conf_main_capture_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD]        = conf_main_record_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
+               hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX]           = conf_main_mux_table;
+
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL]       = sizeof( conf_main_general_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = sizeof( conf_main_video_input_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = sizeof( conf_main_audio_input_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = sizeof( conf_main_video_output_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = sizeof( conf_main_capture_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD]        = sizeof( conf_main_record_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
+               hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX]           = sizeof( conf_main_mux_table ) / info_table_size;
+
+               (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
 
                for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
                        (*configure_info)->info[i]      = NULL;
                }
        } else {
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA]     = conf_ctrl_camera_table;
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE]     = conf_ctrl_strobe_table;
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT]     = conf_ctrl_effect_table;
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = conf_ctrl_capture_table;
-               conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT]     = conf_ctrl_detect_table;
-
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA]     = sizeof( conf_ctrl_camera_table ) / info_table_size;
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE]     = sizeof( conf_ctrl_strobe_table ) / info_table_size;
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT]     = sizeof( conf_ctrl_effect_table ) / info_table_size;
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = sizeof( conf_ctrl_capture_table ) / info_table_size;
-               conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT]     = sizeof( conf_ctrl_detect_table ) / info_table_size;
-
-               (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_CTRL_NUM );
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA]     = conf_ctrl_camera_table;
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE]     = conf_ctrl_strobe_table;
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT]     = conf_ctrl_effect_table;
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = conf_ctrl_capture_table;
+               hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT]     = conf_ctrl_detect_table;
+
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA]     = sizeof( conf_ctrl_camera_table ) / info_table_size;
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE]     = sizeof( conf_ctrl_strobe_table ) / info_table_size;
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT]     = sizeof( conf_ctrl_effect_table ) / info_table_size;
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = sizeof( conf_ctrl_capture_table ) / info_table_size;
+               hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT]     = sizeof( conf_ctrl_detect_table ) / info_table_size;
+
+               (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
 
                for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
                        (*configure_info)->info[i] = NULL;
@@ -968,8 +874,7 @@ void _mmcamcorder_conf_init(int type, camera_conf** configure_info)
 }
 
 
-int
-_mmcamcorder_conf_get_info( int type, char* ConfFile, camera_conf** configure_info )
+int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
 {
        int ret         = MM_ERROR_NONE;
        FILE* fd        = NULL;
@@ -999,14 +904,13 @@ _mmcamcorder_conf_get_info( int type, char* ConfFile, camera_conf** configure_in
                fd = fopen( conf_path, "r" );
                if( fd == NULL )
                {
-                       _mmcam_dbg_warn( "File open failed.[%s] But keep going... All value will be returned as default.Type[%d]", 
-                               conf_path, type );
+                       _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
                }
        }
 
        if( fd != NULL )
        {
-               ret = _mmcamcorder_conf_parse_info( type, fd, configure_info );
+               ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
                fclose( fd );
        }
        else
@@ -1025,8 +929,7 @@ _mmcamcorder_conf_get_info( int type, char* ConfFile, camera_conf** configure_in
        return ret;
 }
 
-int
-_mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
+int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
 {
        const unsigned int BUFFER_NUM_DETAILS = 256;
        const unsigned int BUFFER_NUM_TOKEN = 20;
@@ -1056,17 +959,23 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
        {
                _mmcam_dbg_err( "Failed to create new configure structure.type[%d]", type );
                *configure_info = NULL;
-
+               SAFE_FREE( buffer_string );
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
 
        new_conf->type  = type;
        *configure_info = new_conf;
 
-       _mmcamcorder_conf_init( type, &new_conf );
+       _mmcamcorder_conf_init(handle, type, &new_conf);
+
+       if( fd == NULL )
+       {
+               _mmcam_dbg_err("failed file descriptor fail");
+               SAFE_FREE( buffer_string );
+               SAFE_FREE( new_conf );
+               return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+       }
 
-       mmf_return_val_if_fail( fd > 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
-       
        read_main = 0;
        count_main_category = 0;
 
@@ -1109,12 +1018,12 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
                }
                /* Main Category */
                else if( *buffer_token[0] == '[' )
-               {       
+               {
                        category_name = get_new_string( buffer_token[0] );
 
                        count_main_category++;
                        count_details = 0;
-                       
+
                        while( !feof( fd ) )
                        {
                                length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
@@ -1143,7 +1052,9 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
                                }
                        }
 
+                       /*
                        _mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );
+                       */
 
                        if( count_details == 0 )
                        {
@@ -1156,7 +1067,7 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
 
                        /* Details */
                        if( type == CONFIGURE_TYPE_MAIN )
-                       {       
+                       {
                                if( !strcmp( "[General]", category_name ) )
                                {
                                        category = CONFIGURE_CATEGORY_MAIN_GENERAL;
@@ -1228,7 +1139,7 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
 
                        if( category != -1 )
                        {
-                               _mmcamcorder_conf_add_info( type, &(new_conf->info[category]), 
+                               _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
                                                buffer_details, category, count_details );
                        }
                        else
@@ -1260,19 +1171,18 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
 }
 
 
-void
-_mmcamcorder_conf_release_info( camera_conf** configure_info )
+void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf** configure_info)
 {
        int i, j, k, type, count, category_num;
        camera_conf* temp_conf = (*configure_info);
 
-       type_int           temp_int;
+       type_int2*           temp_int;
        type_int_range*      temp_int_range;
        type_int_array*      temp_int_array;
        type_int_pair_array* temp_int_pair_array;
-       type_string        temp_string;
+       type_string2*        temp_string;
        type_string_array*   temp_string_array;
-       type_element*        temp_element;      
+       type_element2*       temp_element;
 
        _mmcam_dbg_log( "Entered..." );
 
@@ -1297,14 +1207,14 @@ _mmcamcorder_conf_release_info( camera_conf** configure_info )
                                {
                                        continue;
                                }
-                               
-                               if( _mmcamcorder_conf_get_value_type( temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type ) )
+
+                               if( _mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type))
                                {
                                        switch( type )
                                        {
                                                case CONFIGURE_VALUE_INT:
                                                {
-                                                       temp_int = (type_int*)(temp_conf->info[i]->detail_info[j]);
+                                                       temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
                                                        SAFE_FREE( temp_int->name );
                                                }
                                                        break;
@@ -1331,7 +1241,7 @@ _mmcamcorder_conf_release_info( camera_conf** configure_info )
                                                        break;
                                                case CONFIGURE_VALUE_STRING:
                                                {
-                                                       temp_string = (type_string*)(temp_conf->info[i]->detail_info[j]);
+                                                       temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
                                                        SAFE_FREE( temp_string->name );
                                                        SAFE_FREE( temp_string->value );
                                                }
@@ -1347,13 +1257,12 @@ _mmcamcorder_conf_release_info( camera_conf** configure_info )
                                                                SAFE_FREE( temp_string_array->value[k] );
                                                        }
                                                        SAFE_FREE( temp_string_array->value );
-                                                       
                                                        SAFE_FREE( temp_string_array->default_value );
                                                }
                                                        break;
                                                case CONFIGURE_VALUE_ELEMENT:
                                                {
-                                                       temp_element    = (type_element*)(temp_conf->info[i]->detail_info[j]);
+                                                       temp_element    = (type_element2*)(temp_conf->info[i]->detail_info[j]);
                                                        SAFE_FREE( temp_element->name );
                                                        SAFE_FREE( temp_element->element_name );
 
@@ -1375,6 +1284,9 @@ _mmcamcorder_conf_release_info( camera_conf** configure_info )
                                                        SAFE_FREE( temp_element->value_string );
                                                }
                                                        break;
+                                               default:
+                                                       _mmcam_dbg_warn("unknown type %d", type);
+                                                       break;
                                        }
                                }
 
@@ -1396,20 +1308,26 @@ _mmcamcorder_conf_release_info( camera_conf** configure_info )
        _mmcam_dbg_log( "Done." );
 }
 
-int
-_mmcamcorder_conf_get_value_type( int type, int category, char* name, int* value_type )
+int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
 {
        int i = 0;
        int count_value = 0;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return FALSE;
+       }
+
        /*_mmcam_dbg_log( "Entered..." );*/
 
        mmf_return_val_if_fail( name, FALSE );
 
-       if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+       if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
        {
                _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
-               return FALSE;           
+               return FALSE;
        }
 
        /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
@@ -1418,9 +1336,9 @@ _mmcamcorder_conf_get_value_type( int type, int category, char* name, int* value
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_main_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
                        {
-                               *value_type = conf_main_info_table[category][i].value_type;
+                               *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
                                /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
                                return TRUE;
                        }
@@ -1430,9 +1348,9 @@ _mmcamcorder_conf_get_value_type( int type, int category, char* name, int* value
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
                        {
-                               *value_type = conf_ctrl_info_table[category][i].value_type;
+                               *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
                                /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
                                return TRUE;
                        }
@@ -1443,11 +1361,10 @@ _mmcamcorder_conf_get_value_type( int type, int category, char* name, int* value
 }
 
 
-int
-_mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, int category, int count_details )
+int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
 {
        const int BUFFER_NUM_TOKEN = 256;
-       
+
        int i = 0;
        int j = 0;
        int count_token;
@@ -1461,8 +1378,8 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
        const char *delimiters_3rd = "|\n";
 
        mmf_return_val_if_fail( buffer_details, FALSE );
-       
-       (*info) = (conf_info*)g_malloc0( sizeof(conf_info) );
+
+       (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
        (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
        (*info)->count = count_details;
 
@@ -1480,7 +1397,7 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                        continue;
                }
 
-               if (!_mmcamcorder_conf_get_value_type(type, category, buffer_token[0], &value_type)) {
+               if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
                        (*info)->detail_info[i] = NULL;
                        _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
                        continue;
@@ -1533,9 +1450,9 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                {
                        case CONFIGURE_VALUE_INT:
                        {
-                               type_int* new_int;
+                               type_int2* new_int;
 
-                               new_int        = (type_int*)g_malloc0( sizeof(type_int) );
+                               new_int        = (type_int2*)g_malloc0( sizeof(type_int2) );
                                new_int->name  = get_new_string( buffer_token[0] );
                                new_int->value = atoi( buffer_token[1] );
                                (*info)->detail_info[i] = (void*)new_int;
@@ -1554,8 +1471,8 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                                (*info)->detail_info[i]      = (void*)new_int_range;
                                /*
                                _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
-                                               new_int_range->name, 
-                                               new_int_range->min, 
+                                               new_int_range->name,
+                                               new_int_range->min,
                                                new_int_range->max,
                                                new_int_range->default_value);
                                */
@@ -1579,7 +1496,7 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
 
                                new_int_array->default_value = atoi( buffer_token[count_token-1] );
                                /*_mmcam_dbg_log("   default value[%d]", new_int_array->default_value);*/
-                               
+
                                (*info)->detail_info[i] = (void*)new_int_array;
                                break;
                        }
@@ -1617,13 +1534,13 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                        }
                        case CONFIGURE_VALUE_STRING:
                        {
-                               type_string* new_string;
-                               
-                               new_string        = (type_string*)g_malloc0( sizeof(type_string) );
+                               type_string2* new_string;
+
+                               new_string        = (type_string2*)g_malloc0( sizeof(type_string2) );
                                new_string->name  = get_new_string( buffer_token[0] );
                                new_string->value = get_new_string( buffer_token[1] );
                                (*info)->detail_info[i] = (void*)new_string;
-                               
+
                                /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
                                break;
                        }
@@ -1631,7 +1548,7 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                        {
                                int count_value = count_token - 2;
                                type_string_array* new_string_array;
-                               
+
                                new_string_array        = (type_string_array*)g_malloc0( sizeof(type_string_array) );
                                new_string_array->name  = get_new_string( buffer_token[0] );
                                new_string_array->count = count_value;
@@ -1650,9 +1567,9 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
                        }
                        case CONFIGURE_VALUE_ELEMENT:
                        {
-                               type_element* new_element;
-                               
-                               new_element               = (type_element*)g_malloc0( sizeof(type_element) );
+                               type_element2* new_element;
+
+                               new_element               = (type_element2*)g_malloc0( sizeof(type_element2) );
                                new_element->name         = get_new_string( buffer_token[0] );
                                new_element->element_name = get_new_string( buffer_token[1] );
                                new_element->count_int    = atoi( buffer_token[2] );
@@ -1666,10 +1583,10 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
 
                                /* add int values */
                                if ( new_element->count_int > 0 ) {
-                                       new_element->value_int = (type_int**)g_malloc0( sizeof(type_int*)*(new_element->count_int) );
+                                       new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
 
                                        for ( j = 0 ; j < new_element->count_int ; j++ ) {
-                                               new_element->value_int[j]        = (type_int*)g_malloc( sizeof(type_int) );
+                                               new_element->value_int[j]        = (type_int2*)g_malloc( sizeof(type_int2) );
                                                new_element->value_int[j]->name  = get_new_string( buffer_token[4+(j<<1)] );
                                                new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
                                                /*
@@ -1685,9 +1602,9 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
 
                                /* add string values */
                                if ( new_element->count_string > 0 ) {
-                                       new_element->value_string = (type_string**)g_malloc0( sizeof(type_string*)*(new_element->count_string) );
+                                       new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
                                        for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
-                                               new_element->value_string[j-new_element->count_int]     = (type_string*)g_malloc0( sizeof(type_string) );
+                                               new_element->value_string[j-new_element->count_int]     = (type_string2*)g_malloc0( sizeof(type_string2) );
                                                new_element->value_string[j-new_element->count_int]->name       = get_new_string( buffer_token[4+(j<<1)] );
                                                new_element->value_string[j-new_element->count_int]->value      = get_new_string( buffer_token[5+(j<<1)] );
                                                /*
@@ -1711,11 +1628,10 @@ _mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, i
 }
 
 
-int
-_mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_details, int category, int count_details )
+int _mmcamcorder_conf_add_info_with_caps(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details)
 {
        const int BUFFER_NUM_TOKEN = 256;
-       
+
        int i = 0;
        int j = 0;
        int count_token = 0;
@@ -1731,10 +1647,10 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
        //_mmcam_dbg_log( "" );
 
        mmf_return_val_if_fail( buffer_details, FALSE );
-       
-       (*info)                                 = (conf_info*)g_malloc0( sizeof(conf_info) );
-       (*info)->detail_info    = (void**)g_malloc0( sizeof(void*)*count_details );
-       (*info)->count                  = count_details;
+
+       (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
+       (*info)->detail_info = (void**)g_malloc0( sizeof(void*)*count_details );
+       (*info)->count = count_details;
 
        //g_print( "Count[%d]\n", (*info)->count );
        //g_print( "Pointer[%x]\n", (*info) );
@@ -1742,7 +1658,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
        for( i = 0 ; i < count_details ; i++ )
        {
                //_mmcam_dbg_log( "Read line\"%s\"", buffer_details[i] );
-               
+
                count_token = 0;
                token = strtok_r( buffer_details[i], delimiters, &user_ptr );
 
@@ -1758,7 +1674,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                        continue;
                }
 
-               if( !_mmcamcorder_conf_get_value_type( type, category, buffer_token[0], &value_type ) )
+               if( !_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type ) )
                {
                        (*info)->detail_info[i] = NULL;
                        _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
@@ -1768,7 +1684,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                if( value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY )
                {
                        token = strtok_r( NULL, delimiters, &user_ptr );
-                       
+
                        while( token )
                        {
                                buffer_token[count_token] = token;
@@ -1788,11 +1704,11 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                {
                        // skip "="
                        strtok_r( NULL, delimiters_sub, &user_ptr );
-               
+
                        if( value_type == CONFIGURE_VALUE_STRING_ARRAY )
-                       {       
+                       {
                                token = strtok_r( NULL, delimiters_sub, &user_ptr );
-                               
+
                                while( token )
                                {
                                        buffer_token[count_token] = token;
@@ -1804,7 +1720,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                        else // CONFIGURE_VALUE_STRING
                        {
                                token = strtok_r( NULL, delimiters_3rd, &user_ptr );
-                                       
+
                                if( token )
                                {
                                        g_strchug( token );
@@ -1827,19 +1743,19 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                        case CONFIGURE_VALUE_INT:
                        {
                                type_int* new_int;
-                               
+
                                new_int        = (type_int*)g_malloc0( sizeof(type_int) );
                                new_int->name  = get_new_string( buffer_token[0] );
                                new_int->value = atoi( buffer_token[1] );
                                (*info)->detail_info[i] = (void*)new_int;
-                               
+
                                //_mmcam_dbg_log( "INT - name[%s],value[%d]", new_int->name, new_int->value );
                                break;
                        }
                        case CONFIGURE_VALUE_INT_RANGE:
                        {
                                type_int_range* new_int_range;
-                               
+
                                new_int_range                = (type_int_range*)g_malloc0( sizeof(type_int_range) );
                                new_int_range->name          = get_new_string( buffer_token[0] );
                                new_int_range->min           = atoi( buffer_token[1] );
@@ -1860,7 +1776,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                        {
                                int count_value = count_token - 2;
                                type_int_array* new_int_array;
-                               
+
                                new_int_array        = (type_int_array*)g_malloc0( sizeof(type_int_array) );
                                new_int_array->name  = get_new_string( buffer_token[0] );
                                new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
@@ -1875,7 +1791,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
 
                                new_int_array->default_value = atoi( buffer_token[count_token-1] );
                                //_mmcam_dbg_log( "   default value[%d]", new_int_array->default_value );
-                               
+
                                (*info)->detail_info[i] = (void*)new_int_array;
                                break;
                        }
@@ -1883,7 +1799,7 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                        {
                                int count_value = ( count_token - 3 ) >> 1;
                                type_int_pair_array* new_int_pair_array;
-                               
+
                                new_int_pair_array           = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
                                new_int_pair_array->name     = get_new_string( buffer_token[0] );
                                new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
@@ -1906,32 +1822,31 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                                new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
 
                                /*
-                               _mmcam_dbg_log( "   default value[%d,%d]", 
-                                                       new_int_pair_array->default_value[0],
-                                               new_int_pair_array->default_value[1] );
+                               _mmcam_dbg_log("default value[%d,%d]",
+                                              new_int_pair_array->default_value[0],
+                                              new_int_pair_array->default_value[1]);
                                */
-                               
 
                                (*info)->detail_info[i] = (void*)new_int_pair_array;
                                break;
-                       }       
+                       }
                        case CONFIGURE_VALUE_STRING:
                        {
-                               type_string* new_string;
-                               
-                               new_string        = (type_string*)g_malloc0( sizeof(type_string) );
+                               type_string2* new_string;
+
+                               new_string        = (type_string2*)g_malloc0( sizeof(type_string2) );
                                new_string->name  = get_new_string( buffer_token[0] );
                                new_string->value = get_new_string( buffer_token[1] );
                                (*info)->detail_info[i] = (void*)new_string;
-                               
+
                                //_mmcam_dbg_log( "STRING - name[%s],value[%s]", new_string->name, new_string->value );
                                break;
-                       }       
+                       }
                        case CONFIGURE_VALUE_STRING_ARRAY:
                        {
                                int count_value = count_token - 2;
                                type_string_array* new_string_array;
-                               
+
                                new_string_array        = (type_string_array*)g_malloc0( sizeof(type_string_array) );
                                new_string_array->name  = get_new_string( buffer_token[0] );
                                new_string_array->count = count_value;
@@ -1946,32 +1861,32 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
 
                                new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
                                //_mmcam_dbg_log( "   default value[%s]", new_string_array->default_value );
-                               
+
                                (*info)->detail_info[i] = (void*)new_string_array;
                                break;
                        }
                        case CONFIGURE_VALUE_ELEMENT:
                        {
-                               type_element* new_element;
-                               
-                               new_element               = (type_element*)g_malloc0( sizeof(type_element) );
+                               type_element2* new_element;
+
+                               new_element               = (type_element2*)g_malloc0( sizeof(type_element2) );
                                new_element->name         = get_new_string( buffer_token[0] );
                                new_element->element_name = get_new_string( buffer_token[1] );
                                new_element->count_int    = atoi( buffer_token[2] );
                                new_element->value_int    = NULL;
                                new_element->count_string = atoi( buffer_token[3] );
                                new_element->value_string = NULL;
-                               
+
                                //_mmcam_dbg_log( "Element - name[%s],element_name[%s],count_int[%d],count_string[%d]", new_element->name, new_element->element_name, new_element->count_int, new_element->count_string );
 
                                /* add int values */
                                if( new_element->count_int > 0 )
                                {
-                                       new_element->value_int          = (type_int**)g_malloc0( sizeof(type_int*)*(new_element->count_int) );
-                                       
+                                       new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
+
                                        for( j = 0 ; j < new_element->count_int ; j++ )
                                        {
-                                               new_element->value_int[j]        = (type_int*)g_malloc( sizeof(type_int) );
+                                               new_element->value_int[j]        = (type_int2*)g_malloc( sizeof(type_int2) );
                                                new_element->value_int[j]->name  = get_new_string( buffer_token[4+(j<<1)] );
                                                new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
                                                //_mmcam_dbg_log( "   Element INT[%d] - name[%s],value[%d]", j, new_element->value_int[j]->name, new_element->value_int[j]->value );
@@ -1985,11 +1900,11 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
                                /* add string values */
                                if( new_element->count_string > 0 )
                                {
-                                       new_element->value_string       = (type_string**)g_malloc0( sizeof(type_string*)*(new_element->count_string) );
-                                       
+                                       new_element->value_string       = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
+
                                        for( ; j < new_element->count_string + new_element->count_int ; j++ )
                                        {
-                                               new_element->value_string[j-new_element->count_int]     = (type_string*)g_malloc0( sizeof(type_string) );
+                                               new_element->value_string[j-new_element->count_int]     = (type_string2*)g_malloc0( sizeof(type_string2) );
                                                new_element->value_string[j-new_element->count_int]->name       = get_new_string( buffer_token[4+(j<<1)] );
                                                new_element->value_string[j-new_element->count_int]->value      = get_new_string( buffer_token[5+(j<<1)] );
                                                //_mmcam_dbg_log( "   Element STRING[%d] - name[%s],value[%s]", j-new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value );
@@ -2002,10 +1917,10 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
 
                                (*info)->detail_info[i] = (void*)new_element;
                                break;
-                       }       
+                       }
                        default:
                                break;
-               }               
+               }
        }
 
        //_mmcam_dbg_log( "Done." );
@@ -2014,11 +1929,10 @@ _mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_
 }
 
 
-int
-_mmcamcorder_conf_get_value_int( camera_conf* configure_info, int category, char* name, int* value )
+int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
 {
        int i, count;
-       conf_info* info;
+       conf_detail* info;
 
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
@@ -2027,16 +1941,16 @@ _mmcamcorder_conf_get_value_int( camera_conf* configure_info, int category, char
 
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
-               
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
+
                for( i = 0 ; i < count ; i++ )
                {
                        if( info->detail_info[i] == NULL )
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = ((type_int*)(info->detail_info[i]))->value;
@@ -2046,7 +1960,7 @@ _mmcamcorder_conf_get_value_int( camera_conf* configure_info, int category, char
                }
        }
 
-       if( _mmcamcorder_conf_get_default_value_int( configure_info->type, category, name, value ) )
+       if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
        {
                //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
                return TRUE;
@@ -2058,10 +1972,10 @@ _mmcamcorder_conf_get_value_int( camera_conf* configure_info, int category, char
 }
 
 int
-_mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, char* name, type_int_range** value )
+_mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
 {
        int i, count;
-       conf_info* info;
+       conf_detail* info;
 
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
@@ -2070,21 +1984,21 @@ _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category
 
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
-               
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
+
                for( i = 0 ; i < count ; i++ )
                {
                        if( info->detail_info[i] == NULL )
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = (type_int_range*)(info->detail_info[i]);
                                /*
-                               _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]", 
+                               _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
                                                name, (*value)->min, (*value)->max, (*value)->default_value );
                                */
                                return TRUE;
@@ -2100,12 +2014,12 @@ _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category
 }
 
 int
-_mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, char* name, type_int_array** value )
+_mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
 {
        int i, count;
-       conf_info* info;
+       conf_detail* info;
 
-       //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
+       /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
 
        mmf_return_val_if_fail( configure_info, FALSE );
        mmf_return_val_if_fail( name, FALSE );
@@ -2121,12 +2035,12 @@ _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = (type_int_array*)(info->detail_info[i]);
                                /*
-                               _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]", 
+                               _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
                                                name, (*value)->value, (*value)->count, (*value)->default_value );
                                */
                                return TRUE;
@@ -2142,10 +2056,10 @@ _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category
 }
 
 int
-_mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, char* name, type_int_pair_array** value )
+_mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
 {
        int i, count;
-       conf_info* info;
+       conf_detail* info;
 
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
@@ -2154,22 +2068,22 @@ _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int cat
 
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
-               
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
+
                for( i = 0 ; i < count ; i++ )
                {
                        if( info->detail_info[i] == NULL )
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = (type_int_pair_array*)(info->detail_info[i]);
                                /*
-                               _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]", 
-                                               name, (*value)->value[0], (*value)->value[1], (*value)->count, 
+                               _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
+                                               name, (*value)->value[0], (*value)->value[1], (*value)->count,
                                                (*value)->default_value[0], (*value)->default_value[1] );
                                */
                                return TRUE;
@@ -2184,29 +2098,28 @@ _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int cat
        return FALSE;
 }
 
-int
-_mmcamcorder_conf_get_value_string( camera_conf* configure_info, int category, char* name, char** value )
+int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
 {
        int i, count;
-       conf_info* info;
-       
+       conf_detail* info;
+
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
        mmf_return_val_if_fail( configure_info, FALSE );
        mmf_return_val_if_fail( name, FALSE );
-       
+
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
-               
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
+
                for( i = 0 ; i < count ; i++ )
                {
                        if( info->detail_info[i] == NULL )
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = ((type_string*)(info->detail_info[i]))->value;
@@ -2216,7 +2129,7 @@ _mmcamcorder_conf_get_value_string( camera_conf* configure_info, int category, c
                }
        }
 
-       if( _mmcamcorder_conf_get_default_value_string( configure_info->type, category, name, value ) )
+       if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
        {
                //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
                return TRUE;
@@ -2228,10 +2141,10 @@ _mmcamcorder_conf_get_value_string( camera_conf* configure_info, int category, c
 }
 
 int
-_mmcamcorder_conf_get_value_string_array    ( camera_conf* configure_info, int category, char* name, type_string_array** value )
+_mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
 {
        int i, count;
-       conf_info* info;
+       conf_detail* info;
 
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
@@ -2240,8 +2153,8 @@ _mmcamcorder_conf_get_value_string_array    ( camera_conf* configure_info, int c
 
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
 
                for( i = 0 ; i < count ; i++ )
                {
@@ -2249,12 +2162,12 @@ _mmcamcorder_conf_get_value_string_array    ( camera_conf* configure_info, int c
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
                        {
                                *value = (type_string_array*)(info->detail_info[i]);
                                /*
-                               _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]", 
+                               _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
                                                name, (*value)->value, (*value)->count, (*value)->default_value );
                                */
                                return TRUE;
@@ -2269,12 +2182,11 @@ _mmcamcorder_conf_get_value_string_array    ( camera_conf* configure_info, int c
        return FALSE;
 }
 
-int
-_mmcamcorder_conf_get_element( camera_conf* configure_info, int category, char* name, type_element** element )
+int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
 {
        int i, count;
-       conf_info* info;
-       
+       conf_detail* info;
+
        //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
 
        mmf_return_val_if_fail( configure_info, FALSE );
@@ -2282,16 +2194,16 @@ _mmcamcorder_conf_get_element( camera_conf* configure_info, int category, char*
 
        if( configure_info->info[category] )
        {
-               count   = configure_info->info[category]->count;
-               info    = configure_info->info[category];
-               
+               count = configure_info->info[category]->count;
+               info = configure_info->info[category];
+
                for( i = 0 ; i < count ; i++ )
                {
                        if( info->detail_info[i] == NULL )
                        {
                                continue;
                        }
-                       
+
                        if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
                        {
                                *element = (type_element*)(info->detail_info[i]);
@@ -2301,7 +2213,7 @@ _mmcamcorder_conf_get_element( camera_conf* configure_info, int category, char*
                }
        }
 
-       if( _mmcamcorder_conf_get_default_element( configure_info->type, category, name, element ) )
+       if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
        {
                //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
                return TRUE;
@@ -2313,7 +2225,7 @@ _mmcamcorder_conf_get_element( camera_conf* configure_info, int category, char*
 }
 
 int
-_mmcamcorder_conf_get_value_element_name( type_element* element, char** value )
+_mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
 {
        //_mmcam_dbg_log( "Entered..." );
 
@@ -2327,12 +2239,12 @@ _mmcamcorder_conf_get_value_element_name( type_element* element, char** value )
 }
 
 int
-_mmcamcorder_conf_get_value_element_int( type_element* element, char* name, int* value )
+_mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
 {
        int i;
-       
+
        //_mmcam_dbg_log( "Entered..." );
-       
+
        mmf_return_val_if_fail( element, FALSE );
        mmf_return_val_if_fail( name, FALSE );
 
@@ -2346,19 +2258,19 @@ _mmcamcorder_conf_get_value_element_int( type_element* element, char* name, int*
                }
        }
 
-       _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]", 
+       _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
                element->name, name, element->count_int );
 
        return FALSE;
 }
 
 int
-_mmcamcorder_conf_get_value_element_string( type_element* element, char* name, char** value )
+_mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
 {
        int i;
-       
+
        //_mmcam_dbg_log( "Entered..." );
-       
+
        mmf_return_val_if_fail( element, FALSE );
        mmf_return_val_if_fail( name, FALSE );
 
@@ -2372,7 +2284,7 @@ _mmcamcorder_conf_get_value_element_string( type_element* element, char* name, c
                }
        }
 
-       _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]", 
+       _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
                element->name, name, element->count_string );
 
        return FALSE;
@@ -2403,7 +2315,7 @@ _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* ele
                for( i = 0 ; i < element->count_int ; i++ )
                {
                        MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
-                       
+
                        _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
                                element->element_name,
                                element->value_int[i]->name,
@@ -2440,28 +2352,35 @@ _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* ele
 }
 
 int
-_mmcamcorder_conf_get_default_value_int( int type, int category, char* name, int* value )
+_mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
 {
        int i = 0;
        int count_value = 0;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return FALSE;
+       }
+
        //_mmcam_dbg_log( "Entered..." );
-       
+
        mmf_return_val_if_fail( name, FALSE );
 
-       if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+       if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
        {
                _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
-               return FALSE;           
+               return FALSE;
        }
 
        if( type == CONFIGURE_TYPE_MAIN )
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_main_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
                        {
-                               *value = conf_main_info_table[category][i].value_int;
+                               *value = hcamcorder->conf_main_info_table[category][i].value_int;
                                return TRUE;
                        }
                }
@@ -2470,12 +2389,12 @@ _mmcamcorder_conf_get_default_value_int( int type, int category, char* name, int
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
                        {
-                               *value = conf_ctrl_info_table[category][i].value_int;
+                               *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
                                return TRUE;
                        }
-               }               
+               }
        }
 
        _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
@@ -2483,29 +2402,35 @@ _mmcamcorder_conf_get_default_value_int( int type, int category, char* name, int
        return FALSE;
 }
 
-int
-_mmcamcorder_conf_get_default_value_string( int type, int category, char* name, char** value )
+int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
 {
        int i = 0;
        int count_value = 0;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return FALSE;
+       }
+
        //_mmcam_dbg_log( "Entered..." );
-       
+
        mmf_return_val_if_fail( name, FALSE );
 
-       if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+       if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
        {
                _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
-               return FALSE;           
+               return FALSE;
        }
 
        if( type == CONFIGURE_TYPE_MAIN )
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_main_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
                        {
-                               *value = conf_main_info_table[category][i].value_string;
+                               *value = hcamcorder->conf_main_info_table[category][i].value_string;
                                _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
                                return TRUE;
                        }
@@ -2515,9 +2440,9 @@ _mmcamcorder_conf_get_default_value_string( int type, int category, char* name,
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
                        {
-                               *value = conf_ctrl_info_table[category][i].value_string;
+                               *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
                                _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
                                return TRUE;
                        }
@@ -2526,32 +2451,38 @@ _mmcamcorder_conf_get_default_value_string( int type, int category, char* name,
 
        _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
 
-       return FALSE;   
+       return FALSE;
 }
 
-int
-_mmcamcorder_conf_get_default_element( int type, int category, char* name, type_element** element )
+int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
 {
        int i = 0;
        int count_value = 0;
 
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return FALSE;
+       }
+
        //_mmcam_dbg_log( "Entered..." );
-       
+
        mmf_return_val_if_fail( name, FALSE );
 
-       if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+       if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
        {
                _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
-               return FALSE;           
+               return FALSE;
        }
 
        if( type == CONFIGURE_TYPE_MAIN )
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_main_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
                        {
-                               *element = conf_main_info_table[category][i].value_element;
+                               *element = hcamcorder->conf_main_info_table[category][i].value_element;
                                _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
                                return TRUE;
                        }
@@ -2561,9 +2492,9 @@ _mmcamcorder_conf_get_default_element( int type, int category, char* name, type_
        {
                for( i = 0 ; i < count_value ; i++ )
                {
-                       if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+                       if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
                        {
-                               *element = conf_ctrl_info_table[category][i].value_element;
+                               *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
                                _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
                                return TRUE;
                        }
@@ -2575,9 +2506,15 @@ _mmcamcorder_conf_get_default_element( int type, int category, char* name, type_
        return FALSE;
 }
 
-int
-_mmcamcorder_conf_get_category_size( int type, int category, int* size )
+int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
 {
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_err("handle is NULL");
+               return FALSE;
+       }
+
 //     mmf_return_val_if_fail( conf_main_category_size, FALSE );
 //     mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
 
@@ -2585,20 +2522,20 @@ _mmcamcorder_conf_get_category_size( int type, int category, int* size )
        {
                mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
 
-               *size = (int)conf_main_category_size[category];
+               *size = (int)hcamcorder->conf_main_category_size[category];
        }
        else
        {
                mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
 
-               *size = (int)conf_ctrl_category_size[category];
+               *size = (int)hcamcorder->conf_ctrl_category_size[category];
        }
 
-       return TRUE;    
+       return TRUE;
 }
 
 void
-_mmcamcorder_conf_print_info( camera_conf** configure_info )
+_mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
 {
        int i, j, k, type, category_type;
 
@@ -2629,7 +2566,7 @@ _mmcamcorder_conf_print_info( camera_conf** configure_info )
                        g_print( "[ConfigureInfo] : Category [%d]\n", i );
                        for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
                        {
-                               if( _mmcamcorder_conf_get_value_type( (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
+                               if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
                                {
                                        switch( type )
                                        {
@@ -2676,7 +2613,7 @@ _mmcamcorder_conf_print_info( camera_conf** configure_info )
                                                        for( k = 0 ; k < temp_element->count_string ; k++ )
                                                        {
                                                                g_print( "                          - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
-                                                       }                                                       
+                                                       }
                                                        break;
                                                default:
                                                        g_print( "[ConfigureInfo] : Not matched value type... So can not print data... check it... Name[%s],type[%d]\n", ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, type );
@@ -2687,7 +2624,7 @@ _mmcamcorder_conf_print_info( camera_conf** configure_info )
                                {
                                        g_print( "[ConfigureInfo] : Failed to get value type." );
                                }
-                       }                       
+                       }
                }
        }
 
@@ -2699,16 +2636,16 @@ static type_element *
 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
 {
        type_element *telement = NULL;
-       char * codec_type_str = NULL;
+       const char *codec_type_str = NULL;
        int codec_type = MM_AUDIO_CODEC_INVALID;
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, NULL);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
        mmf_return_val_if_fail(sc, NULL);
-       
+
        _mmcam_dbg_log("");
 
        /* Check element availability */
@@ -2718,7 +2655,7 @@ __mmcamcorder_get_audio_codec_element(MMHandleType handle)
        {
                case MM_AUDIO_CODEC_AMR:
                        codec_type_str = "AMR";
-                       break;                  
+                       break;
                case MM_AUDIO_CODEC_G723_1:
                        codec_type_str = "G723_1";
                        break;
@@ -2751,10 +2688,10 @@ __mmcamcorder_get_audio_codec_element(MMHandleType handle)
                        return NULL;
        }
 
-       _mmcamcorder_conf_get_element( hcamcorder->conf_main, 
-                               CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
-                               codec_type_str, 
-                               &telement );
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+                                     CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
+                                     codec_type_str,
+                                     &telement);
 
        return telement;
 }
@@ -2764,16 +2701,16 @@ static type_element *
 __mmcamcorder_get_video_codec_element(MMHandleType handle)
 {
        type_element *telement = NULL;
-       char * codec_type_str = NULL;
+       const char *codec_type_str = NULL;
        int codec_type = MM_VIDEO_CODEC_INVALID;
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, NULL);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
        mmf_return_val_if_fail(sc, NULL);
-       
+
        _mmcam_dbg_log("");
 
        /* Check element availability */
@@ -2796,7 +2733,7 @@ __mmcamcorder_get_video_codec_element(MMHandleType handle)
                case MM_VIDEO_CODEC_MPEG1:
                        codec_type_str = "MPEG1";
                        break;
-               case MM_VIDEO_CODEC_THEORA:             // OGG
+               case MM_VIDEO_CODEC_THEORA:
                        codec_type_str = "THEORA";
                        break;
                default:
@@ -2804,10 +2741,10 @@ __mmcamcorder_get_video_codec_element(MMHandleType handle)
                        return NULL;
        }
 
-       _mmcamcorder_conf_get_element( hcamcorder->conf_main, 
-                               CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
-                               codec_type_str, 
-                               &telement );
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+                                     CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
+                                     codec_type_str,
+                                     &telement);
 
        return telement;
 }
@@ -2817,16 +2754,16 @@ static type_element *
 __mmcamcorder_get_image_codec_element(MMHandleType handle)
 {
        type_element *telement = NULL;
-       char * codec_type_str = NULL;
+       const char *codec_type_str = NULL;
        int codec_type = MM_IMAGE_CODEC_INVALID;
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, NULL);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
        mmf_return_val_if_fail(sc, NULL);
-       
+
        _mmcam_dbg_log("");
 
        /* Check element availability */
@@ -2881,10 +2818,10 @@ __mmcamcorder_get_image_codec_element(MMHandleType handle)
                        return NULL;
        }
 
-       _mmcamcorder_conf_get_element( hcamcorder->conf_main, 
-                               CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
-                               codec_type_str, 
-                               &telement );
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+                                     CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
+                                     codec_type_str,
+                                     &telement);
 
        return telement;
 }
@@ -2894,16 +2831,16 @@ static type_element *
 __mmcamcorder_get_file_format_element(MMHandleType handle)
 {
        type_element *telement = NULL;
-       char * mux_type_str = NULL;
+       const char *mux_type_str = NULL;
        int file_type = MM_FILE_FORMAT_INVALID;
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, NULL);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
        mmf_return_val_if_fail(sc, NULL);
-       
+
        _mmcam_dbg_log("");
 
        /* Check element availability */
@@ -2950,15 +2887,18 @@ __mmcamcorder_get_file_format_element(MMHandleType handle)
                case MM_FILE_FORMAT_MATROSKA:
                        mux_type_str = "MATROSKA";
                        break;
+               case MM_FILE_FORMAT_M2TS:
+                       mux_type_str = "M2TS";
+                       break;
                default:
                        _mmcam_dbg_err( "Not supported file format[%d]", file_type );
                        return NULL;
        }
 
-       _mmcamcorder_conf_get_element( hcamcorder->conf_main, 
-                               CONFIGURE_CATEGORY_MAIN_MUX,
-                               mux_type_str, 
-                               &telement );
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+                                     CONFIGURE_CATEGORY_MAIN_MUX,
+                                     mux_type_str,
+                                     &telement);
 
        return telement;
 }
@@ -2970,7 +2910,7 @@ _mmcamcorder_get_type_element(MMHandleType handle, int type)
        type_element *telement = NULL;
 
        _mmcam_dbg_log("type:%d", type);
-       
+
        switch(type)
        {
                case MM_CAM_AUDIO_ENCODER:
@@ -2993,7 +2933,7 @@ _mmcamcorder_get_type_element(MMHandleType handle, int type)
 }
 
 
-int _mmcamcorder_get_audio_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
 {
        int codec_index = MM_AUDIO_CODEC_INVALID;
 
@@ -3031,7 +2971,7 @@ int _mmcamcorder_get_audio_codec_format(MMHandleType handle, char *name)
 
 
 
-int _mmcamcorder_get_video_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
 {
        int codec_index = MM_VIDEO_CODEC_INVALID;
 
@@ -3061,7 +3001,7 @@ int _mmcamcorder_get_video_codec_format(MMHandleType handle, char *name)
 
 
 
-int _mmcamcorder_get_image_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
 {
        int codec_index = MM_IMAGE_CODEC_INVALID;
 
@@ -3102,7 +3042,7 @@ int _mmcamcorder_get_image_codec_format(MMHandleType handle, char *name)
 }
 
 
-int _mmcamcorder_get_mux_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
 {
        int mux_index = MM_FILE_FORMAT_INVALID;
 
@@ -3137,6 +3077,9 @@ int _mmcamcorder_get_mux_format(MMHandleType handle, char *name)
                mux_index = MM_FILE_FORMAT_MMF;
        } else if (!strcmp(name, "MATROSKA")) {
                mux_index = MM_FILE_FORMAT_MATROSKA;
+       } else if (!strcmp(name, "M2TS")) {
+               mux_index = MM_FILE_FORMAT_M2TS;
+
        }
 
        _mmcam_dbg_log("mux index %d", mux_index);
@@ -3146,7 +3089,7 @@ int _mmcamcorder_get_mux_format(MMHandleType handle, char *name)
 
 
 int
-_mmcamcorder_get_format(MMHandleType handle, int conf_category, char * name)
+_mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
 {
        int fmt = -1;
 
@@ -3180,9 +3123,9 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **
        camera_conf* configure_info = NULL;
        int *arr = NULL;
        int total_count = 0;
-       
+
        mmf_return_val_if_fail(hcamcorder, 0);
-       
+
        _mmcam_dbg_log("conf_category:%d", conf_category);
 
        configure_info = hcamcorder->conf_main;
@@ -3190,9 +3133,9 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **
        if (configure_info->info[conf_category]) {
                int i = 0;
                int fmt = 0;
-               char *name = NULL;
+               const char *name = NULL;
                int count = configure_info->info[conf_category]->count;
-               conf_info *info = configure_info->info[conf_category];
+               conf_detail *info = configure_info->info[conf_category];
 
                _mmcam_dbg_log("count[%d], info[%p]", count, info);
 
index 1c03789..41e0056 100644 (file)
  * limitations under the License.
  *
  */
+
 #include "mm_camcorder_exifinfo.h"
 #include "mm_camcorder_exifdef.h"
+#include "mm_camcorder_internal.h"
 
 #include <libexif/exif-loader.h>
 #include <libexif/exif-utils.h>
 #define JPEG_MAX_SIZE                           20000000
 #define JPEG_THUMBNAIL_MAX_SIZE                 (128*1024)
 #define JPEG_DATA_OFFSET                        2
+#define JPEG_EXIF_OFFSET                        4
 #define EXIF_MARKER_SOI_LENGTH                  2
 #define EXIF_MARKER_APP1_LENGTH                 2
 #define EXIF_APP1_LENGTH                        2
 
+
 #if MM_EXIFINFO_USE_BINARY_EXIFDATA
 /**
  * Exif Binary Data.
@@ -102,37 +105,35 @@ _exif_get_jpeg_marker_offset (void *jpeg, int jpeg_size, unsigned short marker)
        unsigned long   ret;
        int i;
 
-       // mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-
        m[0] = marker >> 8;
        m[1] = marker & 0x00FF;
 
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s] marker: 0x%02X 0x%02X\n\n", __LINE__, __func__,m[0], m[1]);
+       _mmcam_dbg_log("marker: 0x%02X 0x%02X", m[0], m[1]);
 
-       if (*src == 0xff && *(src + 1) == 0xd8) 
+       if (*src == 0xff && *(src + 1) == 0xd8)
        {
                p = src + 2; /* SOI(start of image) */
-       } 
-       else 
+       }
+       else
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid JPEG file.\n", __LINE__, __func__);
+               _mmcam_dbg_log("invalid JPEG file.");
                return 0UL;
        }
 
-       for (i = 0; i < src_sz - (1 + 2); i++, p++) 
+       for (i = 0; i < src_sz - (1 + 2); i++, p++)
        {
-               if (*p == 0xff) 
+               if (*p == 0xff)
                {
                        /*marker is 0xFFxx*/
-                       if (*(p + 1) == m[1]) 
+                       if (*(p + 1) == m[1])
                        {
                                ret = p - src;
-                               mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]marker offset: %lu %p %p.\n", __LINE__, __func__,ret, (p+1), src);
+                               _mmcam_dbg_log("marker offset: %lu %p %p.",ret, (p+1), src);
                                return ret;
                        }
-               } 
+               }
        }
-       mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]Marker not found.\n", __LINE__, __func__);
+       _mmcam_dbg_log("Marker not found.");
        return 0UL;
 }
 #endif /* _MMCAMCORDER_EXIF_GET_JPEG_MARKER_OFFSET */
@@ -143,12 +144,10 @@ mm_exif_get_exif_data_from_data (mm_exif_info_t *info)
 {
        ExifData                *ed = NULL;
 
-       //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-
        ed = exif_data_new_from_data(info->data, info->size);
        if( ed == NULL )
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]Null exif data. (ed:%p)\n", __LINE__, __func__, ed);
+               _mmcam_dbg_log("Null exif data. (ed:%p)", ed);
        }
 
        return ed;
@@ -164,8 +163,6 @@ mm_exif_get_exif_from_info (mm_exif_info_t *info)
        unsigned char   size[2];
        unsigned int    i;
 
-       //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-       
        /*get ExifData from info*/
        loader = exif_loader_new ();
 
@@ -189,23 +186,23 @@ mm_exif_set_exif_to_info (mm_exif_info_t *info, ExifData *exif)
 
        if (!exif)
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]exif Null\n", __LINE__, __func__);
+               _mmcam_dbg_log("exif Null");
                return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
        }
 
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]exif(ifd :%p)\n", __LINE__, __func__, exif->ifd);
+       _mmcam_dbg_log("exif(ifd :%p)", exif->ifd);
 
        if(info->data)
        {
-               free (info->data); 
-               info->data = NULL; 
-               info->size = 0; 
+               free (info->data);
+               info->data = NULL;
+               info->size = 0;
        }
 
        exif_data_save_data (exif, &eb, &ebs);
        if(eb==NULL)
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]MM_ERROR_CAMCORDER_LOW_MEMORY\n", __LINE__, __func__);
+               _mmcam_dbg_log("MM_ERROR_CAMCORDER_LOW_MEMORY");
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
        info->data = eb;
@@ -215,15 +212,14 @@ mm_exif_set_exif_to_info (mm_exif_info_t *info, ExifData *exif)
 
 
 int
-mm_exif_set_add_entry (ExifData *exif, ExifIfd ifd, ExifTag tag,ExifFormat format,unsigned long components,unsigned char* data)
+mm_exif_set_add_entry (ExifData *exif, ExifIfd ifd, ExifTag tag,ExifFormat format,unsigned long components, const char* data)
 {
-       /*mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);*/
        ExifData *ed = (ExifData *)exif;
        ExifEntry *e = NULL;
 
        if (exif == NULL || format <= 0 || components <= 0 || data == NULL) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p format=%d, components=%lu data=%p!\n",
-                                         __LINE__, __func__,exif,format,components,data);
+               _mmcam_dbg_err("invalid argument exif=%p format=%d, components=%lu data=%p!",
+                                         exif,format,components,data);
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        }
 
@@ -233,7 +229,7 @@ mm_exif_set_add_entry (ExifData *exif, ExifIfd ifd, ExifTag tag,ExifFormat forma
        /*create new tag*/
        e = exif_entry_new();
        if (e == NULL) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] entry create error!\n", __LINE__, __func__);
+               _mmcam_dbg_err("entry create error!");
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
 
@@ -281,23 +277,23 @@ mm_exif_create_exif_info (mm_exif_info_t **info)
        unsigned char *eb = NULL;
        unsigned int ebs;
 #endif
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+       _mmcam_dbg_log("");
 
        if (!info) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] NULL pointer\n", __LINE__, __func__);
+               _mmcam_dbg_err("NULL pointer");
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        }
 
        x = malloc(sizeof(mm_exif_info_t));
        if (!x) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]malloc error\n", __LINE__, __func__);
+               _mmcam_dbg_err("malloc error");
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
 #if MM_EXIFINFO_USE_BINARY_EXIFDATA
        x->data = NULL;
        x->data = malloc(_EXIF_BIN_SIZE_);
        if (!x->data) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]malloc error\n", __LINE__, __func__);
+               _mmcam_dbg_err("malloc error");
                free(x);
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
@@ -306,7 +302,7 @@ mm_exif_create_exif_info (mm_exif_info_t **info)
 #else
        ed = exif_data_new();
        if (!ed) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]exif data new error\n", __LINE__, __func__);
+               _mmcam_dbg_err("exif data new error");
                return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
 
@@ -318,7 +314,7 @@ mm_exif_create_exif_info (mm_exif_info_t **info)
 
        exif_data_save_data(ed, &eb, &ebs);
        if (eb == NULL) {
-               mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]exif_data_save_data error\n", __LINE__, __func__);
+               _mmcam_dbg_err("exif_data_save_data error");
                free(x->data);
                free(x);
                exif_data_unref(ed);
@@ -331,7 +327,7 @@ mm_exif_create_exif_info (mm_exif_info_t **info)
 #endif
        *info = x;
 
-       mmf_debug(MMF_DEBUG_LOG, "%s() Data:%p Size:%d\n", __func__, x->data, x->size);
+       _mmcam_dbg_log("Data:%p Size:%d", x->data, x->size);
 
        return MM_ERROR_NONE;
 }
@@ -339,17 +335,17 @@ mm_exif_create_exif_info (mm_exif_info_t **info)
 void
 mm_exif_destory_exif_info (mm_exif_info_t *info)
 {
-       //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
+       //_mmcam_dbg_log( "");
 
 #if MM_EXIFINFO_USE_BINARY_EXIFDATA
        if (info) {
-               if (info->data) 
+               if (info->data)
                        free (info->data);
                free (info);
        }
 #else
        if (info) {
-               if (info->data) 
+               if (info->data)
                        exif_mem_free (info->data);
                free (info);
        }
@@ -367,11 +363,11 @@ mm_exif_add_thumbnail_info (mm_exif_info_t *info, void *thumbnail, int width, in
        int ret = MM_ERROR_NONE;
        int cntl = 0;
 
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s] Thumbnail size:%d, width:%d, height:%d\n", __LINE__, __func__, len, width, height);
+       _mmcam_dbg_log("Thumbnail size:%d, width:%d, height:%d", len, width, height);
 
        if( len > JPEG_THUMBNAIL_MAX_SIZE )
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] Thumbnail size[%d] over!!! Skip inserting thumbnail...\n", __LINE__, __func__, len);
+               _mmcam_dbg_err("Thumbnail size[%d] over!!! Skip inserting thumbnail...", len);
                return MM_ERROR_NONE;
        }
 
@@ -381,10 +377,10 @@ mm_exif_add_thumbnail_info (mm_exif_info_t *info, void *thumbnail, int width, in
        ed->size = len;
 
        /* set thumbnail data */
-       p_compressed = malloc(sizeof(ExifShort));
+       p_compressed = (unsigned char *)malloc(sizeof(ExifShort));
        if (p_compressed != NULL) {
                exif_set_short(p_compressed, exif_data_get_byte_order(ed), 6);
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_COMPRESSION, EXIF_FORMAT_SHORT, 1, p_compressed);
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_COMPRESSION, EXIF_FORMAT_SHORT, 1, (const char *)p_compressed);
                if (ret != MM_ERROR_NONE) {
                        goto exit;
                }
@@ -395,12 +391,12 @@ mm_exif_add_thumbnail_info (mm_exif_info_t *info, void *thumbnail, int width, in
 
        /* set thumbnail size */
        exif_set_long ((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), width);
-       ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_WIDTH, EXIF_FORMAT_LONG, 1, (unsigned char*)&elong[cntl++]);
+       ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_WIDTH, EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                goto exit;
        }
        exif_set_long ((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), height);
-       ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_LENGTH, EXIF_FORMAT_LONG, 1, (unsigned char*)&elong[cntl++]);
+       ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_LENGTH, EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                goto exit;
        }
@@ -412,7 +408,7 @@ mm_exif_add_thumbnail_info (mm_exif_info_t *info, void *thumbnail, int width, in
 
        ed->data = NULL;
        ed->size = 0;
-       exif_data_unref (ed);   
+       exif_data_unref (ed);
 
 exit :
        if(p_compressed != NULL)
@@ -421,115 +417,6 @@ exit :
 }
 
 
-int mm_exif_mnote_create (ExifData *exif)
-{
-       ExifData* ed = exif;
-       ExifDataOption o = 0;
-       if(!ed){
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p \n", __LINE__, __func__,ed);
-               return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
-       }
-
-       if(!exif_data_mnote_data_new(ed, MAKER_SAMSUNG,  o )){
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_mnote_data_samsung_new() failed. \n", __LINE__, __func__);
-               return MM_ERROR_CAMCORDER_MNOTE_CREATION;
-       }
-
-       return MM_ERROR_NONE;
-}
-
-
-int mm_exif_mnote_set_add_entry (ExifData *exif, MnoteSamsungTag tag, int index, int subindex1, int subindex2)
-{
-       ExifData *ed = exif;
-       ExifMnoteData *md;
-
-       ExifShort product_id = 32768;   //should be modified
-       char serialNum[] = "SerialNum123"; //should be modified
-
-       if(!ed){
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p \n", __LINE__, __func__,ed);
-               return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
-       }
-
-       md = exif_data_get_mnote_data (ed);
-       if(!md){
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_get_mnote_data() failed. \n", __LINE__, __func__);
-               return MM_ERROR_CAMCORDER_MNOTE_CREATION;
-       }
-
-       if(!exif_data_mnote_set_mem_for_adding_entry(md, MAKER_SAMSUNG)){
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_mem_for_adding_entry() failed. \n", __LINE__, __func__);
-               return MM_ERROR_CAMCORDER_MNOTE_MALLOC;
-       }
-
-       exif_mnote_data_set_byte_order(md, (ExifByteOrder) exif_data_get_data_order(ed));
-
-       switch(tag){
-               case MNOTE_SAMSUNG_TAG_MNOTE_VERSION:
-                       if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_UNDEFINED, 4, index)){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }
-                       break;
-               case MNOTE_SAMSUNG_TAG_DEVICE_ID:
-                       if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }
-                       break;
-               case MNOTE_SAMSUNG_TAG_MODEL_ID:
-                       if(!exif_data_mnote_set_add_entry_subtag(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, MNOTE_SAMSUNG_SUBTAG_MODEL_ID_CLASS, subindex1, MNOTE_SAMSUNG_SUBTAG_MODEL_ID_DEVEL, subindex2, product_id )){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry_subtag() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }       
-                       break;
-               case MNOTE_SAMSUNG_TAG_COLOR_INFO:
-               case MNOTE_SAMSUNG_TAG_SERIAL_NUM:
-                       if(!exif_data_mnote_set_add_entry_string(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_ASCII, strlen(serialNum), serialNum)){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry_string() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }
-                       break;
-               case MNOTE_SAMSUNG_TAG_IMAGE_COUNT:
-               case MNOTE_SAMSUNG_TAG_GPS_INFO01:
-               case MNOTE_SAMSUNG_TAG_GPS_INFO02:
-               case MNOTE_SAMSUNG_TAG_PREVIEW_IMAGE:
-               case MNOTE_SAMSUNG_TAG_FAVOR_TAGGING:
-               case MNOTE_SAMSUNG_TAG_SRW_COMPRESS:
-               case MNOTE_SAMSUNG_TAG_COLOR_SPACE:
-                       if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }
-                       break;
-               case MNOTE_SAMSUNG_TAG_AE:
-               case MNOTE_SAMSUNG_TAG_AF:
-               case MNOTE_SAMSUNG_TAG_AWB01:
-               case MNOTE_SAMSUNG_TAG_AWB02:
-               case MNOTE_SAMSUNG_TAG_IPC:
-               case MNOTE_SAMSUNG_TAG_SCENE_RESULT:
-               case MNOTE_SAMSUNG_TAG_SADEBUG_INFO01:
-               case MNOTE_SAMSUNG_TAG_SADEBUG_INFO02:
-               case MNOTE_SAMSUNG_TAG_FACE_DETECTION:
-                       if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
-                               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
-                               return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
-                       }
-                       break;
-               case MNOTE_SAMSUNG_TAG_FACE_FEAT01:
-               case MNOTE_SAMSUNG_TAG_FACE_FEAT02:
-               case MNOTE_SAMSUNG_TAG_FACE_RECOG:
-               case MNOTE_SAMSUNG_TAG_LENS_INFO:
-               case MNOTE_SAMSUNG_TAG_THIRDPARTY:
-                       break;
-               default:
-                       break;
-       }
-       return MM_ERROR_NONE;
-}
-
-
 int
 mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info,  void *jpeg, int jpeg_len)
 {
@@ -539,7 +426,7 @@ mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info,  void *jp
        unsigned char *eb = NULL;
        unsigned int ebs;
 
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+       _mmcam_dbg_log("");
 
        eb = info->data;
        ebs = info->size;
@@ -547,7 +434,7 @@ mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info,  void *jp
        /*create file*/
        fp = fopen (filename, "wb");
        if (!fp) {
-               mmf_debug (MMF_DEBUG_ERROR, "%s(), fopen() failed [%s].\n", __func__, filename);
+               _mmcam_dbg_err( "fopen() failed [%s].", filename);
                return MM_ERROR_IMAGE_FILEOPEN;
        }
 
@@ -559,7 +446,7 @@ mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info,  void *jp
 
        if(head[0]==0 || head[1]==0 || head_len==0)
        {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__);
+               _mmcam_dbg_err("setting error");
                fclose (fp);
                return -1;
        }
@@ -582,36 +469,55 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf
        unsigned short head_len = 0;
        unsigned char *eb = NULL;
        unsigned int ebs;
+       int jpeg_offset = JPEG_DATA_OFFSET;
+       mm_exif_info_t *test_exif_info = NULL;
 
        /*output*/
        unsigned char *m = NULL;
        int m_len = 0;
 
-       mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+       _mmcam_dbg_log("");
 
        if(info==NULL || jpeg==NULL)
        {
-               mmf_debug (MMF_DEBUG_ERROR, "%s(), MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p\n", __func__,info,jpeg);
+               _mmcam_dbg_err( "MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p",info,jpeg);
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        }
 
        if(jpeg_len>JPEG_MAX_SIZE)
        {
-               mmf_debug (MMF_DEBUG_ERROR, "%s(),jpeg_len is worng jpeg_len=%d\n", __func__,jpeg_len);
-               return MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG;    
+               _mmcam_dbg_err( "jpeg_len is worng jpeg_len=%d",jpeg_len);
+               return MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG;
        }
 
        eb = info->data;
        ebs = info->size;
 
+       /* check EXIF in JPEG */
+       if (mm_exif_load_exif_info(&test_exif_info, jpeg, jpeg_len) == MM_ERROR_NONE) {
+               if (test_exif_info) {
+                       jpeg_offset = test_exif_info->size + JPEG_EXIF_OFFSET;
+                       if (test_exif_info->data) {
+                               free(test_exif_info->data);
+                               test_exif_info->data = NULL;
+                       }
+                       free(test_exif_info);
+                       test_exif_info = NULL;
+               } else {
+                       _mmcam_dbg_err("test_exif_info is NULL");
+               }
+       } else {
+               _mmcam_dbg_warn("no EXIF in JPEG");
+       }
+
        /*length of output image*/
        /*SOI + APP1 + length of APP1 + length of EXIF + IMAGE*/
-       m_len = EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs + (jpeg_len - JPEG_DATA_OFFSET);
+       m_len = EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs + (jpeg_len - jpeg_offset);
        /*alloc output image*/
        m = malloc (m_len);
        if (!m) {
-               mmf_debug (MMF_DEBUG_ERROR, "%s(), malloc() failed.\n", __func__);
-               return MM_ERROR_CAMCORDER_LOW_MEMORY;   
+               _mmcam_dbg_err( "malloc() failed.");
+               return MM_ERROR_CAMCORDER_LOW_MEMORY;
        }
 
        /*set SOI, APP1*/
@@ -620,7 +526,7 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf
        /*set header length*/
        _exif_set_uint16 (0, &head_len, (unsigned short)(ebs + 2));
        if (head[0] == 0 || head[1] == 0 || head_len == 0) {
-               mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__);
+               _mmcam_dbg_err("setting error");
                free(m);
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        }
@@ -639,10 +545,10 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf
               eb, ebs);
        /*IMAGE*/
        memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs,
-              jpeg + JPEG_DATA_OFFSET, jpeg_len - JPEG_DATA_OFFSET);
+              jpeg + jpeg_offset, jpeg_len - jpeg_offset);
 
-       mmf_debug(MMF_DEBUG_LOG,"[%05d][%s] JPEG+EXIF Copy DONE(original:%d, copied:%d)\n",
-                               __LINE__, __func__, jpeg_len, jpeg_len - JPEG_DATA_OFFSET);
+       _mmcam_dbg_log("JPEG+EXIF Copy DONE(original:%d, offset:%d, copied:%d)",
+                               jpeg_len, jpeg_offset, jpeg_len - jpeg_offset);
 
        /*set ouput param*/
        *mem    = m;
@@ -650,3 +556,44 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf
 
        return MM_ERROR_NONE;
 }
+
+
+int mm_exif_load_exif_info(mm_exif_info_t **info, void *jpeg_data, int jpeg_length)
+{
+       ExifLoader *loader = NULL;
+       const unsigned char *b = NULL;
+       unsigned int s = 0;
+       mm_exif_info_t *x = NULL;
+       // TODO : get exif and re-set exif
+       loader = exif_loader_new();
+       if (loader) {
+               exif_loader_write (loader, jpeg_data, jpeg_length);
+               exif_loader_get_buf (loader, &b, &s);
+               if (s > 0) {
+                       x = malloc(sizeof(mm_exif_info_t));
+                       if (x) {
+                               x->data = malloc(s);
+                               memcpy((char*)x->data, b, s);
+                               x->size = s;
+                               *info = x;
+                               _mmcam_dbg_warn("load EXIF : data %p, size %d", x->data, x->size);
+                       } else {
+                               _mmcam_dbg_err("mm_exif_info_t malloc failed");
+                       }
+               } else {
+                       _mmcam_dbg_err("exif_loader_get_buf failed");
+               }
+
+               /* The loader is no longer needed--free it */
+               exif_loader_unref(loader);
+               loader = NULL;
+       } else {
+               _mmcam_dbg_err("exif_loader_new failed");
+       }
+
+       if (x) {
+               return MM_ERROR_NONE;
+       } else {
+               return MM_ERROR_CAMCORDER_INTERNAL;
+       }
+}
index 05c92ce..1f24b65 100644 (file)
 -----------------------------------------------------------------------*/
 /* Table for compatibility between audio codec and file format */
 gboolean       audiocodec_fileformat_compatibility_table[MM_AUDIO_CODEC_NUM][MM_FILE_FORMAT_NUM] =
-{          /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG */
-/*AMR*/       { 1,  0,  0,       0,  0,  0,  0, 0,   0,  1,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G723.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MP3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*OGG*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC*/       { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  1,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*WMA*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MMF*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*ADPCM*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*WAVE*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  1,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*WAVE_NEW*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MIDI*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*IMELODY*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MXMF*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPA*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MP2*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G711*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G722*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G722.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G722.2*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G723*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G726*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G728*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G729*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G729A*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*G729.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*REAL*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_LC*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_MAIN*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_SRS*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_LTP*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_HE_V1*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AAC_HE_V2*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AC3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*ALAC*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*ATRAC*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*SPEEX*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*VORBIS*/    { 0,  0,  0,       0,  0,  1,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AIFF*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AU*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*NONE*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*PCM*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*ALAW*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MULAW*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MS_ADPCM*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
+{          /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG FLAC M2TS*/
+/*AMR*/       { 1,  0,  0,       0,  0,  0,  0, 0,   0,  1,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G723.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MP3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*OGG*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC*/       { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  1,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   1},
+/*WMA*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MMF*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*ADPCM*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*WAVE*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  1,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*WAVE_NEW*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MIDI*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*IMELODY*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MXMF*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPA*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MP2*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G711*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G722*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G722.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G722.2*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G723*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G726*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G728*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G729*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G729A*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*G729.1*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*REAL*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_LC*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_MAIN*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_SRS*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_LTP*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_HE_V1*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AAC_HE_V2*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AC3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   1},
+/*ALAC*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*ATRAC*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*SPEEX*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*VORBIS*/    { 0,  0,  0,       0,  0,  1,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AIFF*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AU*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*NONE*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*PCM*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*ALAW*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MULAW*/     { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MS_ADPCM*/  { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
 };
 
 /* Table for compatibility between video codec and file format */
 gboolean       videocodec_fileformat_compatibility_table[MM_VIDEO_CODEC_NUM][MM_FILE_FORMAT_NUM] =
-{             /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG */
-/*NONE*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H263*/         { 1,  0,  1,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H264*/         { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H26L*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4*/        { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG1*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*WMV*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*DIVX*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*XVID*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H261*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H262*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H263V2*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*H263V3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MJPEG*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG2*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_SIMPLE*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_ADV*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_MAIN*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_CORE*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_ACE*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_ARTS*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*MPEG4_AVC*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*REAL*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*VC1*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*AVS*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*CINEPAK*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*INDEO*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
-/*THEORA*/       { 0,  0,  0,       0,  0,  1,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,  },
+{             /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG FLAC M2TS*/
+/*NONE*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H263*/         { 1,  0,  1,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H264*/         { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   1},
+/*H26L*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4*/        { 1,  0,  1,       1,  1,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   1},
+/*MPEG1*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*WMV*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*DIVX*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*XVID*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H261*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H262*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H263V2*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*H263V3*/       { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MJPEG*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG2*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_SIMPLE*/ { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_ADV*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_MAIN*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_CORE*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_ACE*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_ARTS*/   { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*MPEG4_AVC*/    { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*REAL*/         { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*VC1*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*AVS*/          { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*CINEPAK*/      { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*INDEO*/        { 0,  0,  0,       0,  0,  0,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
+/*THEORA*/       { 0,  0,  0,       0,  0,  1,  0, 0,   0,  0,  0,  0,   0, 0,  0,  0,  0,   0,  0,  0,      0,  0,  0,  0,   0,   0},
 };
 
 
@@ -121,8 +121,14 @@ gboolean   videocodec_fileformat_compatibility_table[MM_VIDEO_CODEC_NUM][MM_FILE_F
 |    LOCAL VARIABLE DEFINITIONS for internal                           |
 -----------------------------------------------------------------------*/
 #define USE_AUDIO_CLOCK_TUNE
-#define _MMCAMCORDER_WAIT_EOS_TIME              5.0     /* sec */
-#define _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM  6
+#define _MMCAMCORDER_WAIT_EOS_TIME                60.0     /* sec */
+#define _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM    6
+#define _MMCAMCORDER_MIN_TIME_TO_PASS_FRAME       30000000 /* ns */
+#define _MMCAMCORDER_FRAME_PASS_MIN_FPS           30
+#define _MMCAMCORDER_NANOSEC_PER_1SEC             1000000000
+#define _MMCAMCORDER_NANOSEC_PER_1MILISEC         1000
+#define _MMCAMCORDER_VIDEO_DECODER_NAME           "avdec_h264"
+
 
 /*-----------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                |
@@ -141,8 +147,9 @@ gboolean    videocodec_fileformat_compatibility_table[MM_VIDEO_CODEC_NUM][MM_FILE_F
  * @see                __mmcamcorder_create_preview_pipeline()
  */
 static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-
+static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
 static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate);
+static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name);
 
 /*=======================================================================================
 |  FUNCTION DEFINITIONS                                                                        |
@@ -150,28 +157,26 @@ static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate);
 /*-----------------------------------------------------------------------
 |    GLOBAL FUNCTION DEFINITIONS:                                      |
 -----------------------------------------------------------------------*/
-int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
+int _mmcamcorder_create_preview_elements(MMHandleType handle)
 {
        int err = MM_ERROR_NONE;
-       int rotate = 0;
-       int flip = 0;
+       int i = 0;
+       int camera_width = 0;
+       int camera_height = 0;
+       int camera_rotate = 0;
+       int camera_flip = 0;
        int fps = 0;
-       int hold_af = 0;
-       int UseVideoscale = 0;
        int codectype = 0;
        int capture_width = 0;
        int capture_height = 0;
        int capture_jpg_quality = 100;
        int video_stabilization = 0;
        int anti_shake = 0;
-       char *videosrc_name = NULL;
+       const char *videosrc_name = NULL;
+       const char *videosink_name = NULL;
        char *err_name = NULL;
-       unsigned int pix_fourcc = 0;
 
        GList *element_list = NULL;
-       GstCaps *caps = NULL;
-       GstPad *video_tee0 = NULL;
-       GstPad *video_tee1 = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -187,35 +192,39 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
        _mmcam_dbg_log("");
 
        /* Check existence */
-       if (sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst) {
-               if (((GObject *)sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst)->ref_count > 0) {
-                       gst_object_unref(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst);
+       for (i = _MMCAMCORDER_VIDEOSRC_SRC ; i <= _MMCAMCORDER_VIDEOSINK_SINK ; i++) {
+               if (sc->element[i].gst) {
+                       if (((GObject *)sc->element[i].gst)->ref_count > 0) {
+                               gst_object_unref(sc->element[i].gst);
+                       }
+                       _mmcam_dbg_log("element[index:%d] is Already existed.", i);
                }
-               _mmcam_dbg_log("_MMCAMCORDER_VIDEOSRC_BIN is Already existed.");
        }
 
        /* Get video device index info */
        _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
                                              CONFIGURE_CATEGORY_CTRL_CAMERA,
                                              "InputIndex",
-                                             &input_index );
+                                             &input_index);
        if (input_index == NULL) {
                _mmcam_dbg_err("Failed to get input_index");
                return MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
        }
 
        err = mm_camcorder_get_attributes(handle, &err_name,
+                                         MMCAM_CAMERA_WIDTH, &camera_width,
+                                         MMCAM_CAMERA_HEIGHT, &camera_height,
                                          MMCAM_CAMERA_FORMAT, &sc->info_image->preview_format,
                                          MMCAM_CAMERA_FPS, &fps,
-                                         MMCAM_CAMERA_ROTATION, &rotate,
-                                         MMCAM_CAMERA_FLIP, &flip,
+                                         MMCAM_CAMERA_ROTATION, &camera_rotate,
+                                         MMCAM_CAMERA_FLIP, &camera_flip,
                                          MMCAM_CAMERA_VIDEO_STABILIZATION, &video_stabilization,
                                          MMCAM_CAMERA_ANTI_HANDSHAKE, &anti_shake,
                                          MMCAM_CAPTURE_WIDTH, &capture_width,
                                          MMCAM_CAPTURE_HEIGHT, &capture_height,
+                                         MMCAM_CAMERA_HDR_CAPTURE, &sc->info_image->hdr_capture_mode,
                                          MMCAM_IMAGE_ENCODER, &codectype,
                                          MMCAM_IMAGE_ENCODER_QUALITY, &capture_jpg_quality,
-                                         "camera-hold-af-after-capturing", &hold_af,
                                          NULL);
        if (err != MM_ERROR_NONE) {
                _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
@@ -224,32 +233,24 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
        }
 
        /* Get fourcc from picture format */
-       pix_fourcc=  _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
-       strncpy(sc->format_name, (char*)&pix_fourcc, sizeof(pix_fourcc));
-       sc->format_name[sizeof(pix_fourcc)] = '\0';
+       sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
 
        /* Get videosrc element and its name from configure */
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                      "VideosrcElement",
                                      &VideosrcElement);
        _mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name);
 
-       /* Create bin element */
-       __ta__("                videosrc_bin",
-       _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_VIDEOSRC_BIN, "videosrc_bin", err);
-       );
+       /**
+        * Create child element
+        */
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_SRC, videosrc_name, "videosrc_src", element_list, err);
 
-       /* Create child element */
-       __ta__("                videosrc_src",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_SRC, videosrc_name, "videosrc_src", element_list, err);
-       );
-       __ta__("                videosrc_capsfilter",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_FILT, "capsfilter", "videosrc_filter", element_list, err);
-       );
-       __ta__("                videosrc_queue",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_QUE, "queue", "videosrc_queue", element_list, err);
-       );
+       /* Set video device index */
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "camera-id", input_index->default_value);
+
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_FILT, "capsfilter", "videosrc_filter", element_list, err);
 
        /* init high-speed-fps */
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
@@ -258,14 +259,12 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", capture_width);
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", capture_height);
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", capture_jpg_quality);
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", sc->info_image->hdr_capture_mode);
 
-       /* set camera flip */
-       _mmcamcorder_set_videosrc_flip(handle, flip);
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_QUE, "queue", "videosrc_queue", element_list, err);
 
-       /* set flush cache as FALSE */
-       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
-       }
+       /* set camera flip */
+       _mmcamcorder_set_videosrc_flip(handle, camera_flip);
 
        /* set video stabilization mode */
        _mmcamcorder_set_videosrc_stabilization(handle, video_stabilization);
@@ -273,124 +272,53 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
        /* set anti handshake mode */
        _mmcamcorder_set_videosrc_anti_shake(handle, anti_shake);
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
-                                       "UseVideoscale",
-                                       &UseVideoscale);
-       if (UseVideoscale) {
-               int set_width = 0;
-               int set_height = 0;
-               int scale_width = 0;
-               int scale_height = 0;
-               int scale_method = 0;
-               char *videoscale_name = NULL;
-               type_element *VideoscaleElement = NULL;
-
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
-                                             CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
-                                             "VideoscaleElement",
-                                             &VideoscaleElement);
-               _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &videoscale_name);
-               __ta__("                videosrc_scale",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_SCALE, videoscale_name, "videosrc_scale", element_list, err);
-               );
-               __ta__("                videoscale_capsfilter",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_VSFLT, "capsfilter", "videosrc_scalefilter", element_list, err);
-               );
-
-               _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "width", &scale_width);
-               _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "height", &scale_height);
-               _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "method", &scale_method);
-
-               if (rotate == MM_VIDEO_INPUT_ROTATION_90 ||
-                       rotate == MM_VIDEO_INPUT_ROTATION_270) {
-                       set_width = scale_height;
-                       set_height = scale_width;
-               } else {
-                       set_width = scale_width;
-                       set_height = scale_height;
-               }
-
-               _mmcam_dbg_log("VideoSRC Scale[%dx%d], Method[%d]", set_width, set_height, scale_method);
-
-               caps = gst_caps_new_simple("video/x-raw",
-                                   "format", G_TYPE_STRING, sc->format_name,
-                                          "width", G_TYPE_INT, set_width,
-                                          "height", G_TYPE_INT, set_height,
-                                          NULL);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_VSFLT].gst, "caps", caps);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SCALE].gst, "method", scale_method);
-
-               gst_caps_unref(caps);
-               caps = NULL;
-       }
-
        if (sc->is_modified_rate) {
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
        }
 
-       __ta__("                tee",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_TEE, "tee", "videosrc_tee", element_list, err);
-       );
-
        /* Set basic infomation of videosrc element */
        _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, VideosrcElement);
 
-       /* Set video device index */
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "camera-id", input_index->default_value);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", hold_af);
+       /* make demux and decoder for H264 stream from videosrc */
+       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, _MMCAMCORDER_VIDEO_DECODER_NAME, "videosrc_decode", element_list, err);
+       }
 
        _mmcam_dbg_log("Current mode[%d]", hcamcorder->type);
 
-       /* Set sensor mode as CAMERA */
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "sensor-mode", 0);
-
-       /* Set caps by rotation */
-       _mmcamcorder_set_videosrc_rotation(handle, rotate);
+       /* Get videosink name */
+       _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
 
-       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst), element_list)) {
-               _mmcam_dbg_err( "element add error." );
-               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto pipeline_creation_error;
-       }
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_QUE, "queue", "videosink_queue", element_list, err);
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, "videosink_sink", element_list, err);
 
-       if (!_mmcamcorder_link_elements(element_list)) {
-               _mmcam_dbg_err( "element link error." );
-               err = MM_ERROR_CAMCORDER_GST_LINK;
-               goto pipeline_creation_error;
+       if (strcmp(videosink_name, "fakesink") != 0) {
+               if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("_mmcamcorder_videosink_window_set error");
+                       err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+                       goto pipeline_creation_error;
+               }
        }
 
-       video_tee0 = gst_element_get_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src_%u");
-       video_tee1 = gst_element_get_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src_%u");
+       /* Set caps by rotation */
+       _mmcamcorder_set_videosrc_rotation(handle, camera_rotate);
 
-       MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst), "alloc-pad", video_tee0);
+       _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, sc->VideosinkElement);
 
-       /* Ghost pad */
-       if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, gst_ghost_pad_new("src0", video_tee0) )) < 0) {
-               _mmcam_dbg_err("failed to create ghost pad1 on _MMCAMCORDER_VIDEOSRC_BIN.");
-               gst_object_unref(video_tee0);
-               video_tee0 = NULL;
-               gst_object_unref(video_tee1);
-               video_tee1 = NULL;
-               err = MM_ERROR_CAMCORDER_GST_LINK;
+       /* add elements to main pipeline */
+       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), element_list)) {
+               _mmcam_dbg_err("element_list add error.");
+               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                goto pipeline_creation_error;
        }
 
-       if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, gst_ghost_pad_new("src1", video_tee1) )) < 0) {
-               _mmcam_dbg_err("failed to create ghost pad2 on _MMCAMCORDER_VIDEOSRC_BIN.");
-               gst_object_unref(video_tee0);
-               video_tee0 = NULL;
-               gst_object_unref(video_tee1);
-               video_tee1 = NULL;
+       /* link elements */
+       if (!_mmcamcorder_link_elements(element_list)) {
+               _mmcam_dbg_err( "element link error." );
                err = MM_ERROR_CAMCORDER_GST_LINK;
                goto pipeline_creation_error;
        }
 
-       gst_object_unref(video_tee0);
-       video_tee0 = NULL;
-       gst_object_unref(video_tee1);
-       video_tee1 = NULL;
-
        if (element_list) {
                g_list_free(element_list);
                element_list = NULL;
@@ -399,12 +327,17 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
        return MM_ERROR_NONE;
 
 pipeline_creation_error:
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_SRC );
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_FILT );
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_SCALE );
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_VSFLT );
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_TEE );
-       _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_BIN );
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_SRC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_FILT);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS_QUE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS_FILT);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_QUE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_DECODE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_QUE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_CLS);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_SINK);
+
        if (element_list) {
                g_list_free(element_list);
                element_list = NULL;
@@ -423,10 +356,9 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
        int channel = 0;
        int a_enc = MM_AUDIO_CODEC_AMR;
        int a_dev = MM_AUDIO_DEVICE_MIC;
-       int UseNoiseSuppressor = 0;
        double volume = 0.0;
        char *err_name = NULL;
-       char *audiosrc_name = NULL;
+       const char *audiosrc_name = NULL;
        char *cat_name = NULL;
 
        GstCaps *caps = NULL;
@@ -451,11 +383,6 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
                return err;
        }
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                       CONFIGURE_CATEGORY_MAIN_RECORD,
-                                       "UseNoiseSuppressor",
-                                       &UseNoiseSuppressor);
-
        err = mm_camcorder_get_attributes(handle, &err_name,
                                          MMCAM_AUDIO_DEVICE, &a_dev,
                                          MMCAM_AUDIO_ENCODER, &a_enc,
@@ -472,17 +399,15 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
        }
 
        /* Check existence */
-       if (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst) {
-               if (((GObject *)sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst)->ref_count > 0) {
-                       gst_object_unref(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+       if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst) {
+               if (((GObject *)sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst)->ref_count > 0) {
+                       gst_object_unref(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
                }
                _mmcam_dbg_log("_MMCAMCORDER_AUDIOSRC_BIN is Already existed. Unref once...");
        }
 
        /* Create bin element */
-       __ta__("                audiosource_bin",
-       _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_AUDIOSRC_BIN, "audiosource_bin", err);
-       );
+       _MMCAMCORDER_BIN_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN, "audiosource_bin", err);
 
        if (a_dev == MM_AUDIO_DEVICE_MODEM) {
                cat_name = strdup("AudiomodemsrcElement");
@@ -497,7 +422,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
                goto pipeline_creation_error;
        }
 
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
                                      cat_name,
                                      &AudiosrcElement);
@@ -508,26 +433,19 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
 
        _mmcam_dbg_log("Audio src name : %s", audiosrc_name);
 
-       __ta__("                audiosrc",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, NULL, element_list, err);
-       );
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, "audiosrc_src", element_list, err);
 
-       _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
+       _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
 
-       __ta__("                audiosource_capsfilter",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_FILT, "capsfilter", NULL, element_list, err);
-       );
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_FILT, "capsfilter", "audiosrc_capsfilter", element_list, err);
 
-       if (a_enc != MM_AUDIO_CODEC_VORBIS) {
-               __ta__("                audiosource_volume",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_VOL, "volume", NULL, element_list, err);
-               );
-       }
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_QUE, "queue", "audiosrc_queue", element_list, err);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-buffers", 0);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-bytes", 0);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-time", (int64_t)0);
 
-       if (UseNoiseSuppressor && a_enc != MM_AUDIO_CODEC_AAC) {
-               __ta__("                noise_suppressor",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_NS, "noisesuppressor", "audiofilter", element_list, err);
-               );
+       if (a_enc != MM_AUDIO_CODEC_VORBIS) {
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_VOL, "volume", "audiosrc_volume", element_list, err);
        }
 
        /* Set basic infomation */
@@ -537,294 +455,49 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
 
                if (volume == 0.0) {
                        /* Because data probe of audio src do the same job, it doesn't need to set "mute" here. Already null raw data. */
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
                } else {
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", volume);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", volume);
                }
 
                if (format == MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE) {
                        depth = 16;
                        format_name = "S16LE";
                } else { /* MM_CAMCORDER_AUDIO_FORMAT_PCM_U8 */
-                   format_name = "U8";
                        depth = 8;
+                       format_name = "U8";
                }
 
                caps = gst_caps_new_simple("audio/x-raw",
-                                          "rate", G_TYPE_INT, rate,
-                                          "channels", G_TYPE_INT, channel,
-                                          "format", G_TYPE_STRING, format_name,
-                                          NULL);
-               _mmcam_dbg_log("caps [x-raw-int,rate:%d,channel:%d,depth:%d]",
-                              rate, channel, depth);
+                                          "rate", G_TYPE_INT, rate,
+                                          "channels", G_TYPE_INT, channel,
+                                          "format", G_TYPE_STRING, format_name,
+                                          NULL);
+               _mmcam_dbg_log("caps [x-raw, rate:%d, channel:%d, depth:%d], volume %lf",
+                              rate, channel, depth, volume);
        } else {
                /* what are the audio encoder which should get audio/x-raw-float? */
                caps = gst_caps_new_simple("audio/x-raw",
-                                          "rate", G_TYPE_INT, rate,
-                                          "channels", G_TYPE_INT, channel,
-                                          "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
-                                          NULL);
-               _mmcam_dbg_log("caps [x-raw-float,rate:%d,channel:%d,endianness:%d,width:32]",
+                                          "rate", G_TYPE_INT, rate,
+                                          "channels", G_TYPE_INT, channel,
+                                          "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
+                                          NULL);
+               _mmcam_dbg_log("caps [x-raw (F32), rate:%d, channel:%d, endianness:%d, width:32]",
                               rate, channel, BYTE_ORDER);
        }
 
-       MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_AUDIOSRC_FILT].gst), "caps", caps);
-       gst_caps_unref(caps);
-
-       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst), element_list)) {
-               _mmcam_dbg_err("element add error.");
-               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto pipeline_creation_error;
-       }
-
-       if (!_mmcamcorder_link_elements(element_list)) {
-               _mmcam_dbg_err( "element link error." );
-               err = MM_ERROR_CAMCORDER_GST_LINK;
-               goto pipeline_creation_error;
-       }
-
-       last_element = (_MMCamcorderGstElement*)(g_list_last(element_list)->data);
-       pad = gst_element_get_static_pad(last_element->gst, "src");
-       if ((gst_element_add_pad( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, gst_ghost_pad_new("src", pad) )) < 0) {
-               gst_object_unref(pad);
-               pad = NULL;
-               _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN.");
-               err = MM_ERROR_CAMCORDER_GST_LINK;
-               goto pipeline_creation_error;
-       }
-
-       gst_object_unref(pad);
-       pad = NULL;
-
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
-       }
-
-       return MM_ERROR_NONE;
-
-pipeline_creation_error:
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_SRC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_FILT);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_VOL);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_QUE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_CONV);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_ENC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_BIN);
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
-       }
-
-       return err;
-}
-
-
-int _mmcamcorder_create_videosink_bin(MMHandleType handle)
-{
-       int err = MM_ERROR_NONE;
-       int rect_width = 0;
-       int rect_height = 0;
-       int camera_width = 0;
-       int camera_height = 0;
-       int rotate = 0;
-       int flip = 0;
-       int UseVideoscale = 0, EnableConvertedSC = 0;
-       int scale_method = 0;
-       char* videosink_name = NULL;
-       char* videoscale_name = NULL;
-       char* err_name = NULL;
-
-       GstCaps *caps = NULL;
-       GstPad *pad = NULL;
-       GList *element_list = NULL;
-
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;
-       _MMCamcorderGstElement *first_element = NULL;
-       type_element *VideoscaleElement = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-
-       mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       _mmcam_dbg_log("START");
-
-       /* Get attributes */
-       err = mm_camcorder_get_attributes(handle, &err_name,
-                                         MMCAM_CAMERA_WIDTH, &camera_width,
-                                         MMCAM_CAMERA_HEIGHT, &camera_height,
-                                         MMCAM_DISPLAY_RECT_WIDTH, &rect_width,
-                                         MMCAM_DISPLAY_RECT_HEIGHT, &rect_height,
-                                         MMCAM_DISPLAY_ROTATION, &rotate,
-                                         MMCAM_DISPLAY_FLIP, &flip,
-                                         "enable-converted-stream-callback", &EnableConvertedSC,
-                                         NULL);
-       if (err != MM_ERROR_NONE) {
-               _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
-               SAFE_FREE(err_name);
-               return err;
-       }
-
-       /* Get videosink name */
-       _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
-
-       /* Check existence */
-       if (sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst) {
-               if (((GObject *)sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst)->ref_count > 0) {
-                       gst_object_unref(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst);
-               }
-               _mmcam_dbg_log("_MMCAMCORDER_VIDEOSINK_BIN is Already existed. Unref once...");
-       }
-
-       /* Create bin element */
-       __ta__("                videosink_bin",
-       _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_VIDEOSINK_BIN, "videosink_bin", err);
-       );
-
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                       CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
-                                       "UseVideoscale",
-                                       &UseVideoscale);
-
-       /* Create child element */
-       if (EnableConvertedSC ||
-           !strcmp(videosink_name, "evasimagesink") ||
-           !strcmp(videosink_name, "ximagesink")) {
-               GstElementFactory *factory = gst_element_factory_find("fimcconvert");
-
-               if ((strcmp(sc->format_name, "SN21") == 0 ||
-             strcmp(sc->format_name, "SN12") == 0 ||
-             strcmp(sc->format_name, "ST12") == 0 ||
-             strcmp(sc->format_name, "S420") == 0) &&
-                   factory) {
-                       int set_rotate = 0;
-                       int set_flip = 0;
-
-                       gst_object_unref(factory);
-                       factory = NULL;
-
-                       __ta__("                videosink_fimcconvert",
-                       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_CLS, "fimcconvert", NULL, element_list, err);
-                       );
-
-                       /* set rotate */
-                       if (rotate > MM_VIDEO_INPUT_ROTATION_NONE &&
-                           rotate < MM_VIDEO_INPUT_ROTATION_NUM) {
-                               set_rotate = rotate * 90;
-                       } else {
-                               set_rotate = 0;
-                       }
-
-                       if (rect_width == 0 || rect_height == 0) {
-                               _mmcam_dbg_warn("rect_width or height is 0. set camera width and height.");
-
-                               if (rotate == MM_DISPLAY_ROTATION_90 ||
-                                   rotate == MM_DISPLAY_ROTATION_270) {
-                                       rect_width = camera_height;
-                                       rect_height = camera_width;
-                               } else {
-                                       rect_width = camera_width;
-                                       rect_height = camera_height;
-                               }
-                       }
-
-                       /* set flip */
-                       switch (flip) {
-                       case MM_FLIP_HORIZONTAL:
-                               set_flip = FIMCCONVERT_FLIP_HORIZONTAL;
-                               break;
-                       case MM_FLIP_VERTICAL:
-                               set_flip = FIMCCONVERT_FLIP_VERTICAL;
-                               break;
-                       case MM_FLIP_BOTH: /* both flip has same effect with 180 rotation */
-                               set_rotate = (set_rotate + 180) % 360;
-                       case MM_FLIP_NONE:
-                       default:
-                               set_flip = FIMCCONVERT_FLIP_NONE;
-                               break;
-                       }
-
-                       _mmcam_dbg_log("Fimcconvert set values - %dx%d, rotate: %d, flip: %d",
-                                      rect_width, rect_height, set_rotate, set_flip);
-
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "src-width", rect_width);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "src-height", rect_height);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "rotate", set_rotate);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "flip", set_flip);
-               } else {
-                       if (factory) {
-                               gst_object_unref(factory);
-                               factory = NULL;
-                       }
-
-                       __ta__("                videosink_videoconvert",
-                       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_CLS, "videoconvert", NULL, element_list, err);
-                       );
-               }
-       } else if(UseVideoscale) {
-               __ta__("                videosink_queue",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_QUE, "queue", NULL, element_list, err);
-               );
-
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
-                                             CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
-                                             "VideoscaleElement",
-                                             &VideoscaleElement);
-               _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &videoscale_name);
-
-               __ta__("                videosink_videoscale",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_SCALE, videoscale_name, NULL, element_list, err);
-               );
-               __ta__("                videosink_capsfilter",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_FILT, "capsfilter", NULL, element_list, err);
-               );
-
-               _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "method", &scale_method);
-               _mmcam_dbg_log("VideoSINK Scale[%dx%d], Method[%d]", rect_width, rect_height, scale_method);
-
-               if (rect_width == 0 || rect_height == 0) {
-                       _mmcam_dbg_warn("rect_width or height is 0. set camera width and height.");
-
-                       rect_width = camera_width;
-                       rect_height = camera_height;
-               }
-
-               caps = gst_caps_new_simple("video/x-raw",
-                                          "width", G_TYPE_INT, rect_width,
-                                          "height", G_TYPE_INT, rect_height,
-                                          NULL);
-               MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSINK_FILT].gst), "caps", caps);
-               MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSINK_SCALE].gst), "method", scale_method);
+       if (caps) {
+               MMCAMCORDER_G_OBJECT_SET((sc->encode_element[_MMCAMCORDER_AUDIOSRC_FILT].gst), "caps", caps);
                gst_caps_unref(caps);
                caps = NULL;
+       } else {
+               _mmcam_dbg_err("create caps error");
+               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+               goto pipeline_creation_error;
        }
 
-       if (sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst == NULL) {
-               __ta__("                videosink_queue",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_QUE, "queue", "videosink_queue", element_list, err);
-               );
-       }
-
-       __ta__("                videosink",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, NULL, element_list, err);
-       );
-
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink") ||
-            !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) {
-               if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("_mmcamcorder_videosink_window_set error");
-                       err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
-                       goto pipeline_creation_error;
-               }
-       }
-
-       _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, sc->VideosinkElement);
-
-       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst), element_list)) {
+       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst), element_list)) {
                _mmcam_dbg_err("element add error.");
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                goto pipeline_creation_error;
@@ -836,14 +509,12 @@ int _mmcamcorder_create_videosink_bin(MMHandleType handle)
                goto pipeline_creation_error;
        }
 
-       first_element = (_MMCamcorderGstElement*)(element_list->data);
-       __ta__("                gst_element_get_static_pad",
-       pad = gst_element_get_static_pad( first_element->gst, "sink");
-       );
-       if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst, gst_ghost_pad_new("sink", pad) )) < 0) {
+       last_element = (_MMCamcorderGstElement*)(g_list_last(element_list)->data);
+       pad = gst_element_get_static_pad(last_element->gst, "src");
+       if ((gst_element_add_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, gst_ghost_pad_new("src", pad) )) < 0) {
                gst_object_unref(pad);
                pad = NULL;
-               _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_VIDEOSINK_BIN.");
+               _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN.");
                err = MM_ERROR_CAMCORDER_GST_LINK;
                goto pipeline_creation_error;
        }
@@ -856,17 +527,15 @@ int _mmcamcorder_create_videosink_bin(MMHandleType handle)
                element_list = NULL;
        }
 
-       _mmcam_dbg_log("END");
-
        return MM_ERROR_NONE;
 
 pipeline_creation_error:
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_QUE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_SCALE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_FILT);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_CLS);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_SINK);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_BIN);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_FILT);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_QUE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_VOL);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN);
+
        if (element_list) {
                g_list_free(element_list);
                element_list = NULL;
@@ -889,17 +558,18 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
        int auto_audio_resample = 0;
        int auto_color_space = 0;
        char *gst_element_venc_name = NULL;
-       char *gst_element_aenc_name = NULL;
-       char *gst_element_ienc_name = NULL;
-       char *gst_element_mux_name = NULL;
-       char *gst_element_rsink_name = NULL;
-       char *str_profile = NULL;
-       char *str_aac = NULL;
-       char *str_aar = NULL;
-       char *str_acs = NULL;
+       const char *gst_element_aenc_name = NULL;
+       const char *gst_element_ienc_name = NULL;
+       const char *gst_element_mux_name = NULL;
+       const char *gst_element_rsink_name = NULL;
+       const char *str_profile = NULL;
+       const char *str_aac = NULL;
+       const char *str_aar = NULL;
+       const char *str_acs = NULL;
        char *err_name = NULL;
 
-       GstCaps *caps = NULL;
+       GstCaps *audio_caps = NULL;
+       GstCaps *video_caps = NULL;
        GstPad *pad = NULL;
        GList *element_list = NULL;
 
@@ -917,25 +587,89 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
        mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
        mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       _mmcam_dbg_log("");
+       _mmcam_dbg_log("start - profile : %d", profile);
 
        /* Check existence */
-       if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
-               if (((GObject *)sc->element[_MMCAMCORDER_ENCSINK_BIN].gst)->ref_count > 0) {
-                       gst_object_unref(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+       if (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst) {
+               if (((GObject *)sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst)->ref_count > 0) {
+                       gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst);
                }
                _mmcam_dbg_log("_MMCAMCORDER_ENCSINK_BIN is Already existed.");
        }
 
        /* Create bin element */
-       __ta__("                encodesink_bin",
-       _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_ENCSINK_BIN, "encodesink_bin", err);
-       );
+       _MMCAMCORDER_BIN_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_BIN, "encodesink_bin", err);
 
        /* Create child element */
-       __ta__("                encodebin",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_ENCBIN, "encodebin", NULL, element_list, err);
-       );
+       if (profile != MM_CAMCORDER_ENCBIN_PROFILE_AUDIO) {
+               GstCaps *caps_from_pad = NULL;
+
+               /* create appsrc and capsfilter */
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SRC, "appsrc", "encodesink_src", element_list, err);
+
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_FILT, "capsfilter", "encodesink_filter", element_list, err);
+
+               /* release element_list, they will be placed out of encodesink bin */
+               if (element_list) {
+                       g_list_free(element_list);
+                       element_list = NULL;
+               }
+
+               /* set appsrc as live source */
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "is-live", TRUE);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "format", 3); /* GST_FORMAT_TIME */
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "max-bytes", (int64_t)0); /* unlimited */
+
+               /* set capsfilter */
+               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                       _mmcam_dbg_log("get pad from videosrc_filter");
+                       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+               } else {
+                       _mmcam_dbg_log("get pad from videosrc_que");
+                       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+               }
+               if (!pad) {
+                       _mmcam_dbg_err("get videosrc_que src pad failed");
+                       goto pipeline_creation_error;
+               }
+
+               caps_from_pad = gst_pad_get_allowed_caps(pad);
+               video_caps = gst_caps_copy(caps_from_pad);
+               gst_caps_unref(caps_from_pad);
+               caps_from_pad = NULL;
+               gst_object_unref(pad);
+               pad = NULL;
+
+               if (video_caps) {
+                       char *caps_str = NULL;
+
+                       gst_caps_set_simple(video_caps,
+                                           "width", G_TYPE_INT, sc->info_video->video_width,
+                                           "height", G_TYPE_INT, sc->info_video->video_height,
+                                           NULL);
+
+                       caps_str = gst_caps_to_string(video_caps);
+                       _mmcam_dbg_log("video caps [%s], set size %dx%d",
+                                      caps_str, sc->info_video->video_width, sc->info_video->video_height);
+                       free(caps_str);
+                       caps_str = NULL;
+
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "caps", video_caps);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "caps", video_caps);
+               } else {
+                       _mmcam_dbg_err("create recording pipeline caps failed");
+                       goto pipeline_creation_error;
+               }
+
+               /* connect signal for ready to push buffer */
+               MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+                                          _MMCAMCORDER_HANDLER_VIDEOREC,
+                                          "need-data",
+                                          _mmcamcorder_ready_to_encode_callback,
+                                          hcamcorder);
+       }
+
+       _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_ENCBIN, "encodebin", "encodesink_encbin", element_list, err);
 
        /* check element availability */
        mm_camcorder_get_attributes(handle, &err_name,
@@ -965,19 +699,19 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                str_acs = "ImageAutoColorSpace";
        }
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_profile, &encodebin_profile);
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aac, &auto_audio_convert);
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aar, &auto_audio_resample);
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_acs, &auto_color_space);
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_profile, &encodebin_profile);
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aac, &auto_audio_convert);
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aar, &auto_audio_resample);
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_acs, &auto_color_space);
 
        _mmcam_dbg_log("Profile:%d, AutoAudioConvert:%d, AutoAudioResample:%d, AutoColorSpace:%d",
                       encodebin_profile, auto_audio_convert, auto_audio_resample, auto_color_space);
 
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "profile", encodebin_profile);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", auto_audio_convert);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", auto_audio_resample);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", auto_color_space);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "use-video-toggle", FALSE);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "profile", encodebin_profile);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", auto_audio_convert);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", auto_audio_resample);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", auto_color_space);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "use-video-toggle", FALSE);
 
        /* Codec */
        if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
@@ -991,57 +725,41 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                        goto pipeline_creation_error;
                }
 
-               _mmcamcorder_conf_get_value_element_name(VideoencElement, &gst_element_venc_name);
-
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "venc-name", gst_element_venc_name);
-               _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC, "video-encode", err);
-
-               /* set color convert plugin */
-               if (hcamcorder->use_zero_copy_format &&
-                   strcmp(sc->format_name,"SN12") != 0) {
-                       int dst_buffer_num = _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM;
+               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                       gst_element_venc_name = strdup("capsfilter");
+               } else {
+                       _mmcamcorder_conf_get_value_element_name(VideoencElement, (const char **)(&gst_element_venc_name));
+               }
 
-                       /* set fimcconvert as colorspace element */
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "vconv-name", "fimcconvert");
-                       _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VCONV, "video-convert", err);
+               if (gst_element_venc_name) {
+                       _mmcam_dbg_log("video encoder name [%s]", gst_element_venc_name);
 
-                       caps = gst_caps_new_simple("video/x-raw",
-                                                  "format", G_TYPE_STRING, "SN12",
-                                                  NULL);
-                       if (caps) {
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "vcaps", caps);
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_VCONV].gst, "dst-buffer-num", dst_buffer_num);
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "venc-name", gst_element_venc_name);
+                       _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC, "video-encode", err);
 
-                               gst_caps_unref (caps);
-                               caps = NULL;
-                       } else {
-                               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-                               goto pipeline_creation_error;
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_RECORD,
+                                                       "UseVideoEncoderQueue",
+                                                       &use_venc_queue);
+                       if (use_venc_queue) {
+                               _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC_QUE, "use-venc-queue", err);
                        }
 
-                       _mmcam_dbg_log("fimcconvert dst-buffer-num %d", dst_buffer_num);
-               }
-
-               _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                               CONFIGURE_CATEGORY_MAIN_RECORD,
-                                               "UseVideoEncoderQueue",
-                                               &use_venc_queue);
-               if (use_venc_queue) {
-                       _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC_QUE, "use-venc-queue", err);
+                       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                               free(gst_element_venc_name);
+                               gst_element_venc_name = NULL;
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "caps", video_caps);
+                       }
+               } else {
+                       _mmcam_dbg_err("Fail to get video encoder name");
+                       err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+                       goto pipeline_creation_error;
                }
        }
 
        if (sc->audio_disable == FALSE &&
            profile != MM_CAMCORDER_ENCBIN_PROFILE_IMAGE) {
                int use_aenc_queue =0;
-               const gchar* int_formats = "{S8, U8, "
-                                   "S16LE, S16BE, U16LE, U16BE, "
-                                   "S24_32LE, S24_32BE, U24_32LE, U24_32BE, "
-                                   "S32LE, S32BE, U32LE, U32BE, "
-                                   "S24LE, S24BE, U24LE, U24BE, "
-                                   "S20LE, S20BE, U20LE, U20BE, "
-                                   "S18LE, S18BE, U18LE, U18BE}";
 
                AudioencElement = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER);
                if (!AudioencElement) {
@@ -1052,44 +770,36 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
 
                _mmcamcorder_conf_get_value_element_name(AudioencElement, &gst_element_aenc_name);
 
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "aenc-name", gst_element_aenc_name);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "aenc-name", gst_element_aenc_name);
                _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_AENC, "audio-encode", err);
 
                if (audio_enc == MM_AUDIO_CODEC_AMR && channel == 2) {
-                       caps = gst_caps_new_simple("audio/x-raw",
+                       audio_caps = gst_caps_new_simple("audio/x-raw",
                                                   "channels", G_TYPE_INT, 1,
-                                                  "format", G_TYPE_STRING, int_formats,
                                                   NULL);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", caps);
-                       gst_caps_unref (caps);
-                       caps = NULL;
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", audio_caps);
+                       gst_caps_unref(audio_caps);
+                       audio_caps = NULL;
                }
 
                if (audio_enc == MM_AUDIO_CODEC_OGG) {
-                       caps = gst_caps_new_simple("audio/x-raw", "format", G_TYPE_STRING, int_formats, NULL);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", caps);
-                       gst_caps_unref (caps);
-                       caps = NULL;
+                       audio_caps = gst_caps_new_empty_simple("audio/x-raw");
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", audio_caps);
+                       gst_caps_unref(audio_caps);
+                       audio_caps = NULL;
                        _mmcam_dbg_log("***** MM_AUDIO_CODEC_OGG : setting audio/x-raw-int ");
                }
 
-               //AAC is marked as experimental,
-               //so compliance level must be set accordingly
-        if (audio_enc == MM_AUDIO_CODEC_AAC)
-        {
-            MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "compliance", -2);
-        }
-
-               _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+               _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                                CONFIGURE_CATEGORY_MAIN_RECORD,
                                                "UseAudioEncoderQueue",
                                                &use_aenc_queue);
                if (use_aenc_queue) {
                        _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_AENC_QUE, "use-aenc-queue", err);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-time",G_GUINT64_CONSTANT(0));
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-buffers",0);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-time", (int64_t)0);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-buffers", 0);
                }
        }
 
@@ -1103,7 +813,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
 
                _mmcamcorder_conf_get_value_element_name(ImageencElement, &gst_element_ienc_name);
 
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "ienc-name", gst_element_ienc_name);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "ienc-name", gst_element_ienc_name);
                _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_IENC, "image-encode", err);
        }
 
@@ -1118,44 +828,38 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
 
                _mmcamcorder_conf_get_value_element_name(MuxElement, &gst_element_mux_name);
 
-               __ta__("                mux",
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "mux-name", gst_element_mux_name);
-               );
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "mux-name", gst_element_mux_name);
                _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_MUX, "mux", err);
 
-               _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, MuxElement);
+               _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, MuxElement);
        }
 
        /* Sink */
        if (profile != MM_CAMCORDER_ENCBIN_PROFILE_IMAGE) {
                /* for recording */
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+               _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                              CONFIGURE_CATEGORY_MAIN_RECORD,
                                              "RecordsinkElement",
                                              &RecordsinkElement );
                _mmcamcorder_conf_get_value_element_name(RecordsinkElement, &gst_element_rsink_name);
 
-               __ta__("                Recordsink_sink",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, gst_element_rsink_name, NULL, element_list, err);
-               );
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, gst_element_rsink_name, NULL, element_list, err);
 
-               _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, RecordsinkElement);
+               _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, RecordsinkElement);
        } else {
                /* for stillshot */
-               __ta__("                fakesink",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, "fakesink", NULL, element_list, err);
-               );
+               _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, "fakesink", NULL, element_list, err);
        }
 
        if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
                /* video encoder attribute setting */
                if (v_bitrate > 0) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "bitrate", v_bitrate);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "bitrate", v_bitrate);
                } else {
                        _mmcam_dbg_warn("video bitrate is too small[%d], so skip setting. Use DEFAULT value.", v_bitrate);
                }
-               /*MMCAMCORDER_G_OBJECT_SET ((sc->element[_MMCAMCORDER_ENCSINK_VENC].gst),"hw-accel", v_hw);*/
-               _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, VideoencElement);
+               /*MMCAMCORDER_G_OBJECT_SET ((sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst),"hw-accel", v_hw);*/
+               _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, VideoencElement);
        }
 
        if (sc->audio_disable == FALSE &&
@@ -1166,11 +870,11 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                        case MM_AUDIO_CODEC_AMR:
                                result = __mmcamcorder_get_amrnb_bitrate_mode(a_bitrate);
                                _mmcam_dbg_log("Set AMR encoder[%s] mode [%d]", gst_element_aenc_name, result);
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "band-mode", result);
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "band-mode", result);
                                break;
                        case MM_AUDIO_CODEC_AAC:
                                _mmcam_dbg_log("Set AAC encoder[%s] bitrate [%d]", gst_element_aenc_name, a_bitrate);
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "bitrate", a_bitrate);
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "bitrate", a_bitrate);
                                break;
                        default:
                                _mmcam_dbg_log("Audio codec is not AMR or AAC... you need to implement setting function for audio encoder bit-rate");
@@ -1180,13 +884,13 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                        _mmcam_dbg_warn("Setting bitrate is too small, so skip setting. Use DEFAULT value.");
                }
 
-               _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, AudioencElement);
+               _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, AudioencElement);
        }
 
        _mmcam_dbg_log("Element creation complete");
 
        /* Add element to bin */
-       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst), element_list)) {
+       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst), element_list)) {
                _mmcam_dbg_err("element add error.");
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
                goto pipeline_creation_error;
@@ -1195,8 +899,8 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
        _mmcam_dbg_log("Element add complete");
 
        if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
-               pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
-               if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("video_sink0", pad)) < 0) {
+               pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
+               if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("video_sink0", pad)) < 0) {
                        gst_object_unref(pad);
                        pad = NULL;
                        _mmcam_dbg_err("failed to create ghost video_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
@@ -1207,8 +911,8 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                pad = NULL;
 
                if (sc->audio_disable == FALSE) {
-                       pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
-                       if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
+                       pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+                       if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
                                gst_object_unref(pad);
                                pad = NULL;
                                _mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
@@ -1219,8 +923,8 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                        pad = NULL;
                }
        } else if (profile == MM_CAMCORDER_ENCBIN_PROFILE_AUDIO) {
-               pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
-               if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
+               pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+               if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
                        gst_object_unref(pad);
                        pad = NULL;
                        _mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
@@ -1231,8 +935,8 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                pad = NULL;
        } else {
                /* for stillshot */
-               pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
-               if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("image_sink0", pad)) < 0) {
+               pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
+               if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("image_sink0", pad)) < 0) {
                        gst_object_unref(pad);
                        pad = NULL;
                        _mmcam_dbg_err("failed to create ghost image_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
@@ -1257,176 +961,34 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                element_list = NULL;
        }
 
-       return MM_ERROR_NONE;
-
-pipeline_creation_error :
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_ENCBIN);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_VENC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_AENC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_IENC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_MUX);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_SINK);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_BIN);
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
+       if (video_caps) {
+               gst_caps_unref(video_caps);
+               video_caps = NULL;
        }
 
-       return err;
-}
-
+       _mmcam_dbg_log("done");
 
-int _mmcamcorder_create_stillshotsink_bin(MMHandleType handle)
-{
-       int err = MM_ERROR_NONE;
-       int capture_width  = 0;
-       int capture_height = 0;
-       int UseCaptureMode = 0;
-       char *gst_element_ienc_name = NULL;
-       char *gst_element_videoscale_name = NULL;
-
-       GList *element_list = NULL;
-       GstPad *pad = NULL;
-
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;
-       _MMCamcorderGstElement *first_element = NULL;
-       type_element* ImageencElement   = NULL;
-       type_element* VideoscaleElement = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       _mmcam_dbg_log("");
-
-       /* Check existence */
-       if (sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst) {
-               if (((GObject *)sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst)->ref_count > 0) {
-                       gst_object_unref(sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst);
-               }
-               _mmcam_dbg_log("_MMCAMCORDER_STILLSHOTSINK_BIN is Already existed. Unref once...");
-       }
-
-       /* Check element availability */
-       ImageencElement = _mmcamcorder_get_type_element(handle, MM_CAM_IMAGE_ENCODER);
-       if (!ImageencElement) {
-               _mmcam_dbg_err("Fail to get type element");
-               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto pipeline_creation_error;
-       }
-
-       _mmcamcorder_conf_get_value_element_name(ImageencElement, &gst_element_ienc_name);
-
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                       CONFIGURE_CATEGORY_MAIN_CAPTURE,
-                                       "UseCaptureMode",
-                                       &UseCaptureMode);
-
-       /* Create bin element */
-       __ta__("                stillshotsink_bin",
-       _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_BIN, "stillshotsink_bin", err);
-       );
-
-       /* Create child element */
-       __ta__("                stillshotsink_queue",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_QUE, "queue", NULL, element_list, err);
-       );
-       __ta__("                stillshotsink_toggle",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_TOGGLE, "toggle", NULL, element_list, err);
-       );
-
-       if (UseCaptureMode) {
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
-                                             CONFIGURE_CATEGORY_MAIN_CAPTURE,
-                                             "VideoscaleElement",
-                                             &VideoscaleElement);
-               _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &gst_element_videoscale_name);
-
-               __ta__("                stillshotsink_videoscale",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_SCALE, "gst_element_videoscale_name", NULL, element_list, err);
-               );
-               __ta__("                stillshotsink_videocrop",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_CROP, "videocrop", NULL, element_list, err);
-               );
-               __ta__("                stillshotsink_capsfiltern",
-               _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_FILT, "capsfilter", NULL, element_list, err);
-               );
-       }
-
-       __ta__("                image encoder",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_ENC, gst_element_ienc_name, NULL, element_list, err);
-       );
-
-       __ta__("                fakesink",
-       _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_SINK, "fakesink", NULL, element_list, err);
-       );
-
-       if (UseCaptureMode) {
-               _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_STILLSHOTSINK_SCALE].gst, VideoscaleElement);
-               
-               /* Set property */
-               mm_camcorder_get_attributes(handle, NULL,
-                                           MMCAM_CAPTURE_WIDTH, &capture_width,
-                                           MMCAM_CAPTURE_HEIGHT, &capture_height,
-                                           NULL);
-
-               __ta__("                _mmcamcorder_set_resize_property",
-               err = _mmcamcorder_set_resize_property(handle, capture_width, capture_height);
-               );
-               if (err != MM_ERROR_NONE) {
-                       //unref??
-                       _mmcam_dbg_log("Set resize property failed.");
-                       goto pipeline_creation_error;
-               }
-       }
-
-       if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst), element_list)) {
-               _mmcam_dbg_err( "element add error." );
-               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto pipeline_creation_error;
-       }
-
-       if (!_mmcamcorder_link_elements(element_list)) {
-               _mmcam_dbg_err( "element link error." );
-               err = MM_ERROR_CAMCORDER_GST_LINK;
-               goto pipeline_creation_error;
-       }
-
-       first_element = (_MMCamcorderGstElement*)(element_list->data);
+       return MM_ERROR_NONE;
 
-       pad = gst_element_get_static_pad(first_element->gst, "sink");
-       if (gst_element_add_pad( sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst, gst_ghost_pad_new("sink", pad)) < 0) {
-               gst_object_unref(pad);
-               pad = NULL;
-               _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_STILLSHOTSINK_BIN.");
-               err = MM_ERROR_CAMCORDER_GST_LINK;
-               goto pipeline_creation_error;
-       }
-       gst_object_unref(pad);
-       pad = NULL;
+pipeline_creation_error :
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_ENCBIN);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SRC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_FILT);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_VENC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AENC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_IENC);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_MUX);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SINK);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_BIN);
 
        if (element_list) {
                g_list_free(element_list);
                element_list = NULL;
        }
 
-       return MM_ERROR_NONE;
-
-pipeline_creation_error :
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_QUE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_TOGGLE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_CROP);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_FILT);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_SCALE);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_ENC);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_SINK);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_BIN);
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
+       if (video_caps) {
+               gst_caps_unref(video_caps);
+               video_caps = NULL;
        }
 
        return err;
@@ -1438,7 +1000,6 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle)
        int err = MM_ERROR_NONE;
 
        GstPad *srcpad = NULL;
-       GstPad *sinkpad = NULL;
        GstBus *bus = NULL;
 
        mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
@@ -1454,47 +1015,51 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle)
 
        /** Create gstreamer element **/
        /* Main pipeline */
-       _MMCAMCORDER_PIPELINE_MAKE(sc, _MMCAMCORDER_MAIN_PIPE, "camcorder_pipeline", err);
+       _MMCAMCORDER_PIPELINE_MAKE(sc, sc->element, _MMCAMCORDER_MAIN_PIPE, "camera_pipeline", err);
 
        /* Sub pipeline */
-       __ta__("            __mmcamcorder_create_videosrc_bin",
-       err = _mmcamcorder_create_videosrc_bin((MMHandleType)hcamcorder);
-       );
-       if (err != MM_ERROR_NONE ) {
+       err = _mmcamcorder_create_preview_elements((MMHandleType)hcamcorder);
+       if (err != MM_ERROR_NONE) {
                goto pipeline_creation_error;
        }
 
-       __ta__("            _mmcamcorder_create_videosink_bin",
-       err = _mmcamcorder_create_videosink_bin((MMHandleType)hcamcorder);
-       );
-       if (err != MM_ERROR_NONE ) {
+       /* Set data probe function */
+       if (sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst) {
+               _mmcam_dbg_log("add video dataprobe to videosrc queue");
+               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+       } else {
+               _mmcam_dbg_err("there is no queue plugin");
                goto pipeline_creation_error;
        }
 
-       gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                        sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst,
-                        sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst,
-                        NULL);
-
-       /* Link each element */
-       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src0");
-       sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst, "sink");
-       _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+       if (srcpad) {
+               MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_PREVIEW,
+                                            __mmcamcorder_video_dataprobe_preview, hcamcorder);
+               gst_object_unref(srcpad);
+               srcpad = NULL;
+       } else {
+               _mmcam_dbg_err("failed to get srcpad");
+               goto pipeline_creation_error;
+       }
 
-       /* Set data probe function */
-       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+       /* set dataprobe for video recording */
+       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+       } else {
+               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "src");
+       }
        MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_PREVIEW,
-                                    __mmcamcorder_video_dataprobe_preview, hcamcorder);
+                                    __mmcamcorder_video_dataprobe_push_buffer_to_record, hcamcorder);
        gst_object_unref(srcpad);
        srcpad = NULL;
 
        bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
 
-       /* Register message callback */
+       /* Register pipeline message callback */
        hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, _mmcamcorder_pipeline_cb_message, (gpointer)hcamcorder);
 
        /* set sync handler */
-    gst_bus_set_sync_handler(bus, _mmcamcorder_pipeline_bus_sync_callback, (gpointer)hcamcorder, NULL);
+       gst_bus_set_sync_handler(bus, _mmcamcorder_pipeline_bus_sync_callback, (gpointer)hcamcorder, NULL);
 
        gst_object_unref(bus);
        bus = NULL;
@@ -1509,8 +1074,7 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle)
        return MM_ERROR_NONE;
 
 pipeline_creation_error:
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSRC_BIN);
-       _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_MAIN_PIPE);
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_MAIN_PIPE);
        return err;
 }
 
@@ -1539,13 +1103,33 @@ void _mmcamcorder_negosig_handler(GstElement *videosrc, MMHandleType handle)
                info = sc->info_image;
                if (info->resolution_change == TRUE) {
                        _mmcam_dbg_log("open toggle of stillshot sink.");
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
                        info->resolution_change = FALSE;
                }
        }
 }
 
 
+void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpointer handle)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
+
+       /*_mmcam_dbg_log("start");*/
+
+       mmf_return_if_fail(hcamcorder);
+       mmf_return_if_fail(hcamcorder->sub_context);
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+
+       /* set flag */
+       if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_INIT) {
+               sc->info_video->get_first_I_frame = FALSE;
+               sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_RUN;
+               _mmcam_dbg_warn("set push_encoding_buffer RUN");
+       }
+}
+
+
 int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* VideosinkElement)
 {
        int err = MM_ERROR_NONE;
@@ -1556,18 +1140,17 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
        int retheight = 0;
        int visible = 0;
        int rotation = MM_DISPLAY_ROTATION_NONE;
-       int rotation_degree = 0;
        int flip = MM_FLIP_NONE;
        int display_mode = MM_DISPLAY_MODE_DEFAULT;
        int display_geometry_method = MM_DISPLAY_METHOD_LETTER_BOX;
        int origin_size = 0;
        int zoom_attr = 0;
-       float zoom_level = 0;
+       int zoom_level = 0;
        int do_scaling = FALSE;
        int *overlay = NULL;
        gulong xid;
        char *err_name = NULL;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        GstElement *vsink = NULL;
 
@@ -1586,7 +1169,6 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
        vsink = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
 
        /* Get video display information */
-       __ta__("                videosink get attributes",
        err = mm_camcorder_get_attributes(handle, &err_name,
                                          MMCAM_DISPLAY_RECT_X, &retx,
                                          MMCAM_DISPLAY_RECT_Y, &rety,
@@ -1601,26 +1183,33 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
                                          MMCAM_DISPLAY_SCALE, &zoom_attr,
                                          MMCAM_DISPLAY_EVAS_DO_SCALING, &do_scaling,
                                          NULL);
-       );
+       if (err != MM_ERROR_NONE) {
+               if (err_name) {
+                       _mmcam_dbg_err("failed to get attributes [%s][0x%x]", err_name, err);
+                       free(err_name);
+                       err_name = NULL;
+               } else {
+                       _mmcam_dbg_err("failed to get attributes [0x%x]", err);
+               }
 
-       _mmcam_dbg_log("(overlay=%p, size=%d)", overlay, size);
+               return err;
+       }
 
        _mmcamcorder_conf_get_value_element_name(VideosinkElement, &videosink_name);
 
+       _mmcam_dbg_log("(overlay=%p, size=%d)", overlay, size);
+
        /* Set display handle */
        if (!strcmp(videosink_name, "xvimagesink") ||
            !strcmp(videosink_name, "ximagesink")) {
                if (overlay) {
                        xid = *overlay;
                        _mmcam_dbg_log("xid = %lu )", xid);
-            gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), xid);
+                       gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), xid);
                } else {
                        _mmcam_dbg_warn("Handle is NULL. Set xid as 0.. but, it's not recommended.");
-            gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), 0);
+                       gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), 0);
                }
-
-               _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[enum:%d]",
-                              videosink_name, display_geometry_method, origin_size, visible, rotation);
        } else if (!strcmp(videosink_name, "evasimagesink") ||
                   !strcmp(videosink_name, "evaspixmapsink")) {
                _mmcam_dbg_log("videosink : %s, handle : %p", videosink_name, overlay);
@@ -1635,38 +1224,17 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
                _mmcam_dbg_warn("Who are you?? (Videosink: %s)", videosink_name);
        }
 
+       _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[%d],flip[%d]",
+                      videosink_name, display_geometry_method, origin_size, visible, rotation, flip);
+
        /* Set attribute */
        if (!strcmp(videosink_name, "xvimagesink") ||
            !strcmp(videosink_name, "evaspixmapsink")) {
+               /* set rotation */
+               MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation);
 
-               if (!strcmp(videosink_name, "xvimagesink")) {
-                       /* set rotation */
-                       switch (rotation) {
-                       case MM_DISPLAY_ROTATION_NONE :
-                               rotation_degree = 0;
-                               break;
-                       case MM_DISPLAY_ROTATION_90 :
-                               rotation_degree = 1;
-                               break;
-                       case MM_DISPLAY_ROTATION_180 :
-                               rotation_degree = 2;
-                               break;
-                       case MM_DISPLAY_ROTATION_270 :
-                               rotation_degree = 3;
-                               break;
-                       default:
-                               _mmcam_dbg_warn("Unsupported rotation value. set as default(0).");
-                               rotation_degree = 0;
-                               break;
-                       }
-                       MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation_degree);
-
-                       /* set flip */
-                       MMCAMCORDER_G_OBJECT_SET(vsink, "flip", flip);
-
-                       _mmcam_dbg_log("set videosink[%s] rotate %d, flip %d",
-                                      videosink_name, rotation_degree, flip);
-               }
+               /* set flip */
+               MMCAMCORDER_G_OBJECT_SET(vsink, "flip", flip);
 
                switch (zoom_attr) {
                case MM_DISPLAY_SCALE_DEFAULT:
@@ -1687,7 +1255,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
                MMCAMCORDER_G_OBJECT_SET(vsink, "display-geometry-method", display_geometry_method);
                MMCAMCORDER_G_OBJECT_SET(vsink, "display-mode", display_mode);
                MMCAMCORDER_G_OBJECT_SET(vsink, "visible", visible);
-               MMCAMCORDER_G_OBJECT_SET(vsink, "zoom", zoom_level);
+               MMCAMCORDER_G_OBJECT_SET(vsink, "zoom", (float)zoom_level);
 
                if (display_geometry_method == MM_DISPLAY_METHOD_CUSTOM_ROI) {
                        g_object_set(vsink,
@@ -1729,11 +1297,13 @@ gboolean _mmcamcorder_get_device_info(MMHandleType handle)
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
        GstCameraControl *control = NULL;
-       GstCameraControlExifInfo exif_info = {0,};
+       GstCameraControlExifInfo exif_info;
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
 
+       memset(&exif_info, 0x0, sizeof(GstCameraControlExifInfo));
+
        if (sc && sc->element) {
                int err = MM_ERROR_NONE;
                char *err_name = NULL;
@@ -1772,8 +1342,7 @@ gboolean _mmcamcorder_get_device_info(MMHandleType handle)
        return TRUE;
 }
 
-static guint32 _mmcamcorder_convert_fourcc_to_string(const gchar* format_name)
-{
+static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name){
     return format_name[0] | (format_name[1] << 8) | (format_name[2] << 16) | (format_name[3] << 24);
 }
 
@@ -1784,17 +1353,17 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
        _MMCamcorderSubContext *sc = NULL;
        _MMCamcorderKPIMeasure *kpi = NULL;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
-    GstMemory *dataBlock = NULL;
-    GstMemory *metaBlock = NULL;
-    GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstMemory *dataBlock = NULL;
+       GstMemory *metaBlock = NULL;
+       GstMapInfo mapinfo = GST_MAP_INFO_INIT;
 
-       mmf_return_val_if_fail(buffer, FALSE);
-    mmf_return_val_if_fail(gst_buffer_n_memory(buffer)  , FALSE);
-       mmf_return_val_if_fail(hcamcorder, TRUE);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(gst_buffer_n_memory(buffer)  , GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
-       mmf_return_val_if_fail(sc, TRUE);
+       mmf_return_val_if_fail(sc, GST_PAD_PROBE_DROP);
 
        current_state = hcamcorder->state;
 
@@ -1805,12 +1374,12 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                } else {
                        sc->drop_vframe--;
                        _mmcam_dbg_log("Drop video frame by drop_vframe");
-            return GST_PAD_PROBE_DROP;
+                       return GST_PAD_PROBE_DROP;
                }
        } else if (sc->cam_stability_count > 0) {
                sc->cam_stability_count--;
                _mmcam_dbg_log("Drop video frame by cam_stability_count");
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
@@ -1854,17 +1423,18 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                int state = MM_CAMCORDER_STATE_NULL;
                unsigned int fourcc = 0;
                MMCamcorderVideoStreamDataType stream;
+               SCMN_IMGB *scmn_imgb = NULL;
 
                state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
                if (state < MM_CAMCORDER_STATE_PREPARE) {
                        _mmcam_dbg_warn("Not ready for stream callback");
-            return GST_PAD_PROBE_OK;
+                       return GST_PAD_PROBE_OK;
                }
 
-        caps = gst_pad_get_current_caps(pad);
+               caps = gst_pad_get_current_caps(pad);
                if (caps == NULL) {
                        _mmcam_dbg_warn( "Caps is NULL." );
-            return GST_PAD_PROBE_OK;
+                       return GST_PAD_PROBE_OK;
                }
 
                /* clear stream data structure */
@@ -1873,7 +1443,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                structure = gst_caps_get_structure( caps, 0 );
                gst_structure_get_int(structure, "width", &(stream.width));
                gst_structure_get_int(structure, "height", &(stream.height));
-               fourcc = _mmcamcorder_convert_fourcc_to_string(gst_structure_get_string(structure, "format"));
+               fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format"));
                stream.format = _mmcamcorder_get_pixtype(fourcc);
                gst_caps_unref( caps );
                caps = NULL;
@@ -1885,22 +1455,27 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
 
                if (stream.width == 0 || stream.height == 0) {
                        _mmcam_dbg_warn("Wrong condition!!");
-            return GST_PAD_PROBE_OK;
+                       return GST_PAD_PROBE_OK;
                }
 
                /* set size and timestamp */
                dataBlock = gst_buffer_peek_memory(buffer, 0);
-        stream.length_total = gst_memory_get_sizes(dataBlock, NULL, NULL);
-               stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); /* nano sec -> mili sec */
+               stream.length_total = gst_memory_get_sizes(dataBlock, NULL, NULL);
+               stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano sec -> mili sec */
 
-               /* set data pointers */
-               if (stream.format == MM_PIXEL_FORMAT_NV12 || stream.format == MM_PIXEL_FORMAT_I420) {
-            if (hcamcorder->use_zero_copy_format && gst_buffer_n_memory(buffer) > 1) {
-                metaBlock = gst_buffer_peek_memory(buffer, 1);
-                gst_memory_map(metaBlock, &mapinfo, GST_MAP_READ);
-                SCMN_IMGB *scmn_imgb = (SCMN_IMGB *)mapinfo.data;
+               if (hcamcorder->use_zero_copy_format && gst_buffer_n_memory(buffer) > 1) {
+                       metaBlock = gst_buffer_peek_memory(buffer, 1);
+                       gst_memory_map(metaBlock, &mapinfo, GST_MAP_READ);
+                       scmn_imgb = (SCMN_IMGB *)mapinfo.data;
+               }
 
-                               if (stream.format == MM_PIXEL_FORMAT_NV12) {
+               /* set data pointers */
+               if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+                   stream.format == MM_PIXEL_FORMAT_NV21 ||
+                   stream.format == MM_PIXEL_FORMAT_I420) {
+                       if (scmn_imgb) {
+                               if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+                                   stream.format == MM_PIXEL_FORMAT_NV21) {
                                        stream.data_type = MM_CAM_STREAM_DATA_YUV420SP;
                                        stream.num_planes = 2;
                                        stream.data.yuv420sp.y = scmn_imgb->a[0];
@@ -1908,8 +1483,8 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                                        stream.data.yuv420sp.uv = scmn_imgb->a[1];
                                        stream.data.yuv420sp.length_uv = stream.data.yuv420sp.length_y >> 1;
 
-                                       _mmcam_dbg_log("SN12[num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
-                                                      stream.num_planes,
+                                       _mmcam_dbg_log("format[%d][num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
+                                                      stream.format, stream.num_planes,
                                                       stream.data.yuv420sp.y, stream.data.yuv420sp.length_y,
                                                       stream.data.yuv420sp.uv, stream.data.yuv420sp.length_uv);
                                } else {
@@ -1929,24 +1504,24 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                                                        stream.data.yuv420p.v, stream.data.yuv420p.length_v);
                                }
                        } else {
-                               if (stream.format == MM_PIXEL_FORMAT_NV12) {
+                               gst_memory_map(dataBlock, &mapinfo, GST_MAP_READWRITE);
+                               if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+                                   stream.format == MM_PIXEL_FORMAT_NV21) {
                                        stream.data_type = MM_CAM_STREAM_DATA_YUV420SP;
                                        stream.num_planes = 2;
-                                       gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
-                    stream.data.yuv420sp.y = mapinfo.data;
+                                       stream.data.yuv420sp.y = mapinfo.data;
                                        stream.data.yuv420sp.length_y = stream.width * stream.height;
                                        stream.data.yuv420sp.uv = stream.data.yuv420sp.y + stream.data.yuv420sp.length_y;
                                        stream.data.yuv420sp.length_uv = stream.data.yuv420sp.length_y >> 1;
 
-                                       _mmcam_dbg_log("NV12[num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
-                                                      stream.num_planes,
+                                       _mmcam_dbg_log("format[%d][num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
+                                                      stream.format, stream.num_planes,
                                                       stream.data.yuv420sp.y, stream.data.yuv420sp.length_y,
                                                       stream.data.yuv420sp.uv, stream.data.yuv420sp.length_uv);
                                } else {
                                        stream.data_type = MM_CAM_STREAM_DATA_YUV420P;
                                        stream.num_planes = 3;
-                    gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
-                    stream.data.yuv420p.y = mapinfo.data;
+                                       stream.data.yuv420p.y = mapinfo.data;
                                        stream.data.yuv420p.length_y = stream.width * stream.height;
                                        stream.data.yuv420p.u = stream.data.yuv420p.y + stream.data.yuv420p.length_y;
                                        stream.data.yuv420p.length_u = stream.data.yuv420p.length_y >> 2;
@@ -1961,18 +1536,21 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                                }
                        }
                } else {
+                       if (scmn_imgb) {
+                               gst_memory_unmap(metaBlock, &mapinfo);
+                               metaBlock = NULL;
+                       }
+                       gst_memory_map(dataBlock, &mapinfo, GST_MAP_READWRITE);
                        if (stream.format == MM_PIXEL_FORMAT_YUYV ||
                            stream.format == MM_PIXEL_FORMAT_UYVY ||
                            stream.format == MM_PIXEL_FORMAT_422P ||
                            stream.format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
                                stream.data_type = MM_CAM_STREAM_DATA_YUV422;
-                gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
-                stream.data.yuv422.yuv = mapinfo.data;
+                               stream.data.yuv422.yuv = mapinfo.data;
                                stream.data.yuv422.length_yuv = stream.length_total;
                        } else {
                                stream.data_type = MM_CAM_STREAM_DATA_YUV420;
-                gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
-                stream.data.yuv420.yuv = mapinfo.data;
+                               stream.data.yuv420.yuv = mapinfo.data;
                                stream.data.yuv420.length_yuv = stream.length_total;
                        }
 
@@ -1989,21 +1567,118 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP
                        hcamcorder->vstream_cb(&stream, hcamcorder->vstream_cb_param);
                }
                _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(hcamcorder);
-
                /* Either metaBlock was mapped, or dataBlock, but not both. */
                if (metaBlock) {
-                   gst_memory_unmap(metaBlock, &mapinfo);
+                       gst_memory_unmap(metaBlock, &mapinfo);
+               }else {
+                       gst_memory_unmap(dataBlock, &mapinfo);
+               }
+       }
+
+       return GST_PAD_PROBE_OK;
+}
+
+static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
+       _MMCamcorderSubContext *sc = NULL;
+       GstClockTime diff = 0;           /* nsec */
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(gst_buffer_n_memory(buffer), GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
+       mmf_return_val_if_fail(sc, GST_PAD_PROBE_DROP);
+
+       /* push buffer in appsrc to encode */
+       if(!sc->info_video) {
+               _mmcam_dbg_warn("sc->info_video is NULL!!");
+               return FALSE;
+       }
+
+       if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_RUN &&
+           sc->info_video->record_dual_stream == FALSE &&
+           sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst) {
+               int ret = 0;
+               GstClock *clock = NULL;
+               GstPad *capsfilter_pad = NULL;
+
+               /*
+               _mmcam_dbg_log("GST_BUFFER_FLAG_DELTA_UNIT is set : %d",
+                              GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT));
+               */
+
+               /* check first I frame */
+               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+                   sc->info_video->get_first_I_frame == FALSE) {
+                       if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
+                               _mmcam_dbg_warn("first I frame is come");
+                               sc->info_video->get_first_I_frame = TRUE;
+                       } else {
+                               _mmcam_dbg_warn("NOT I frame.. skip this buffer");
+                               return GST_PAD_PROBE_OK;
+                       }
+               }
+
+               if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+                       if (sc->info_video->is_firstframe) {
+                               sc->info_video->is_firstframe = FALSE;
+                               clock = GST_ELEMENT_CLOCK(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
+                               if (clock) {
+                                       gst_object_ref(clock);
+                                       sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer) - (gst_clock_get_time(clock) - GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst)->base_time);
+                                       gst_object_unref(clock);
+                               }
+                       }
                } else {
-                   gst_memory_unmap(dataBlock, &mapinfo);
+                       if(sc->info_video->is_firstframe) {
+                               sc->info_video->is_firstframe = FALSE;
+                               sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer);
+                       }
                }
+               GST_BUFFER_PTS(buffer) = GST_BUFFER_PTS(buffer) - sc->info_video->base_video_ts;
+               GST_BUFFER_DTS(buffer) = GST_BUFFER_PTS(buffer);
+
+               capsfilter_pad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+//             gst_buffer_set_caps(buffer, GST_PAD_CAPS(capsfilter_pad));
+               gst_object_unref(capsfilter_pad);
+               capsfilter_pad = NULL;
+
+               _mmcam_dbg_log("buffer %p, timestamp %"GST_TIME_FORMAT, buffer, GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));
+               {
+                       char *caps_string = gst_caps_to_string(gst_pad_get_current_caps(pad));
+                       if (caps_string) {
+                               _mmcam_dbg_log("%s", caps_string);
+                               free(caps_string);
+                               caps_string = NULL;
+                       }
+               }
+
+               g_signal_emit_by_name(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "push-buffer", buffer, &ret);
+
+               /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/
        }
 
-       /* Do force flush cache */
-       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "force-flush-cache", FALSE);
+       /* skip display if too fast FPS */
+       if (sc->info_video && sc->info_video->fps > _MMCAMCORDER_FRAME_PASS_MIN_FPS) {
+               if (sc->info_video->prev_preview_ts != 0) {
+                       diff = GST_BUFFER_PTS(buffer) - sc->info_video->prev_preview_ts;
+                       if (diff < _MMCAMCORDER_MIN_TIME_TO_PASS_FRAME) {
+                               _mmcam_dbg_log("it's too fast. drop frame...");
+                               return GST_PAD_PROBE_DROP;
+                       }
+               }
+
+               /*_mmcam_dbg_log("diff %llu", diff);*/
+
+               sc->info_video->prev_preview_ts = GST_BUFFER_PTS(buffer);
        }
 
-    return GST_PAD_PROBE_OK;
+       //_mmcam_dbg_log("return TRUE");
+
+       return GST_PAD_PROBE_OK;
 }
 
 
@@ -2032,42 +1707,80 @@ int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate)
        return result;
 }
 
+
 int _mmcamcorder_get_eos_message(MMHandleType handle)
 {
-       double elapsed = 0.0;
+       double elapsed = 0.0;
 
        GstMessage *gMessage = NULL;
        GstBus *bus = NULL;
        GstClockTime timeout = 1 * GST_SECOND; /* maximum waiting time */
        GTimer *timer = NULL;
+       int ret = MM_ERROR_NONE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
 
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        _mmcam_dbg_log("");
 
-       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
+       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
        timer = g_timer_new();
 
        if (sc && !(sc->bget_eos)) {
-                while (1) {
-                       elapsed = g_timer_elapsed(timer, NULL);
+               while (TRUE) {
+                       elapsed = g_timer_elapsed(timer, NULL);
 
                        /*_mmcam_dbg_log("elapsed:%f sec", elapsed);*/
 
                        if (elapsed > _MMCAMCORDER_WAIT_EOS_TIME) {
                                _mmcam_dbg_warn("Timeout. EOS isn't received.");
-                                g_timer_destroy(timer);
-                                gst_object_unref(bus);
-                                return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
+                                ret = MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
+                                break;
                        }
 
-                       gMessage = gst_bus_timed_pop (bus, timeout);
+                       gMessage = gst_bus_timed_pop(bus, timeout);
                        if (gMessage != NULL) {
                                _mmcam_dbg_log("Get message(%x).", GST_MESSAGE_TYPE(gMessage));
+
+                               if (GST_MESSAGE_TYPE(gMessage) == GST_MESSAGE_ERROR) {
+                                       GError *err;
+                                       gchar *debug;
+                                       gst_message_parse_error(gMessage, &err, &debug);
+
+                                       switch (err->code) {
+                                       case GST_RESOURCE_ERROR_WRITE:
+                                               _mmcam_dbg_err("File write error");
+                                               ret = MM_ERROR_FILE_WRITE;
+                                               break;
+                                       case GST_RESOURCE_ERROR_NO_SPACE_LEFT:
+                                               _mmcam_dbg_err("No left space");
+                                               ret = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
+                                               break;
+                                       case GST_RESOURCE_ERROR_OPEN_WRITE:
+                                               _mmcam_dbg_err("Out of storage");
+                                               ret = MM_ERROR_OUT_OF_STORAGE;
+                                               break;
+                                       case GST_RESOURCE_ERROR_SEEK:
+                                               _mmcam_dbg_err("File read(seek)");
+                                               ret = MM_ERROR_FILE_READ;
+                                               break;
+                                       default:
+                                               _mmcam_dbg_err("Resource error(%d)", err->code);
+                                               ret = MM_ERROR_CAMCORDER_GST_RESOURCE;
+                                               break;
+                                       }
+
+                                       g_error_free (err);
+                                       g_free (debug);
+
+                                       gst_message_unref(gMessage);
+                                       break;
+                               }
+
                                _mmcamcorder_pipeline_cb_message(bus, gMessage, (void*)hcamcorder);
 
                                if (GST_MESSAGE_TYPE(gMessage) == GST_MESSAGE_EOS || sc->bget_eos) {
@@ -2085,32 +1798,30 @@ int _mmcamcorder_get_eos_message(MMHandleType handle)
                }
        }
 
-        g_timer_destroy(timer);
-        gst_object_unref(bus);
+       g_timer_destroy(timer);
+       timer = NULL;
+       gst_object_unref(bus);
+       bus = NULL;
 
        _mmcam_dbg_log("END");
 
-        return MM_ERROR_NONE;
+       return ret;
 }
 
 
-void _mmcamcorder_remove_element_handle(MMHandleType handle, int first_elem, int last_elem)
+void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int first_elem, int last_elem)
 {
        int i = 0;
-       _MMCamcorderSubContext *sc = NULL;
-
-       mmf_return_if_fail(handle);
+       _MMCamcorderGstElement *remove_element = (_MMCamcorderGstElement *)element;
 
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_if_fail(sc);
-       mmf_return_if_fail(sc->element);
-       mmf_return_if_fail((first_elem > 0) && (last_elem > 0) && (last_elem > first_elem));
+       mmf_return_if_fail(handle && remove_element);
+       mmf_return_if_fail((first_elem >= 0) && (last_elem > 0) && (last_elem > first_elem));
 
        _mmcam_dbg_log("");
 
        for (i = first_elem ; i <= last_elem ; i++) {
-               sc->element[i].gst = NULL;
-               sc->element[i].id = _MMCAMCORDER_NONE;
+               remove_element[i].gst = NULL;
+               remove_element[i].id = _MMCAMCORDER_NONE;
        }
 
        return;
@@ -2197,7 +1908,7 @@ int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle)
 
 bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate)
 {
-       char* videosink_name = NULL;
+       const char* videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = NULL;
        _MMCamcorderSubContext *sc = NULL;
@@ -2212,7 +1923,8 @@ bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate)
        if (sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) {
                /* Get videosink name */
                _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
-               if (!strcmp(videosink_name, "xvimagesink")) {
+               if (!strcmp(videosink_name, "xvimagesink") ||
+                   !strcmp(videosink_name, "evaspixmapsink")) {
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
                                                 "rotate", display_rotate);
                        _mmcam_dbg_log("Set display-rotate [%d] done.", display_rotate);
@@ -2230,7 +1942,7 @@ bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate)
 
 bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip)
 {
-       char* videosink_name = NULL;
+       const char* videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = NULL;
        _MMCamcorderSubContext *sc = NULL;
@@ -2245,7 +1957,8 @@ bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip)
        if (sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) {
                /* Get videosink name */
                _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
-               if (!strcmp(videosink_name, "xvimagesink")) {
+               if (!strcmp(videosink_name, "xvimagesink") ||
+                   !strcmp(videosink_name, "evaspixmapsink")) {
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
                                                 "flip", display_flip);
                        _mmcam_dbg_log("Set display flip [%d] done.", display_flip);
@@ -2265,24 +1978,55 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate
 {
        int width = 0;
        int height = 0;
+       int fps = 0;
+       _MMCamcorderSubContext *sc = NULL;
+
+       mmf_camcorder_t *hcamcorder = NULL;
+
+       hcamcorder = MMF_CAMCORDER(handle);
+       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc) {
+               _mmcam_dbg_log("sub context is not initailized");
+               return TRUE;
+       }
+
+       mm_camcorder_get_attributes(handle, NULL,
+                                   MMCAM_CAMERA_WIDTH, &width,
+                                   MMCAM_CAMERA_HEIGHT, &height,
+                                   MMCAM_CAMERA_FPS, &fps,
+                                   NULL);
+
+       _mmcam_dbg_log("set rotate %d", videosrc_rotate);
+
+       return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, videosrc_rotate);
+}
+
+
+bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, int width, int height, int fps, int rotate)
+{
        int set_width = 0;
        int set_height = 0;
        int set_rotate = 0;
-       int fps = 0;
+       int fps_auto = 0;
+       unsigned int caps_fourcc = 0;
        gboolean do_set_caps = FALSE;
 
        GstCaps *caps = NULL;
 
-       type_int_array *input_index = NULL;
        mmf_camcorder_t *hcamcorder = NULL;
        _MMCamcorderSubContext *sc = NULL;
 
        hcamcorder = MMF_CAMCORDER(handle);
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+       mmf_return_val_if_fail(hcamcorder, FALSE);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       if (!sc || !(sc->element)) {
+               _mmcam_dbg_log("sub context is not initialized");
+               return TRUE;
+       }
 
        if (!sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
                _mmcam_dbg_err("Video src is NULL!");
@@ -2294,38 +2038,54 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate
                return FALSE;
        }
 
-       mm_camcorder_get_attributes(handle, NULL,
-                                   MMCAM_CAMERA_WIDTH, &width,
-                                   MMCAM_CAMERA_HEIGHT, &height,
-                                   MMCAM_CAMERA_FPS, &fps,
-                                   NULL);
+       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+               int capture_width = 0;
+               int capture_height = 0;
+               double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
 
-       _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
-                                             CONFIGURE_CATEGORY_CTRL_CAMERA,
-                                             "InputIndex",
-                                             &input_index );
-       if (input_index == NULL) {
-               _mmcam_dbg_err("Failed to get input_index");
-               return FALSE;
+               mm_camcorder_get_attributes(handle, NULL,
+                                           MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
+                                           MMCAM_CAMERA_FPS_AUTO, &fps_auto,
+                                           MMCAM_CAPTURE_WIDTH, &capture_width,
+                                           MMCAM_CAPTURE_HEIGHT, &capture_height,
+                                           MMCAM_VIDEO_WIDTH, &sc->info_video->video_width,
+                                           MMCAM_VIDEO_HEIGHT, &sc->info_video->video_height,
+                                           NULL);
+               _mmcam_dbg_log("motion rate %f, capture size %dx%d, fps auto %d, video size %dx%d",
+                              motion_rate, capture_width, capture_height, fps_auto,
+                              sc->info_video->video_width, sc->info_video->video_height);
+
+               if(motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
+               } else {
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
+               }
+
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", capture_width);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", capture_height);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto);
+
+               /* set fps */
+               sc->info_video->fps = fps;
        }
 
        /* Interleaved format does not support rotation */
        if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
                /* store videosrc rotation */
-               sc->videosrc_rotate = videosrc_rotate;
+               sc->videosrc_rotate = rotate;
 
                /* Define width, height and rotate in caps */
 
                /* This will be applied when rotate is 0, 90, 180, 270 if rear camera.
                This will be applied when rotate is 0, 180 if front camera. */
-               set_rotate = videosrc_rotate * 90;
+               set_rotate = rotate * 90;
 
-               if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_90 ||
-                   videosrc_rotate == MM_VIDEO_INPUT_ROTATION_270) {
+               if (rotate == MM_VIDEO_INPUT_ROTATION_90 ||
+                   rotate == MM_VIDEO_INPUT_ROTATION_270) {
                        set_width = height;
                        set_height = width;
-                       if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA1) {
-                               if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_90) {
+                       if (hcamcorder->device_type == MM_VIDEO_DEVICE_CAMERA1) {
+                               if (rotate == MM_VIDEO_INPUT_ROTATION_90) {
                                        set_rotate = 270;
                                } else {
                                        set_rotate = 90;
@@ -2341,24 +2101,11 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate
                set_width = width;
                set_height = height;
 
-               _mmcam_dbg_warn("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]",
-                               videosrc_rotate);
-       }
-
-       /* correct size because ITLV does not support QCIF */
-       if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA0 &&
-           strcmp(sc->format_name, "ITLV") == 0) {
-               if ((set_width == 176 && set_height == 144) ||
-                   (set_width == 144 && set_height == 176)) {
-                       set_width = set_width << 1;
-                       set_height = set_height << 1;
-                       _mmcam_dbg_log("ITLV format is not supported QCIF, so we set CIF(%dx%d)",
-                                      set_width, set_height);
-               }
+               _mmcam_dbg_warn("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]", rotate);
        }
 
        MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", &caps);
-       if (caps) {
+       if (caps && !gst_caps_is_any(caps)) {
                GstStructure *structure = NULL;
 
                structure = gst_caps_get_structure(caps, 0);
@@ -2368,42 +2115,68 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate
                        int caps_fps = 0;
                        int caps_rotate = 0;
 
+                       caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format"));
                        gst_structure_get_int(structure, "width", &caps_width);
                        gst_structure_get_int(structure, "height", &caps_height);
                        gst_structure_get_int(structure, "fps", &caps_fps);
                        gst_structure_get_int(structure, "rotate", &caps_rotate);
+
                        if (set_width == caps_width && set_height == caps_height &&
-                           set_rotate == caps_rotate && fps == caps_fps) {
+                           fourcc == caps_fourcc && set_rotate == caps_rotate && fps == caps_fps) {
                                _mmcam_dbg_log("No need to replace caps.");
                        } else {
-                               _mmcam_dbg_log("something is different. set new one...");
+                               _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]",
+                                              caps_fourcc, caps_fourcc>>8, caps_fourcc>>16, caps_fourcc>>24,
+                                              caps_width, caps_height, caps_fps, caps_rotate,
+                                              fourcc, fourcc>>8, fourcc>>16, fourcc>>24,
+                                              set_width, set_height, fps, set_rotate);
                                do_set_caps = TRUE;
                        }
                } else {
                        _mmcam_dbg_log("can not get structure of caps. set new one...");
                        do_set_caps = TRUE;
                }
-
-               gst_caps_unref(caps);
-               caps = NULL;
        } else {
                _mmcam_dbg_log("No caps. set new one...");
                do_set_caps = TRUE;
        }
 
+       if (caps) {
+               gst_caps_unref(caps);
+               caps = NULL;
+       }
+
        if (do_set_caps) {
-               caps = gst_caps_new_simple("video/x-raw",
-                                   "format", G_TYPE_STRING, sc->format_name,
-                                          "width", G_TYPE_INT, set_width,
-                                          "height", G_TYPE_INT, set_height,
-                                          "framerate", GST_TYPE_FRACTION, fps, 1,
-                                          "rotate", G_TYPE_INT, set_rotate,
-                                          NULL);
+               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                       caps = gst_caps_new_simple("video/x-h264",
+                                       "width", G_TYPE_INT, set_width,
+                                       "height", G_TYPE_INT, set_height,
+                                       "framerate", GST_TYPE_FRACTION, fps, 1,
+                                       "stream-format", G_TYPE_STRING, "byte-stream",
+                                       NULL);
+               } else {
+                       char fourcc_string[sizeof(fourcc)+1];
+                       strncpy(fourcc_string, (char*)&fourcc, sizeof(fourcc));
+                       fourcc_string[sizeof(fourcc)] = '\0';
+                       caps = gst_caps_new_simple("video/x-raw",
+                                       "format", G_TYPE_STRING, fourcc_string,
+                                       "width", G_TYPE_INT, set_width,
+                                       "height", G_TYPE_INT, set_height,
+                                       "framerate", GST_TYPE_FRACTION, fps, 1,
+                                       "rotate", G_TYPE_INT, set_rotate,
+                                       NULL);
+               }
+
+               _mmcam_dbg_log("vidoesrc new caps set. %"GST_PTR_FORMAT, caps);
+
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
                gst_caps_unref(caps);
                caps = NULL;
-               _mmcam_dbg_log("vidoesrc new caps set. format[%s],width[%d],height[%d],fps[%d],rotate[%d]",
-                              sc->format_name, set_width, set_height, fps, set_rotate);
+       }
+
+       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+               /* assume that it's camera capture mode */
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "csc-range", 1);
        }
 
        return TRUE;
@@ -2414,12 +2187,13 @@ bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int videosrc_flip)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       type_int_array *input_index = NULL;
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
+       if (!sc) {
+               return TRUE;
+       }
 
        _mmcam_dbg_log("Set FLIP %d", videosrc_flip);
 
@@ -2429,11 +2203,6 @@ bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int videosrc_flip)
 
                /* Interleaved format does not support FLIP */
                if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-                       _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
-                                                             CONFIGURE_CATEGORY_CTRL_CAMERA,
-                                                             "InputIndex",
-                                                             &input_index );
-
                        hflip = (videosrc_flip & MM_FLIP_HORIZONTAL) == MM_FLIP_HORIZONTAL;
                        vflip = (videosrc_flip & MM_FLIP_VERTICAL) == MM_FLIP_VERTICAL;
 
@@ -2465,7 +2234,9 @@ bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake)
        mmf_return_val_if_fail(handle, FALSE);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc, TRUE);
+       if (!sc) {
+               return TRUE;
+       }
 
        v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst;
 
@@ -2505,7 +2276,6 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat
        mmf_return_val_if_fail(sc, TRUE);
 
        v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst;
-
        if (!v_src) {
                _mmcam_dbg_warn("videosrc element is NULL");
                return FALSE;
@@ -2513,31 +2283,29 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat
 
        /* check property of videosrc element - support VDIS */
        if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(v_src)), "enable-vdis-mode")) {
-               int camera_format =MM_PIXEL_FORMAT_INVALID;
-               int camera_width = 0;
-               int camera_height = 0;
+               int video_width = 0;
+               int video_height = 0;
 
                if (stabilization == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
                        _mmcam_dbg_log("ENABLE video stabilization");
 
-                       /* VDIS mode only supports NV12 and [720p or 1080p] */
+                       /* VDIS mode only supports NV12 and [720p or 1080p or 1088 * 1088] */
                        mm_camcorder_get_attributes(handle, NULL,
-                                                   MMCAM_CAMERA_FORMAT, &camera_format,
-                                                   MMCAM_CAMERA_WIDTH, &camera_width,
-                                                   MMCAM_CAMERA_HEIGHT, &camera_height,
+                                                   MMCAM_VIDEO_WIDTH, &video_width,
+                                                   MMCAM_VIDEO_HEIGHT, &video_height,
                                                    NULL);
-                       if (camera_format == MM_PIXEL_FORMAT_NV12 &&
-                           camera_width >= 1280 &&
-                           camera_height >= 720) {
-                               _mmcam_dbg_log("preview format %d, size %dx%d, ENABLE video stabilization",
-                                              camera_format, camera_width, camera_height, stabilization);
+                       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_NV12 &&
+                           video_width >= 1080 && video_height >= 720) {
+                               _mmcam_dbg_log("NV12, video size %dx%d, ENABLE video stabilization",
+                                              video_width, video_height, stabilization);
                                /* set vdis mode */
                                g_object_set(G_OBJECT(v_src),
                                             "enable-vdis-mode", TRUE,
                                             NULL);
                        } else {
-                               _mmcam_dbg_warn("invalid preview format %d or size %dx%d",
-                                               camera_format, camera_width, camera_height);
+                               _mmcam_dbg_warn("invalid preview format %c%c%c%c or video size %dx%d",
+                                               sc->fourcc, sc->fourcc>>8, sc->fourcc>>16, sc->fourcc>>24,
+                                               video_width, video_height);
                                return FALSE;
                        }
                } else {
@@ -2558,3 +2326,26 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat
        return TRUE;
 }
 
+
+bool _mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height)
+{
+       int fps = 0;
+
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
+
+       mmf_return_val_if_fail(hcamcorder, FALSE);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc) {
+               return TRUE;
+       }
+
+       mm_camcorder_get_attributes(handle, NULL,
+                                   MMCAM_CAMERA_FPS, &fps,
+                                   NULL);
+
+       _mmcam_dbg_log("set %dx%d", width, height);
+
+       return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, sc->videosrc_rotate);
+}
index 78c26ae..84e9a0e 100644 (file)
 
 #include <gst/video/colorbalance.h>
 #include <gst/video/cameracontrol.h>
-#include <asm/types.h>
 
-#include <mm_session.h>
-#include <mm_session_private.h>
-#include <audio-session-manager.h>
+#include <system_info.h>
 
 /*---------------------------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS for internal                                          |
@@ -48,8 +45,8 @@
 |    LOCAL VARIABLE DEFINITIONS for internal                                           |
 ---------------------------------------------------------------------------------------*/
 #define __MMCAMCORDER_CMD_ITERATE_MAX           3
-#define __MMCAMCORDER_SECURITY_HANDLE_DEFAULT   -1
-#define __MMCAMCORDER_SET_GST_STATE_TIMEOUT     5
+#define __MMCAMCORDER_SET_GST_STATE_TIMEOUT     3
+#define __MMCAMCORDER_SOUND_WAIT_TIMEOUT        3
 
 /*---------------------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                |
@@ -65,15 +62,6 @@ static gint     __mmcamcorder_gst_handle_core_error(MMHandleType handle, int cod
 static gint     __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMessage *message , GError *error);
 static gboolean __mmcamcorder_handle_gst_warning(MMHandleType handle, GstMessage *message, GError *error);
 
-static int      __mmcamcorder_asm_get_event_type(int sessionType);
-static void     __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder);
-static void     __mmcamcorder_force_resume(mmf_camcorder_t *hcamcorder);
-ASM_cb_result_t _mmcamcorder_asm_callback_sh(int handle, ASM_event_sources_t event_src,
-                                             ASM_sound_commands_t command,
-                                             unsigned int sound_status, void *cb_data);
-ASM_cb_result_t _mmcamcorder_asm_callback_ex(int handle, ASM_event_sources_t event_src,
-                                             ASM_sound_commands_t command,
-                                             unsigned int sound_status, void *cb_data);
 
 #ifdef _MMCAMCORDER_USE_SET_ATTR_CB
 static gboolean __mmcamcorder_set_attr_to_camsensor_cb(gpointer data);
@@ -91,8 +79,6 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
 {
        int ret = MM_ERROR_NONE;
        int UseConfCtrl = 0;
-       int sessionType = MM_SESSION_TYPE_SHARE;
-       int errorcode = MM_ERROR_NONE;
        int rcmd_fmt_capture = MM_PIXEL_FORMAT_YUYV;
        int rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12;
        int rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270;
@@ -100,9 +86,8 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
        int camera_device_count = MM_VIDEO_DEVICE_NUM;
        int camera_facing_direction = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR;
        char *err_attr_name = NULL;
-       char *ConfCtrlFile = NULL;
+       const char *ConfCtrlFile = NULL;
        mmf_camcorder_t *hcamcorder = NULL;
-       ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
        type_element *EvasSurfaceElement = NULL;
 
        _mmcam_dbg_log("Entered");
@@ -120,30 +105,37 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
        hcamcorder->state = MM_CAMCORDER_STATE_NONE;
        hcamcorder->sub_context = NULL;
        hcamcorder->target_state = MM_CAMCORDER_STATE_NULL;
+       hcamcorder->capture_in_recording = FALSE;
 
-       /* thread - for g_mutex_new() */
-       if (!g_thread_supported()) {
-               g_thread_init(NULL);
-       }
-
-       (hcamcorder->mtsafe).lock = g_mutex_new();
-       (hcamcorder->mtsafe).cond = g_cond_new();
+       pthread_mutex_init(&((hcamcorder->mtsafe).lock), NULL);
+       pthread_cond_init(&((hcamcorder->mtsafe).cond), NULL);
 
-       (hcamcorder->mtsafe).cmd_lock = g_mutex_new();
-       (hcamcorder->mtsafe).state_lock = g_mutex_new();
-       (hcamcorder->mtsafe).gst_state_lock = g_mutex_new();
-       (hcamcorder->mtsafe).message_cb_lock = g_mutex_new();
-       (hcamcorder->mtsafe).vcapture_cb_lock = g_mutex_new();
-       (hcamcorder->mtsafe).vstream_cb_lock = g_mutex_new();
-       (hcamcorder->mtsafe).astream_cb_lock = g_mutex_new();
+       pthread_mutex_init(&((hcamcorder->mtsafe).cmd_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).asm_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).state_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).gst_state_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).gst_encode_state_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).message_cb_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).vcapture_cb_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).vstream_cb_lock), NULL);
+       pthread_mutex_init(&((hcamcorder->mtsafe).astream_cb_lock), NULL);
 
        pthread_mutex_init(&(hcamcorder->sound_lock), NULL);
        pthread_cond_init(&(hcamcorder->sound_cond), NULL);
+       pthread_mutex_init(&(hcamcorder->restart_preview_lock), NULL);
 
        /* Sound mutex/cond init */
        pthread_mutex_init(&(hcamcorder->snd_info.open_mutex), NULL);
        pthread_cond_init(&(hcamcorder->snd_info.open_cond), NULL);
 
+       /* init for sound thread */
+       pthread_mutex_init(&(hcamcorder->task_thread_lock), NULL);
+       pthread_cond_init(&(hcamcorder->task_thread_cond), NULL);
+       hcamcorder->task_thread_state = _MMCAMCORDER_SOUND_STATE_NONE;
+
+       /* create task thread */
+       pthread_create(&(hcamcorder->task_thread), NULL, _mmcamcorder_util_task_thread_func, (void *)hcamcorder);
+
        if (info->videodev_type < MM_VIDEO_DEVICE_NONE ||
            info->videodev_type >= MM_VIDEO_DEVICE_NUM) {
                _mmcam_dbg_err("_mmcamcorder_create::video device type is out of range.");
@@ -151,151 +143,136 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                goto _ERR_DEFAULT_VALUE_INIT;
        }
 
-       /* Check and register ASM */
-       if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-               _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-               sessionType = MM_SESSION_TYPE_SHARE;
-       }
-
-       /* Call will not be interrupted. so does not need callback function */
-       if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-               int pid = -1; /* process id of itself */
-
-               /* set SHARE session */
-               if (!ASM_register_sound(pid, &(hcamcorder->asm_handle_sh), ASM_EVENT_SHARE_MMCAMCORDER, ASM_STATE_NONE,
-                                       (ASM_sound_cb_t)_mmcamcorder_asm_callback_sh,
-                                       (void*)hcamcorder, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("SHARE ASM_register_sound() failed[%x]", errorcode);
-                       ret = MM_ERROR_POLICY_INTERNAL;
-                       goto _ERR_DEFAULT_VALUE_INIT;
-               }
-
-               /* set EXCLUSIVE session */
-               if (!ASM_register_sound(pid, &(hcamcorder->asm_handle_ex), ASM_EVENT_EXCLUSIVE_MMCAMCORDER, ASM_STATE_NONE,
-                                       (ASM_sound_cb_t)_mmcamcorder_asm_callback_ex,
-                                       (void*)hcamcorder, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("EXCLUSIVE ASM_register_sound() failed[%x]", errorcode);
-                       ret = MM_ERROR_POLICY_INTERNAL;
-                       goto _ERR_DEFAULT_VALUE_INIT;
-               }
-
-               _mmcam_dbg_log("ASM handle - SHARE %d, EXCLUSIVE %d",
-                              hcamcorder->asm_handle_sh, hcamcorder->asm_handle_ex);
-       }
+       /* set device type */
+       hcamcorder->device_type = info->videodev_type;
+       _mmcam_dbg_warn("Device Type : %d", hcamcorder->device_type);
 
        /* Get Camera Configure information from Camcorder INI file */
-       __ta__( "    _mmcamcorder_conf_get_info main",
-       _mmcamcorder_conf_get_info(CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
-       );
+       _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
 
        if (!(hcamcorder->conf_main)) {
                _mmcam_dbg_err( "Failed to get configure(main) info." );
 
                ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
-               goto _ERR_AUDIO_BLOCKED;
+               goto _ERR_AFTER_ASM_REGISTER;
        }
 
-       __ta__("    _mmcamcorder_alloc_attribute",
        hcamcorder->attributes = _mmcamcorder_alloc_attribute((MMHandleType)hcamcorder, info);
-       );
        if (!(hcamcorder->attributes)) {
                _mmcam_dbg_err("_mmcamcorder_create::alloc attribute error.");
-               
+
                ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto _ERR_AUDIO_BLOCKED;
+               goto _ERR_AFTER_ASM_REGISTER;
        }
 
        if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
-               _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+               _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                                CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                                "UseConfCtrl", &UseConfCtrl);
 
                if (UseConfCtrl) {
                        _mmcam_dbg_log( "Enable Configure Control system." );
-#if 1
+
                        switch (info->videodev_type) {
                        case MM_VIDEO_DEVICE_CAMERA0:
-                               _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
+                               _mmcamcorder_conf_get_value_string((MMHandleType)hcamcorder, hcamcorder->conf_main,
                                                                   CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                                                   "ConfCtrlFile0", &ConfCtrlFile);
                                break;
                        case MM_VIDEO_DEVICE_CAMERA1:
-                               _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
+                               _mmcamcorder_conf_get_value_string((MMHandleType)hcamcorder, hcamcorder->conf_main,
                                                                   CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                                                   "ConfCtrlFile1", &ConfCtrlFile);
                                break;
                        default:
                                _mmcam_dbg_err( "Not supported camera type." );
                                ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
-                               goto _ERR_ALLOC_ATTRIBUTE;
+                               goto _ERR_AFTER_ASM_REGISTER;
                        }
 
                        _mmcam_dbg_log("videodev_type : [%d], ConfCtrlPath : [%s]", info->videodev_type, ConfCtrlFile);
 
-                       __ta__( "    _mmcamcorder_conf_get_info ctrl",
-                       _mmcamcorder_conf_get_info(CONFIGURE_TYPE_CTRL, ConfCtrlFile, &hcamcorder->conf_ctrl);
-                       );
+                       _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_CTRL, ConfCtrlFile, &hcamcorder->conf_ctrl);
 /*
                        _mmcamcorder_conf_print_info(&hcamcorder->conf_main);
                        _mmcamcorder_conf_print_info(&hcamcorder->conf_ctrl);
 */
-#else
-                       _mmcamcorder_conf_query_info(CONFIGURE_TYPE_CTRL, info->videodev_type, &hcamcorder->conf_ctrl);
-#endif
                        if (!(hcamcorder->conf_ctrl)) {
                                _mmcam_dbg_err( "Failed to get configure(control) info." );
                                ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
-                               goto _ERR_ALLOC_ATTRIBUTE;
+                               goto _ERR_AFTER_ASM_REGISTER;
                        }
 
-                       __ta__( "    _mmcamcorder_init_convert_table",
                        ret = _mmcamcorder_init_convert_table((MMHandleType)hcamcorder);
-                       );
                        if (ret != MM_ERROR_NONE) {
                                _mmcam_dbg_warn("converting table initialize error!!");
                        }
 
-                       __ta__( "    _mmcamcorder_init_attr_from_configure",
                        ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder);
-                       );
                        if (ret != MM_ERROR_NONE) {
                                _mmcam_dbg_warn("converting table initialize error!!");
                        }
 
                        /* Get device info, recommend preview fmt and display rotation from INI */
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
                                                        CONFIGURE_CATEGORY_CTRL_CAMERA,
                                                        "RecommendPreviewFormatCapture",
                                                        &rcmd_fmt_capture);
 
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
                                                        CONFIGURE_CATEGORY_CTRL_CAMERA,
                                                        "RecommendPreviewFormatRecord",
                                                        &rcmd_fmt_recording);
 
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
                                                        CONFIGURE_CATEGORY_CTRL_CAMERA,
                                                        "RecommendDisplayRotation",
                                                        &rcmd_dpy_rotation);
 
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                                        CONFIGURE_CATEGORY_MAIN_CAPTURE,
                                                        "PlayCaptureSound",
                                                        &play_capture_sound);
 
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                                        CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                                        "DeviceCount",
                                                        &camera_device_count);
 
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
                                                        CONFIGURE_CATEGORY_CTRL_CAMERA,
                                                        "FacingDirection",
                                                        &camera_facing_direction);
 
-                       _mmcam_dbg_log("Recommend fmt[cap:%d,rec:%d], dpy rot[%d], cap snd[%d], dev cnt[%d], cam facing dir[%d]",
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
+                                                       CONFIGURE_CATEGORY_CTRL_EFFECT,
+                                                       "BrightnessStepDenominator",
+                                                       &hcamcorder->brightness_step_denominator);
+
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
+                                                       CONFIGURE_CATEGORY_CTRL_CAPTURE,
+                                                       "SupportZSL",
+                                                       &hcamcorder->support_zsl_capture);
+
+                       _mmcam_dbg_log("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, dev cnt %d, cam facing dir %d, step denom %d, support zsl %d",
                                       rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation,
-                                      play_capture_sound, camera_device_count, camera_facing_direction);
+                                      play_capture_sound, camera_device_count, camera_facing_direction,
+                                      hcamcorder->brightness_step_denominator, hcamcorder->support_zsl_capture);
+
+                       /* Get UseZeroCopyFormat value from INI */
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+                                                       "UseZeroCopyFormat",
+                                                       &(hcamcorder->use_zero_copy_format));
+
+                       /* Get SupportMediaPacketPreviewCb value from INI */
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+                                                       "SupportMediaPacketPreviewCb",
+                                                       &(hcamcorder->support_media_packet_preview_cb));
+
+                       _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format);
+                       _mmcam_dbg_log("SupportMediaPacketPreviewCb : %d", hcamcorder->support_media_packet_preview_cb);
 
                        mm_camcorder_set_attributes((MMHandleType)hcamcorder, &err_attr_name,
                                                    MMCAM_CAMERA_DEVICE_COUNT, camera_device_count,
@@ -303,6 +280,9 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                                                    MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, rcmd_fmt_capture,
                                                    MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, rcmd_fmt_recording,
                                                    MMCAM_RECOMMEND_DISPLAY_ROTATION, rcmd_dpy_rotation,
+                                                   MMCAM_SUPPORT_ZSL_CAPTURE, hcamcorder->support_zsl_capture,
+                                                   MMCAM_SUPPORT_ZERO_COPY_FORMAT, hcamcorder->use_zero_copy_format,
+                                                   MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, hcamcorder->support_media_packet_preview_cb,
                                                    "capture-sound-enable", play_capture_sound,
                                                    NULL);
                        if (err_attr_name) {
@@ -311,56 +291,43 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                                err_attr_name = NULL;
                        }
 
-                       /* Get UseZeroCopyFormat value from INI */
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
-                                                       "UseZeroCopyFormat",
-                                                       &(hcamcorder->use_zero_copy_format));
-                       _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format);
-               }
-               else
-               {
+                       /* Get default value of brightness */
+                       mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_attr_name,
+                                                   MMCAM_FILTER_BRIGHTNESS, &hcamcorder->brightness_default,
+                                                   NULL);
+                       if (err_attr_name) {
+                               _mmcam_dbg_err("Get brightness FAILED.");
+                               free(err_attr_name);
+                               err_attr_name = NULL;
+                       }
+                       _mmcam_dbg_log("Default brightness : %d", hcamcorder->brightness_default);
+               } else {
                        _mmcam_dbg_log( "Disable Configure Control system." );
                        hcamcorder->conf_ctrl = NULL;
                }
        }
 
-       __ta__( "    __mmcamcorder_gstreamer_init",
        ret = __mmcamcorder_gstreamer_init(hcamcorder->conf_main);
-       );
        if (!ret) {
                _mmcam_dbg_err( "Failed to initialize gstreamer!!" );
                ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
-               goto _ERR_ALLOC_ATTRIBUTE;
+               goto _ERR_AFTER_ASM_REGISTER;
        }
 
        /* Make some attributes as read-only type */
-       __ta__( "    _mmcamcorder_lock_readonly_attributes",
        _mmcamcorder_lock_readonly_attributes((MMHandleType)hcamcorder);
-       );
 
        /* Disable attributes in each model */
-       __ta__( "    _mmcamcorder_set_disabled_attributes",
        _mmcamcorder_set_disabled_attributes((MMHandleType)hcamcorder);
-       );
-
-       /* Determine state change as sync or async */
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                       CONFIGURE_CATEGORY_MAIN_GENERAL,
-                                       "SyncStateChange",
-                                       &hcamcorder->sync_state_change );
-       if (!(hcamcorder->sync_state_change)) {
-               _mmcamcorder_create_command_loop((MMHandleType)hcamcorder);
-       }
 
        /* Get videosink name for evas surface */
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element((MMHandleType)hcamcorder, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
                                      "VideosinkElementEvas",
                                      &EvasSurfaceElement);
        if (EvasSurfaceElement) {
                int attr_index = 0;
-               char *evassink_name = NULL;
+               const char *evassink_name = NULL;
                mmf_attribute_t *item_evassink_name = NULL;
                mmf_attrs_t *attrs = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(hcamcorder);
 
@@ -377,53 +344,65 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
        vconf_get_int(VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY, &hcamcorder->shutter_sound_policy);
        _mmcam_dbg_log("current shutter sound policy : %d", hcamcorder->shutter_sound_policy);
 
+       /* get model name */
+       system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &hcamcorder->model_name);
+
+       /* get software version */
+       system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &hcamcorder->software_version);
+
        /* Set initial state */
        _mmcamcorder_set_state((MMHandleType)hcamcorder, MM_CAMCORDER_STATE_NULL);
-       _mmcam_dbg_log("_mmcamcorder_set_state");
+
+       _mmcam_dbg_log("created handle %p", hcamcorder);
 
        *handle = (MMHandleType)hcamcorder;
 
        return MM_ERROR_NONE;
 
-_ERR_ALLOC_ATTRIBUTE:
-_ERR_AUDIO_BLOCKED:
-       /* unregister audio session manager */
-       {
-               errorcode = MM_ERROR_NONE;
-               if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-                       _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-                       sessionType = MM_SESSION_TYPE_SHARE;
-               }
-
-               if((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-                       /* unregister SHARE session */
-                       if (!ASM_unregister_sound(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER, &errorcode)) {
-                               _mmcam_dbg_err("ASM_unregister_sound() SHARE failed(hdl:%p, stype:%d, err:%x)",
-                                              (void*)hcamcorder->asm_handle_sh, sessionType, errorcode);
-                       }
-                       /* unregister EXCLUSIVE session */
-                       if (!ASM_unregister_sound(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER, &errorcode)) {
-                               _mmcam_dbg_err("ASM_unregister_sound() EXCLUSIVE failed(hdl:%p, stype:%d, err:%x)",
-                                              (void*)hcamcorder->asm_handle_ex, sessionType, errorcode);
-                       }
-               }
-       }
+_ERR_AFTER_ASM_REGISTER:
 
 _ERR_DEFAULT_VALUE_INIT:
-       g_mutex_free ((hcamcorder->mtsafe).lock);
-       g_cond_free ((hcamcorder->mtsafe).cond);
-       g_mutex_free ((hcamcorder->mtsafe).cmd_lock);
-       g_mutex_free ((hcamcorder->mtsafe).state_lock);
-       g_mutex_free ((hcamcorder->mtsafe).gst_state_lock);     
+       /* Release lock, cond */
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).lock));
+       pthread_cond_destroy(&((hcamcorder->mtsafe).cond));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).cmd_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).asm_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_encode_state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).message_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).vcapture_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).vstream_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).astream_cb_lock));
+
+       pthread_mutex_destroy(&(hcamcorder->sound_lock));
+       pthread_cond_destroy(&(hcamcorder->sound_cond));
+       pthread_mutex_destroy(&(hcamcorder->snd_info.open_mutex));
+       pthread_cond_destroy(&(hcamcorder->snd_info.open_cond));
+       pthread_mutex_destroy(&(hcamcorder->restart_preview_lock));
 
        if (hcamcorder->conf_ctrl) {
-               _mmcamcorder_conf_release_info( &hcamcorder->conf_ctrl );
+               _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_ctrl);
        }
 
        if (hcamcorder->conf_main) {
-               _mmcamcorder_conf_release_info( &hcamcorder->conf_main );
+               _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_main);
+       }
+
+       if (hcamcorder->model_name) {
+               free(hcamcorder->model_name);
+               hcamcorder->model_name = NULL;
+       }
+
+       if (hcamcorder->software_version) {
+               free(hcamcorder->software_version);
+               hcamcorder->software_version = NULL;
        }
 
+       /* Release handle */
+       memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
+       free(hcamcorder);
+
        return ret;
 }
 
@@ -433,9 +412,6 @@ int _mmcamcorder_destroy(MMHandleType handle)
        int ret = MM_ERROR_NONE;
        int state = MM_CAMCORDER_STATE_NONE;
        int state_FROM = MM_CAMCORDER_STATE_NULL;
-       int state_TO = MM_CAMCORDER_STATE_NONE;
-       int sessionType = MM_SESSION_TYPE_SHARE;
-       int errorcode = MM_ERROR_NONE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -460,19 +436,39 @@ int _mmcamcorder_destroy(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* Set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret < 0) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+       /* set exit state for sound thread */
+       pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+       _mmcam_dbg_log("send signal for task thread exit");
+       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT;
+       pthread_cond_signal(&(hcamcorder->task_thread_cond));
+       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+       pthread_mutex_lock(&(hcamcorder->sound_lock));
+       while (hcamcorder->capture_sound_count > 0) {
+               struct timespec timeout;
+               struct timeval tv;
+
+               gettimeofday(&tv, NULL);
+               timeout.tv_sec = tv.tv_sec + __MMCAMCORDER_SOUND_WAIT_TIMEOUT;
+               timeout.tv_nsec = tv.tv_usec * 1000;
+
+               _mmcam_dbg_warn("capture_sound_count[%d] is not zero. wait signal...",
+                               hcamcorder->capture_sound_count);
+
+               if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
+                       _mmcam_dbg_warn("signal received. check again...");
+               } else {
+                       hcamcorder->capture_sound_count = 0;
+                       _mmcam_dbg_err("capture sound completion wait time out");
+                       break;
+               }
        }
+       pthread_mutex_unlock(&(hcamcorder->sound_lock));
 
        /* Release SubContext and pipeline */
        if (hcamcorder->sub_context) {
                if (hcamcorder->sub_context->element) {
-                       __ta__("    _mmcamcorder_destroy_pipeline",
                        _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
-                       );
                }
 
                _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
@@ -488,7 +484,7 @@ int _mmcamcorder_destroy(MMHandleType handle)
 
        /* Remove attributes */
        if (hcamcorder->attributes) {
-               _mmcamcorder_dealloc_attribute(hcamcorder->attributes);
+               _mmcamcorder_dealloc_attribute(handle, hcamcorder->attributes);
                hcamcorder->attributes = 0;
        }
 
@@ -499,85 +495,54 @@ int _mmcamcorder_destroy(MMHandleType handle)
 
        }
 
-       /* Remove command loop when async state change mode */
-       if (!hcamcorder->sync_state_change) {
-               _mmcamcorder_destroy_command_loop(handle);
-       }
-
        /* Release configure info */
        if (hcamcorder->conf_ctrl) {
-               _mmcamcorder_conf_release_info( &hcamcorder->conf_ctrl );
+               _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_ctrl);
        }
        if (hcamcorder->conf_main) {
-               _mmcamcorder_conf_release_info( &hcamcorder->conf_main );
+               _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_main);
        }
 
        /* Remove messages which are not called yet */
        _mmcamcroder_remove_message_all(handle);
 
-       /* Unregister ASM */
-       if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-               _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-               sessionType = MM_SESSION_TYPE_SHARE;
+       /* release model_name */
+       if (hcamcorder->model_name) {
+               free(hcamcorder->model_name);
+               hcamcorder->model_name = NULL;
        }
-       if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-               /* unregister SHARE session */
-               if (!ASM_unregister_sound(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER, &errorcode)) {
-                       _mmcam_dbg_err("SHARE ASM_unregister_sound() failed(hdl:%p, err:%x)",
-                                      (void*)hcamcorder->asm_handle_sh, errorcode);
-               }
 
-               /* unregister EXCLUSIVE session */
-               if (!ASM_unregister_sound(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER, &errorcode)) {
-                       _mmcam_dbg_err("EXCLUSIVE ASM_unregister_sound() failed(hdl:%p, err:%x)",
-                                      (void*)hcamcorder->asm_handle_ex, errorcode);
-               }
+       if (hcamcorder->software_version) {
+               free(hcamcorder->software_version);
+               hcamcorder->software_version = NULL;
        }
 
+       /* join task thread */
+       _mmcam_dbg_log("task thread join");
+       pthread_join(hcamcorder->task_thread, NULL);
+
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
        /* Release lock, cond */
-       if ((hcamcorder->mtsafe).lock) {
-               g_mutex_free ((hcamcorder->mtsafe).lock);
-               (hcamcorder->mtsafe).lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).cond) {
-               g_cond_free ((hcamcorder->mtsafe).cond);
-               (hcamcorder->mtsafe).cond = NULL;
-       }
-       if ((hcamcorder->mtsafe).cmd_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).cmd_lock);
-               (hcamcorder->mtsafe).cmd_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).state_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).state_lock);
-               (hcamcorder->mtsafe).state_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).gst_state_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).gst_state_lock);
-               (hcamcorder->mtsafe).gst_state_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).message_cb_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).message_cb_lock);
-               (hcamcorder->mtsafe).message_cb_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).vcapture_cb_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).vcapture_cb_lock);
-               (hcamcorder->mtsafe).vcapture_cb_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).vstream_cb_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).vstream_cb_lock);
-               (hcamcorder->mtsafe).vstream_cb_lock = NULL;
-       }
-       if ((hcamcorder->mtsafe).astream_cb_lock) {
-               g_mutex_free ((hcamcorder->mtsafe).astream_cb_lock);
-               (hcamcorder->mtsafe).astream_cb_lock = NULL;
-       }
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).lock));
+       pthread_cond_destroy(&((hcamcorder->mtsafe).cond));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).cmd_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).asm_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_encode_state_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).message_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).vcapture_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).vstream_cb_lock));
+       pthread_mutex_destroy(&((hcamcorder->mtsafe).astream_cb_lock));
 
        pthread_mutex_destroy(&(hcamcorder->sound_lock));
        pthread_cond_destroy(&(hcamcorder->sound_cond));
        pthread_mutex_destroy(&(hcamcorder->snd_info.open_mutex));
        pthread_cond_destroy(&(hcamcorder->snd_info.open_cond));
+       pthread_mutex_destroy(&(hcamcorder->restart_preview_lock));
+       pthread_mutex_destroy(&(hcamcorder->task_thread_lock));
+       pthread_cond_destroy(&(hcamcorder->task_thread_cond));
 
        /* Release handle */
        memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
@@ -605,12 +570,10 @@ int _mmcamcorder_realize(MMHandleType handle)
        int state = MM_CAMCORDER_STATE_NONE;
        int state_FROM = MM_CAMCORDER_STATE_NULL;
        int state_TO = MM_CAMCORDER_STATE_READY;
-       int sessionType = MM_SESSION_TYPE_SHARE;
-       int errorcode = MM_ERROR_NONE;
        int display_surface_type = MM_DISPLAY_SURFACE_X;
        double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
        char *videosink_element_type = NULL;
-       char *videosink_name = NULL;
+       const char *videosink_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -622,13 +585,6 @@ int _mmcamcorder_realize(MMHandleType handle)
                return ret;
        }
 
-       /* Check quick-device-close for emergency */
-       if (hcamcorder->quick_device_close) {
-               _mmcam_dbg_err("_mmcamcorder_realize can't be called!!!!");
-               ret = MM_ERROR_CAMCORDER_DEVICE;
-               goto _ERR_CAMCORDER_CMD_PRECON;
-       }
-
        if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
                _mmcam_dbg_err("Another command is running.");
                ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
@@ -642,6 +598,13 @@ int _mmcamcorder_realize(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
+       mm_camcorder_get_attributes(handle, NULL,
+                                   MMCAM_MODE, &hcamcorder->type,
+                                   NULL);
+
+       /* Get profile mode */
+       _mmcam_dbg_log("Profile mode [%d]", hcamcorder->type);
+
        /* set camera state to vconf key */
        if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
                int vconf_camera_state = 0;
@@ -654,53 +617,16 @@ int _mmcamcorder_realize(MMHandleType handle)
                               vconf_camera_state, VCONFKEY_CAMERA_STATE_OPEN);
        }
 
-       /* Set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret < 0) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        mm_camcorder_get_attributes(handle, NULL,
-                                   MMCAM_MODE, &hcamcorder->type,
                                    MMCAM_DISPLAY_SURFACE, &display_surface_type,
                                    MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
                                    NULL);
 
-       /* Get profile mode */
-       _mmcam_dbg_log("Profile mode set is (%d)", hcamcorder->type);
-
-       /* Check and make SHARE session as PLAYING */
-       if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-               _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-               sessionType = MM_SESSION_TYPE_SHARE;
-       }
-       if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-               ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-               
-               switch (hcamcorder->type) {
-               case MM_CAMCORDER_MODE_AUDIO:
-                       mm_resource = ASM_RESOURCE_NONE;
-                       break;
-               case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
-               default:
-                       mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-                       break;
-               }
-
-               if (!ASM_set_sound_state(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER,
-                                        ASM_STATE_PLAYING, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
-                       ret = MM_ERROR_POLICY_BLOCKED;
-                       goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-               }
-       }
-
        /* alloc sub context */
        hcamcorder->sub_context = _mmcamcorder_alloc_subcontext(hcamcorder->type);
        if(!hcamcorder->sub_context) {
                ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        /* Set basic configure information */
@@ -708,10 +634,20 @@ int _mmcamcorder_realize(MMHandleType handle)
                hcamcorder->sub_context->is_modified_rate = TRUE;
        }
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                        CONFIGURE_CATEGORY_MAIN_CAPTURE,
                                        "UseEncodebin",
                                        &(hcamcorder->sub_context->bencbin_capture));
+       _mmcam_dbg_warn("UseEncodebin [%d]", hcamcorder->sub_context->bencbin_capture);
+
+       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+               /* get dual stream support info */
+               _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                               CONFIGURE_CATEGORY_MAIN_RECORD,
+                                               "SupportDualStream",
+                                               &(hcamcorder->sub_context->info_video->support_dual_stream));
+               _mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream);
+       }
 
        switch (display_surface_type) {
        case MM_DISPLAY_SURFACE_X:
@@ -733,7 +669,7 @@ int _mmcamcorder_realize(MMHandleType handle)
 
        /* check string of videosink element */
        if (videosink_element_type) {
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+               _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                              CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
                                              videosink_element_type,
                                              &hcamcorder->sub_context->VideosinkElement);
@@ -743,25 +679,29 @@ int _mmcamcorder_realize(MMHandleType handle)
                _mmcam_dbg_warn("strdup failed(display_surface_type %d). Use default X type",
                                display_surface_type);
 
-               _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+               _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                              CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
                                              _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE,
-                                             &hcamcorder->sub_context->VideosinkElement );
+                                             &hcamcorder->sub_context->VideosinkElement);
        }
 
        _mmcamcorder_conf_get_value_element_name(hcamcorder->sub_context->VideosinkElement, &videosink_name);
        _mmcam_dbg_log("Videosink name : %s", videosink_name);
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+       /* get videoconvert element */
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+                                     CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
+                                     "VideoconvertElement",
+                                     &hcamcorder->sub_context->VideoconvertElement);
+
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
                                        CONFIGURE_CATEGORY_CTRL_CAPTURE,
                                        "SensorEncodedCapture",
                                        &(hcamcorder->sub_context->SensorEncodedCapture));
        _mmcam_dbg_log("Support sensor encoded capture : %d", hcamcorder->sub_context->SensorEncodedCapture);
 
        /* create pipeline */
-       __ta__("    _mmcamcorder_create_pipeline",
        ret = _mmcamcorder_create_pipeline(handle, hcamcorder->type);
-       );
        if (ret != MM_ERROR_NONE) {
                /* check internal error of gstreamer */
                if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
@@ -772,7 +712,7 @@ int _mmcamcorder_realize(MMHandleType handle)
                /* release sub context */
                _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
                hcamcorder->sub_context = NULL;
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        /* set command function */
@@ -781,7 +721,7 @@ int _mmcamcorder_realize(MMHandleType handle)
                _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
                _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
                hcamcorder->sub_context = NULL;
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
@@ -790,13 +730,9 @@ int _mmcamcorder_realize(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
-       
+
 _ERR_CAMCORDER_CMD_PRECON:
        _mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)",
                       hcamcorder->type, state, ret);
@@ -823,8 +759,6 @@ int _mmcamcorder_unrealize(MMHandleType handle)
        int state = MM_CAMCORDER_STATE_NONE;
        int state_FROM = MM_CAMCORDER_STATE_READY;
        int state_TO = MM_CAMCORDER_STATE_NULL;
-       int sessionType = MM_SESSION_TYPE_SHARE;
-       ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -849,13 +783,6 @@ int _mmcamcorder_unrealize(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        /* Release SubContext */
        if (hcamcorder->sub_context) {
                /* destroy pipeline */
@@ -871,35 +798,9 @@ int _mmcamcorder_unrealize(MMHandleType handle)
 
        /* check who calls unrealize. it's no need to set ASM state if caller is ASM */
        if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
-               if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-                       _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-                       sessionType = MM_SESSION_TYPE_SHARE;
-               }
-
-               /* Call session is not ended here */
-               if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-                       mm_resource = ASM_RESOURCE_NONE;
-
-                       switch (hcamcorder->type) {
-                       case MM_CAMCORDER_MODE_AUDIO:
-                               mm_resource = ASM_RESOURCE_NONE;
-                               break;
-                       case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
-                       default:
-                               mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-                               break;
-                       }
-
-                       /* STOP SHARE session */
-                       if (!ASM_set_sound_state(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER,
-                                                ASM_STATE_STOP, mm_resource, &ret)) {
-                               _mmcam_dbg_err("SHARE Set state to STOP failed 0x%x", ret);
-                       }
-               }
+               /* TODO */
        }
 
-       _mmcamcorder_set_state(handle, state_TO);
-
        /* set camera state to vconf key */
        if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
                int vconf_camera_state = 0;
@@ -914,6 +815,8 @@ int _mmcamcorder_unrealize(MMHandleType handle)
 
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
+       _mmcamcorder_set_state(handle, state_TO);
+
        return MM_ERROR_NONE;
 
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
@@ -948,13 +851,6 @@ int _mmcamcorder_start(MMHandleType handle)
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       /* check quick-device-close for emergency */
-       if (hcamcorder->quick_device_close) {
-               _mmcam_dbg_err("_mmcamcorder_start can't be called!!!!");
-               ret = MM_ERROR_CAMCORDER_DEVICE;
-               goto _ERR_CAMCORDER_CMD_PRECON;
-       }
-
        if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
                _mmcam_dbg_err("Another command is running.");
                ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
@@ -971,16 +867,19 @@ int _mmcamcorder_start(MMHandleType handle)
        /* initialize error code */
        hcamcorder->sub_context->error_code = MM_ERROR_NONE;
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+       /* set attributes related sensor */
+       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+               _mmcamcorder_set_attribute_to_camsensor(handle);
        }
 
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_START);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               /* check internal error of gstreamer */
+               if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+                       ret = hcamcorder->sub_context->error_code;
+                       _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret);
+               }
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
@@ -988,8 +887,6 @@ int _mmcamcorder_start(MMHandleType handle)
        if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
                int vconf_camera_state = 0;
 
-               _mmcamcorder_set_attribute_to_camsensor(handle);
-
                /* check camera state of vconf key */
                vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state);
 
@@ -1004,16 +901,13 @@ int _mmcamcorder_start(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-       
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
 _ERR_CAMCORDER_CMD_PRECON:
        /* check internal error of gstreamer */
-       if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+       if (hcamcorder->sub_context &&
+           hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
                ret = hcamcorder->sub_context->error_code;
                hcamcorder->sub_context->error_code = MM_ERROR_NONE;
 
@@ -1032,7 +926,6 @@ int _mmcamcorder_stop(MMHandleType handle)
        int state = MM_CAMCORDER_STATE_NONE;
        int state_FROM = MM_CAMCORDER_STATE_PREPARE;
        int state_TO = MM_CAMCORDER_STATE_READY;
-       int frame_rate = 0;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -1057,22 +950,11 @@ int _mmcamcorder_stop(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_STOP);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* KPI : frame rate */
-       frame_rate=_mmcamcorder_video_average_framerate(handle);
-       __ta__(__tafmt__("MM_CAM_006:: Frame per sec : %d", frame_rate), ;);
-
        _mmcamcorder_set_state(handle, state_TO);
 
        if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
@@ -1092,10 +974,6 @@ int _mmcamcorder_stop(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
@@ -1116,7 +994,6 @@ int _mmcamcorder_capture_start(MMHandleType handle)
        int state_FROM_1 = MM_CAMCORDER_STATE_RECORDING;
        int state_FROM_2 = MM_CAMCORDER_STATE_PAUSED;
        int state_TO = MM_CAMCORDER_STATE_CAPTURING;
-       char *err_name = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -1143,11 +1020,15 @@ int _mmcamcorder_capture_start(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+       /* Handle capture in recording case */
+       if (state == state_FROM_1 || state == state_FROM_2) {
+               if (hcamcorder->capture_in_recording == TRUE) {
+                       _mmcam_dbg_err("Capturing in recording (%d)", state);
+                       ret = MM_ERROR_CAMCORDER_DEVICE_BUSY;
+                       goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+               } else {
+                       hcamcorder->capture_in_recording = TRUE;
+               }
        }
 
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_CAPTURE);
@@ -1160,16 +1041,19 @@ int _mmcamcorder_capture_start(MMHandleType handle)
                _mmcamcorder_set_state(handle, state_TO);
        }
 
-       /* Init break continuous shot attr */
-       mm_camcorder_set_attributes(handle, &err_name, "capture-break-cont-shot", 0, NULL);
-
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
+       /* Init break continuous shot attr */
+       if (mm_camcorder_set_attributes(handle, NULL, "capture-break-cont-shot", 0, NULL) != MM_ERROR_NONE) {
+               _mmcam_dbg_warn("capture-break-cont-shot set 0 failed");
+       }
+
        return MM_ERROR_NONE;
 
 _ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
+       if (hcamcorder->capture_in_recording) {
+               hcamcorder->capture_in_recording = FALSE;
+       }
 
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
@@ -1211,30 +1095,17 @@ int _mmcamcorder_capture_stop(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_START);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
 
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
-       MMTA_ACUM_ITEM_END("Real First Capture Start", FALSE);
-
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
@@ -1253,7 +1124,6 @@ int _mmcamcorder_record(MMHandleType handle)
        int state_FROM1 = MM_CAMCORDER_STATE_PREPARE;
        int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
        int state_TO = MM_CAMCORDER_STATE_RECORDING;
-       int sessionType = MM_SESSION_TYPE_SHARE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -1281,43 +1151,14 @@ int _mmcamcorder_record(MMHandleType handle)
        /* initialize error code */
        hcamcorder->sub_context->error_code = MM_ERROR_NONE;
 
-       /* Check and register EXCLUSIVE ASM */
-       if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-               _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-               sessionType = MM_SESSION_TYPE_SHARE;
-       }
-       if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-               int errorcode;
-               ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
-               switch (hcamcorder->type) {
-               case MM_CAMCORDER_MODE_AUDIO:
-                       mm_resource = ASM_RESOURCE_NONE;
-                       break;
-               case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
-               default:
-                       mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-                       break;
-               }
-
-               if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
-                                        ASM_STATE_PLAYING, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
-                       ret = MM_ERROR_POLICY_BLOCKED;
-                       goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-               }
-       }
-
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_RECORD);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               /* check internal error of gstreamer */
+               if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+                       ret = hcamcorder->sub_context->error_code;
+                       _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret);
+               }
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
@@ -1338,16 +1179,13 @@ int _mmcamcorder_record(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
 _ERR_CAMCORDER_CMD_PRECON:
        /* check internal error of gstreamer */
-       if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+       if (hcamcorder->sub_context &&
+           hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
                ret = hcamcorder->sub_context->error_code;
                hcamcorder->sub_context->error_code = MM_ERROR_NONE;
 
@@ -1391,16 +1229,9 @@ int _mmcamcorder_pause(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PAUSE);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
@@ -1421,10 +1252,6 @@ int _mmcamcorder_pause(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
@@ -1446,7 +1273,7 @@ int _mmcamcorder_commit(MMHandleType handle)
        int state_TO = MM_CAMCORDER_STATE_PREPARE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       
+
        _mmcam_dbg_log("");
 
        if (!hcamcorder) {
@@ -1468,20 +1295,11 @@ int _mmcamcorder_commit(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_COMMIT);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       _mmcamcorder_set_state(handle,state_TO);
-
        /* set camera state to vconf key */
        if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
                int vconf_camera_state = 0;
@@ -1496,41 +1314,14 @@ int _mmcamcorder_commit(MMHandleType handle)
 
        /* check who calls unrealize. it's no need to set ASM state if caller is ASM */
        if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
-               int sessionType = MM_SESSION_TYPE_SHARE;
-               ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
-               if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-                       _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-                       sessionType = MM_SESSION_TYPE_SHARE;
-               }
-
-               /* Call session is not ended here */
-               if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-                       switch (hcamcorder->type) {
-                       case MM_CAMCORDER_MODE_AUDIO:
-                               mm_resource = ASM_RESOURCE_NONE;
-                               break;
-                       case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
-                       default:
-                               mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-                               break;
-                       }
-
-                       /* STOP EXCLUSIVE session */
-                       if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
-                                                ASM_STATE_STOP, mm_resource, &ret)) {
-                               _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", ret);
-                       }
-               }
+               /* TODO */
        }
 
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
-       return MM_ERROR_NONE;
+       _mmcamcorder_set_state(handle,state_TO);
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
+       return MM_ERROR_NONE;
 
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
@@ -1551,10 +1342,9 @@ int _mmcamcorder_cancel(MMHandleType handle)
        int state_FROM1 = MM_CAMCORDER_STATE_RECORDING;
        int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
        int state_TO = MM_CAMCORDER_STATE_PREPARE;
-       int sessionType = MM_SESSION_TYPE_SHARE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       
+
        _mmcam_dbg_log("");
 
        if (!hcamcorder) {
@@ -1576,50 +1366,16 @@ int _mmcamcorder_cancel(MMHandleType handle)
                goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
-       /* set async state */
-       ret = _mmcamcorder_set_async_state(handle, state_TO);
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_err("Can't set async state");
-               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
-       }
-
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_CANCEL);
        if (ret != MM_ERROR_NONE) {
-               goto _ERR_CAMCORDER_CMD;
+               goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
        }
 
        _mmcamcorder_set_state(handle, state_TO);
 
-       /* read session type */
-       if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
-               _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
-               sessionType = MM_SESSION_TYPE_SHARE;
-       }
-
-       /* Call session is not ended here */
-       if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
-               ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
-               switch (hcamcorder->type) {
-               case MM_CAMCORDER_MODE_AUDIO:
-                       mm_resource = ASM_RESOURCE_NONE;
-                       break;
-               case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
-               default:
-                       mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-                       break;
-               }
-
-               /* STOP EXCLUSIVE session */
-               if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
-                                        ASM_STATE_STOP, mm_resource, &ret)) {
-                       _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", ret);
-               }
-       }
-
-       /* set camera state to vconf key */
-       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
-               int vconf_camera_state = 0;
+       /* set camera state to vconf key */
+       if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+               int vconf_camera_state = 0;
 
                /* get current camera state of vconf key */
                vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state);
@@ -1633,10 +1389,6 @@ int _mmcamcorder_cancel(MMHandleType handle)
 
        return MM_ERROR_NONE;
 
-_ERR_CAMCORDER_CMD:
-       /* set async state and (set async cancel or set state) are pair. */
-       _mmcamcorder_set_async_cancel(handle);
-
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
 
@@ -1788,7 +1540,6 @@ int _mmcamcorder_init_focusing(MMHandleType handle)
        int current_af_range = 0;
        mmf_camcorder_t *hcamcorder = NULL;
        _MMCamcorderSubContext *sc = NULL;
-       mmf_attrs_t *attr = NULL;
        GstCameraControl *control = NULL;
 
        _mmcam_dbg_log("");
@@ -1828,7 +1579,6 @@ int _mmcamcorder_init_focusing(MMHandleType handle)
        }
 
        /* Initialize lens position */
-       attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
        mm_camcorder_get_attributes(handle, NULL,
                                    MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
                                    MMCAM_CAMERA_AF_SCAN_RANGE, &af_range,
@@ -1869,10 +1619,16 @@ int _mmcamcorder_adjust_focus(MMHandleType handle, int direction)
 
        _mmcam_dbg_log("");
 
+       if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
+               _mmcam_dbg_err("Another command is running.");
+               return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+       }
+
        state = _mmcamcorder_get_state(handle);
        if (state == MM_CAMCORDER_STATE_CAPTURING ||
            state < MM_CAMCORDER_STATE_PREPARE) {
                _mmcam_dbg_err("Not proper state. state[%d]", state);
+               _MMCAMCORDER_UNLOCK_CMD(handle);
                return MM_ERROR_CAMCORDER_INVALID_STATE;
        }
 
@@ -1883,19 +1639,24 @@ int _mmcamcorder_adjust_focus(MMHandleType handle, int direction)
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_warn("Get focus-mode fail. (%s:%x)", err_attr_name, ret);
                SAFE_FREE (err_attr_name);
+               _MMCAMCORDER_UNLOCK_CMD(handle);
                return ret;
        }
 
        if (focus_mode == MM_CAMCORDER_FOCUS_MODE_MANUAL) {
-               return _mmcamcorder_adjust_manual_focus(handle, direction);
+               ret = _mmcamcorder_adjust_manual_focus(handle, direction);
        } else if (focus_mode == MM_CAMCORDER_FOCUS_MODE_AUTO ||
                   focus_mode == MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO ||
                   focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS) {
-               return _mmcamcorder_adjust_auto_focus(handle);
+               ret = _mmcamcorder_adjust_auto_focus(handle);
        } else {
                _mmcam_dbg_err("It doesn't adjust focus. Focusing mode(%d)", focus_mode);
-               return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+               ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
        }
+
+       _MMCAMCORDER_UNLOCK_CMD(handle);
+
+       return ret;
 }
 
 int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction)
@@ -2091,10 +1852,7 @@ __mmcamcorder_gstreamer_init(camera_conf * conf)
        }
 
        /* initializing gstreamer */
-       __ta__("        gst_init_check",
        ret = gst_init_check (argc, &argv, &err);
-       );
-
        if (!ret) {
                _mmcam_dbg_err("Could not initialize GStreamer: %s ",
                               err ? err->message : "unknown error occurred");
@@ -2181,7 +1939,6 @@ void _mmcamcorder_set_state(MMHandleType handle, int state)
                switch (hcamcorder->state_change_by_system) {
                case _MMCAMCORDER_STATE_CHANGE_BY_ASM:
                        msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM;
-                       msg.param.state.code = hcamcorder->asm_event_code;
                        break;
                case _MMCAMCORDER_STATE_CHANGE_NORMAL:
                default:
@@ -2216,98 +1973,6 @@ int _mmcamcorder_get_async_state(MMHandleType handle)
        return state;
 }
 
-int _mmcamcorder_set_async_state(MMHandleType handle, int target_state)
-{
-       int error = MM_ERROR_NONE;
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-               
-       _mmcam_dbg_log("");
-
-       if (hcamcorder->sync_state_change) {
-               return error;
-       }
-
-       _MMCAMCORDER_LOCK_STATE(handle);
-
-       /* check changing state */
-       if (hcamcorder->state != hcamcorder->target_state) {
-               _mmcam_dbg_warn("State is changing now.");
-               error = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
-               goto _SET_ASYNC_END;
-       }
-
-       /* check already set */
-       if (hcamcorder->state == target_state) {
-               _mmcam_dbg_log("Target state already set.");
-               error = MM_ERROR_CAMCORDER_INVALID_STATE;
-               goto _SET_ASYNC_END;
-       }
-
-       hcamcorder->target_state = target_state;
-
-       _mmcam_dbg_log("Done");
-
-_SET_ASYNC_END:
-       _MMCAMCORDER_UNLOCK_STATE(handle);
-       return error;
-}
-
-
-gboolean _mmcamcorder_set_async_cancel(MMHandleType handle)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-       
-       _mmcam_dbg_log("");
-
-       if (hcamcorder->sync_state_change) {
-               return TRUE;
-       }
-
-       _MMCAMCORDER_LOCK_STATE(handle);
-
-       if (hcamcorder->target_state != hcamcorder->state) {
-               hcamcorder->target_state = hcamcorder->state;
-               _mmcam_dbg_log("Async state change is canceled.");
-               _MMCAMCORDER_UNLOCK_STATE(handle);
-               return TRUE;
-       } else {
-               _mmcam_dbg_log("Nothing to be cancel or Already processed.");
-       }
-
-       _MMCAMCORDER_UNLOCK_STATE(handle);
-
-       return FALSE;
-}
-
-
-gboolean _mmcamcorder_is_state_changing(MMHandleType handle)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-       
-       _mmcam_dbg_log("(%d)", (hcamcorder->target_state != hcamcorder->state));
-
-       if (hcamcorder->sync_state_change) {
-               return FALSE;
-       }
-
-       _MMCAMCORDER_LOCK_STATE(handle);
-
-       if (hcamcorder->target_state != hcamcorder->state) {
-               _MMCAMCORDER_UNLOCK_STATE(handle);
-               return TRUE;
-       }
-
-       _MMCAMCORDER_UNLOCK_STATE(handle);
-
-       return FALSE;
-}
-
 
 _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type)
 {
@@ -2323,26 +1988,25 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type)
        /* init members */
        memset(sc, 0x00, sizeof(_MMCamcorderSubContext));
 
-       sc->element_num = _MMCamcorder_PIPELINE_ELEMENT_NUM;
+       sc->element_num = _MMCAMCORDER_PIPELINE_ELEMENT_NUM;
+       sc->encode_element_num = _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM;
 
        /* alloc info for each mode */
        switch (type) {
        case MM_CAMCORDER_MODE_AUDIO:
                sc->info_audio = malloc( sizeof(_MMCamcorderAudioInfo));
-               if(sc->info_audio == NULL) {
+               if(!sc->info_audio) {
                        _mmcam_dbg_err("Failed to alloc info structure");
-                       free(sc);
-                       return NULL;
+                       goto ALLOC_SUBCONTEXT_FAILED;
                }
                memset(sc->info_audio, 0x00, sizeof(_MMCamcorderAudioInfo));
                break;
        case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
        default:
                sc->info_image = malloc( sizeof(_MMCamcorderImageInfo));
-               if(sc->info_image == NULL) {
+               if(!sc->info_image) {
                        _mmcam_dbg_err("Failed to alloc info structure");
-                       free(sc);
-                       return NULL;
+                       goto ALLOC_SUBCONTEXT_FAILED;
                }
                memset(sc->info_image, 0x00, sizeof(_MMCamcorderImageInfo));
 
@@ -2350,13 +2014,12 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type)
                sc->info_image->sound_status = _SOUND_STATUS_INIT;
 
                sc->info_video = malloc( sizeof(_MMCamcorderVideoInfo));
-               if(sc->info_video == NULL) {
+               if(!sc->info_video) {
                        _mmcam_dbg_err("Failed to alloc info structure");
-                       free(sc->info_image);
-                       free(sc);
-                       return NULL;
+                       goto ALLOC_SUBCONTEXT_FAILED;
                }
                memset(sc->info_video, 0x00, sizeof(_MMCamcorderVideoInfo));
+               pthread_mutex_init(&(sc->info_video->size_check_lock), NULL);
                break;
        }
 
@@ -2364,28 +2027,60 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type)
        sc->element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->element_num);
        if(!sc->element) {
                _mmcam_dbg_err("Failed to alloc element structure");
-               if (type == MM_CAMCORDER_MODE_AUDIO) {
-                       free(sc->info_audio);
-               } else {
-                       free(sc->info_image);
-                       free(sc->info_video);
-               }
-               free(sc);
-               return NULL;
+               goto ALLOC_SUBCONTEXT_FAILED;
+       }
+
+       sc->encode_element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->encode_element_num);
+       if(!sc->encode_element) {
+               _mmcam_dbg_err("Failed to alloc encode element structure");
+               goto ALLOC_SUBCONTEXT_FAILED;
        }
 
-       for (i = 0; i< sc->element_num; i++) {
+       for (i = 0 ; i < sc->element_num ; i++) {
                sc->element[i].id = _MMCAMCORDER_NONE;
                sc->element[i].gst = NULL;
        }
 
-       memset(sc->format_name, '\0', sizeof(sc->format_name));
+       for (i = 0 ; i < sc->encode_element_num ; i++) {
+               sc->encode_element[i].id = _MMCAMCORDER_NONE;
+               sc->encode_element[i].gst = NULL;
+       }
+
        sc->cam_stability_count = 0;
        sc->drop_vframe = 0;
        sc->pass_first_vframe = 0;
        sc->is_modified_rate = FALSE;
 
        return sc;
+
+ALLOC_SUBCONTEXT_FAILED:
+       if (sc) {
+               if (sc->info_audio) {
+                       free(sc->info_audio);
+                       sc->info_audio = NULL;
+               }
+               if (sc->info_image) {
+                       free(sc->info_image);
+                       sc->info_image = NULL;
+               }
+               if (sc->info_video) {
+                       pthread_mutex_destroy(&(sc->info_video->size_check_lock));
+                       free(sc->info_video);
+                       sc->info_video = NULL;
+               }
+               if (sc->element) {
+                       free(sc->element);
+                       sc->element = NULL;
+               }
+               if (sc->encode_element) {
+                       free(sc->encode_element);
+                       sc->encode_element = NULL;
+               }
+               free(sc);
+               sc = NULL;
+       }
+
+       return NULL;
 }
 
 
@@ -2395,10 +2090,17 @@ void _mmcamcorder_dealloc_subcontext(_MMCamcorderSubContext *sc)
 
        if (sc) {
                if (sc->element) {
+                       _mmcam_dbg_log("release element");
                        free(sc->element);
                        sc->element = NULL;
                }
 
+               if (sc->encode_element) {
+                       _mmcam_dbg_log("release encode_element");
+                       free(sc->encode_element);
+                       sc->encode_element = NULL;
+               }
+
                if (sc->info_image) {
                        _mmcam_dbg_log("release info_image");
                        free(sc->info_image);
@@ -2407,12 +2109,21 @@ void _mmcamcorder_dealloc_subcontext(_MMCamcorderSubContext *sc)
 
                if (sc->info_video) {
                        _mmcam_dbg_log("release info_video");
+                       if (sc->info_video->filename) {
+                               free(sc->info_video->filename);
+                               sc->info_video->filename = NULL;
+                       }
+                       pthread_mutex_destroy(&(sc->info_video->size_check_lock));
                        free(sc->info_video);
                        sc->info_video = NULL;
                }
 
                if (sc->info_audio) {
                        _mmcam_dbg_log("release info_audio");
+                       if (sc->info_audio->filename) {
+                               free(sc->info_audio->filename);
+                               sc->info_audio->filename = NULL;
+                       }
                        free(sc->info_audio);
                        sc->info_audio = NULL;
                }
@@ -2448,7 +2159,6 @@ int _mmcamcorder_set_functions(MMHandleType handle, int type)
 gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpointer data)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data);
-       _MMCamcorderMsgItem msg;
        _MMCamcorderSubContext *sc = NULL;
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
@@ -2523,7 +2233,7 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
                break;
        case GST_MESSAGE_STATE_CHANGED:
        {
-               GValue *vnewstate;
+               const GValue *vnewstate;
                GstState newstate;
                GstElement *pipeline = NULL;
 
@@ -2532,7 +2242,7 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
                        if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
                                pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
                                if (message->src == (GstObject*)pipeline) {
-                    vnewstate = (GValue*)gst_structure_get_value(gst_message_get_structure(message), "new-state");
+                                       vnewstate = (GValue*)gst_structure_get_value(gst_message_get_structure(message), "new-state");
                                        newstate = (GstState)vnewstate->data[0].v_int;
                                        _mmcam_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]",gst_element_state_get_name(newstate));
                                }
@@ -2554,9 +2264,9 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
                break;
        case GST_MESSAGE_NEW_CLOCK:
        {
-               GstClock *clock;
-               gst_message_parse_new_clock(message, &clock);
-               _mmcam_dbg_log("GST_MESSAGE_NEW_CLOCK : %s", (clock ? GST_OBJECT_NAME (clock) : "NULL"));
+               GstClock *pipe_clock = NULL;
+               gst_message_parse_new_clock(message, &pipe_clock);
+               _mmcam_dbg_log("GST_MESSAGE_NEW_CLOCK : %s", (pipe_clock ? GST_OBJECT_NAME (pipe_clock) : "NULL"));
                break;
        }
        case GST_MESSAGE_STRUCTURE_CHANGE:
@@ -2570,102 +2280,6 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
                break;
        case GST_MESSAGE_ELEMENT:
                _mmcam_dbg_log("GST_MESSAGE_ELEMENT");
-
-        if (gst_structure_has_name(gst_message_get_structure(message), "avsysvideosrc-AF") ||
-            gst_structure_has_name(gst_message_get_structure(message), "camerasrc-AF")) {
-                       int focus_state = 0;
-
-            gst_structure_get_int(gst_message_get_structure(message), "focus-state", &focus_state);
-                       _mmcam_dbg_log("Focus State:%d", focus_state);
-
-                       msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED;
-                       msg.param.code = focus_state;
-                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-        } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-HDR")) {
-                       int progress = 0;
-                       int status = 0;
-
-            gst_structure_get_int(gst_message_get_structure(message), "progress", &progress);
-            gst_structure_get_int(gst_message_get_structure(message), "status", &status);
-                       _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status);
-
-                       msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS;
-                       msg.param.code = progress;
-                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-        } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-FD")) {
-                       int i = 0;
-            const GValue *g_value = gst_structure_get_value(gst_message_get_structure(message), "face-info");;
-                       GstCameraControlFaceDetectInfo *fd_info = NULL;
-                       MMCamFaceDetectInfo *cam_fd_info = NULL;
-
-                       if (g_value) {
-                               fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value);
-                       }
-
-                       if (fd_info == NULL) {
-                               _mmcam_dbg_warn("fd_info is NULL");
-                               return TRUE;
-                       }
-
-                       cam_fd_info = (MMCamFaceDetectInfo *)malloc(sizeof(MMCamFaceDetectInfo));
-                       if (cam_fd_info == NULL) {
-                               _mmcam_dbg_warn("cam_fd_info alloc failed");
-
-                               free(fd_info);
-                               fd_info = NULL;
-
-                               return TRUE;
-                       }
-
-                       /* set total face count */
-                       cam_fd_info->num_of_faces = fd_info->num_of_faces;
-
-                       if (cam_fd_info->num_of_faces > 0) {
-                               cam_fd_info->face_info = (MMCamFaceInfo *)malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces);
-                               if (cam_fd_info->face_info) {
-                                       /* set information of each face */
-                                       for (i = 0 ; i < fd_info->num_of_faces ; i++) {
-                                               cam_fd_info->face_info[i].id = fd_info->face_info[i].id;
-                                               cam_fd_info->face_info[i].score = fd_info->face_info[i].score;
-                                               cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x;
-                                               cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y;
-                                               cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width;
-                                               cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height;
-                                               /*
-                                               _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]",
-                                                              fd_info->face_info[i].id,
-                                                              fd_info->face_info[i].score,
-                                                              fd_info->face_info[i].rect.x,
-                                                              fd_info->face_info[i].rect.y,
-                                                              fd_info->face_info[i].rect.width,
-                                                              fd_info->face_info[i].rect.height);
-                                               */
-                                       }
-                               } else {
-                                       _mmcam_dbg_warn("MMCamFaceInfo alloc failed");
-
-                                       /* free allocated memory that is not sent */
-                                       free(cam_fd_info);
-                                       cam_fd_info = NULL;
-                               }
-                       } else {
-                               cam_fd_info->face_info = NULL;
-                       }
-
-                       if (cam_fd_info) {
-                               /* send message  - cam_fd_info should be freed by application */
-                               msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO;
-                               msg.param.data = cam_fd_info;
-                               msg.param.size = sizeof(MMCamFaceDetectInfo);
-                               msg.param.code = 0;
-
-                               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-                       }
-
-                       /* free fd_info allocated by plugin */
-                       free(fd_info);
-                       fd_info = NULL;
-               }
                break;
        case GST_MESSAGE_SEGMENT_START:
                _mmcam_dbg_log("GST_MESSAGE_SEGMENT_START");
@@ -2673,8 +2287,8 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
        case GST_MESSAGE_SEGMENT_DONE:
                _mmcam_dbg_log("GST_MESSAGE_SEGMENT_DONE");
                break;
-       case GST_MESSAGE_DURATION:
-               _mmcam_dbg_log("GST_MESSAGE_DURATION");
+       case GST_MESSAGE_DURATION_CHANGED:
+               _mmcam_dbg_log("GST_MESSAGE_DURATION_CHANGED");
                break;
        case GST_MESSAGE_LATENCY:
                _mmcam_dbg_log("GST_MESSAGE_LATENCY");
@@ -2688,6 +2302,9 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
        case GST_MESSAGE_ANY:
                _mmcam_dbg_log("GST_MESSAGE_ANY");
                break;
+       case GST_MESSAGE_QOS:
+//             _mmcam_dbg_log("GST_MESSAGE_QOS");
+               break;
        default:
                _mmcam_dbg_log("not handled message type=(%d)", GST_MESSAGE_TYPE(message));
                break;
@@ -2716,17 +2333,17 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage
                /* parse error message */
                gst_message_parse_error(message, &err, &debug_info);
 
-               if (!err) {
-                       _mmcam_dbg_warn("failed to parse error message");
-                       return GST_BUS_PASS;
-               }
-
                if (debug_info) {
                        _mmcam_dbg_err("GST ERROR : %s", debug_info);
                        g_free(debug_info);
                        debug_info = NULL;
                }
 
+               if (!err) {
+                       _mmcam_dbg_warn("failed to parse error message");
+                       return GST_BUS_PASS;
+               }
+
                /* set videosrc element to compare */
                element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
 
@@ -2738,9 +2355,13 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage
                                _mmcam_dbg_err("Camera device [busy]");
                                sc->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY;
                                break;
-                       case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
                        case GST_RESOURCE_ERROR_OPEN_WRITE:
                                _mmcam_dbg_err("Camera device [open failed]");
+                               sc->error_code = MM_ERROR_COMMON_INVALID_PERMISSION;
+                               //sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN; // SECURITY PART REQUEST PRIVILEGE
+                               break;
+                       case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
+                               _mmcam_dbg_err("Camera device [open failed]");
                                sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN;
                                break;
                        case GST_RESOURCE_ERROR_OPEN_READ:
@@ -2776,179 +2397,142 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage
 
                /* store error code and drop this message if cmd is running */
                if (sc->error_code != MM_ERROR_NONE) {
-                       if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
-                               _mmcam_dbg_err("cmd is running and will be returned with this error %x",
-                                              sc->error_code);
-                               return GST_BUS_DROP;
-                       }
+                       _MMCamcorderMsgItem msg;
+
+                       /* post error to application */
+                       sc->error_occurs = TRUE;
+                       msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+                       msg.param.code = sc->error_code;
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
-                       _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+                       goto DROP_MESSAGE;
                }
-       }
+       } else if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
+               _MMCamcorderMsgItem msg;
 
-       return GST_BUS_PASS;
-}
+               if (gst_structure_has_name(gst_message_get_structure(message), "avsysvideosrc-AF") ||
+                   gst_structure_has_name(gst_message_get_structure(message), "camerasrc-AF")) {
+                       int focus_state = 0;
 
+                       gst_structure_get_int(gst_message_get_structure(message), "focus-state", &focus_state);
+                       _mmcam_dbg_log("Focus State:%d", focus_state);
 
-static int __mmcamcorder_asm_get_event_type(int sessionType)
-{
-       switch (sessionType) {
-       case MM_SESSION_TYPE_SHARE:
-               return ASM_EVENT_SHARE_MMCAMCORDER;
-       case MM_SESSION_TYPE_EXCLUSIVE:
-               return ASM_EVENT_EXCLUSIVE_MMCAMCORDER;
-       case MM_SESSION_TYPE_NOTIFY:
-               return ASM_EVENT_NOTIFY;
-       case MM_SESSION_TYPE_CALL:
-               return ASM_EVENT_CALL;
-       case MM_SESSION_TYPE_VIDEOCALL:
-               return ASM_EVENT_VIDEOCALL;
-       case MM_SESSION_TYPE_ALARM:
-               return ASM_EVENT_ALARM;
-       default:
-               return ASM_EVENT_SHARE_MMCAMCORDER;
-       }
-}
+                       msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED;
+                       msg.param.code = focus_state;
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
-ASM_cb_result_t _mmcamcorder_asm_callback_sh(int handle, ASM_event_sources_t event_src,
-                                             ASM_sound_commands_t command,
-                                             unsigned int sound_status, void* cb_data)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(cb_data);
-       int current_state = MM_CAMCORDER_STATE_NONE;
-       ASM_cb_result_t cb_res = ASM_CB_RES_NONE;
+                       goto DROP_MESSAGE;
+               } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-HDR")) {
+                       int progress = 0;
+                       int status = 0;
 
-       mmf_return_val_if_fail((MMHandleType)hcamcorder, ASM_CB_RES_NONE);
+                       if (gst_structure_get_int(gst_message_get_structure(message), "progress", &progress)) {
+                               gst_structure_get_int(gst_message_get_structure(message), "status", &status);
+                               _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status);
 
-       current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-       if (current_state <= MM_CAMCORDER_STATE_NONE ||
-           current_state >= MM_CAMCORDER_STATE_NUM) {
-               _mmcam_dbg_err("Abnormal state. Or null handle. (%p, %d, %d)", hcamcorder, command, current_state);
-       }
+                               msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS;
+                               msg.param.code = progress;
+                               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+                       }
 
-       /* set value to inform a status is changed by asm */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
-       /* set ASM event code for sending it to application */
-       hcamcorder->asm_event_code = event_src;
+                       goto DROP_MESSAGE;
+               } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-FD")) {
+                       int i = 0;
+                       const GValue *g_value = gst_structure_get_value(gst_message_get_structure(message), "face-info");;
+                       GstCameraControlFaceDetectInfo *fd_info = NULL;
+                       MMCamFaceDetectInfo *cam_fd_info = NULL;
 
-       _mmcam_dbg_log("ASM SHARE callback : event code 0x%x, command 0x%x", event_src, command);
+                       if (g_value) {
+                               fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value);
+                       }
 
-       switch (command) {
-       case ASM_COMMAND_STOP:
-       case ASM_COMMAND_PAUSE:
-               _mmcam_dbg_log("Got msg from asm to Stop or Pause(%d, %d)", command, current_state);
+                       if (fd_info == NULL) {
+                               _mmcam_dbg_warn("fd_info is NULL");
+                               goto DROP_MESSAGE;
+                       }
 
-               __mmcamcorder_force_stop(hcamcorder);
-               cb_res = ASM_CB_RES_STOP;
+                       cam_fd_info = (MMCamFaceDetectInfo *)malloc(sizeof(MMCamFaceDetectInfo));
+                       if (cam_fd_info == NULL) {
+                               _mmcam_dbg_warn("cam_fd_info alloc failed");
 
-               _mmcam_dbg_log("Finish opeartion. Camera is released.(%d)", cb_res);
-               break;
-       case ASM_COMMAND_PLAY:
-               _mmcam_dbg_log("Got msg from asm to Play(%d, %d)", command, current_state);
+                               free(fd_info);
+                               fd_info = NULL;
 
-               if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
-                       _mmcam_dbg_log("Already start previewing");
-               } else {
-                       __mmcamcorder_force_resume(hcamcorder);
-               }
-
-               cb_res = ASM_CB_RES_PLAYING;
-
-               _mmcam_dbg_log("Finish opeartion. Preview is started.(%d)", cb_res);
-               break;
-       case ASM_COMMAND_RESUME:
-       {
-               _MMCamcorderMsgItem msg;
-
-               _mmcam_dbg_log("Got msg from asm to Resume(%d, %d)", command, current_state);
-
-               msg.id = MM_MESSAGE_READY_TO_RESUME;
-               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-               cb_res = ASM_CB_RES_PLAYING;
-
-               _mmcam_dbg_log("Finish opeartion.(%d)", cb_res);
-               break;
-       }
-       default: /* should not be reached here */
-               cb_res = ASM_CB_RES_PLAYING;
-               _mmcam_dbg_err("Command err.");
-               break;
-       }
-
-       /* restore value */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL;
-
-       return cb_res;
-}
-
-
-ASM_cb_result_t _mmcamcorder_asm_callback_ex(int handle, ASM_event_sources_t event_src,
-                                             ASM_sound_commands_t command,
-                                             unsigned int sound_status, void* cb_data)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(cb_data);
-       int current_state = MM_CAMCORDER_STATE_NONE;
-       ASM_cb_result_t cb_res = ASM_CB_RES_NONE;
+                               goto DROP_MESSAGE;
+                       }
 
-       mmf_return_val_if_fail((MMHandleType)hcamcorder, ASM_CB_RES_NONE);
+                       /* set total face count */
+                       cam_fd_info->num_of_faces = fd_info->num_of_faces;
 
-       current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
+                       if (cam_fd_info->num_of_faces > 0) {
+                               cam_fd_info->face_info = (MMCamFaceInfo *)malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces);
+                               if (cam_fd_info->face_info) {
+                                       /* set information of each face */
+                                       for (i = 0 ; i < fd_info->num_of_faces ; i++) {
+                                               cam_fd_info->face_info[i].id = fd_info->face_info[i].id;
+                                               cam_fd_info->face_info[i].score = fd_info->face_info[i].score;
+                                               cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x;
+                                               cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y;
+                                               cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width;
+                                               cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height;
+                                               /*
+                                               _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]",
+                                                              fd_info->face_info[i].id,
+                                                              fd_info->face_info[i].score,
+                                                              fd_info->face_info[i].rect.x,
+                                                              fd_info->face_info[i].rect.y,
+                                                              fd_info->face_info[i].rect.width,
+                                                              fd_info->face_info[i].rect.height);
+                                               */
+                                       }
+                               } else {
+                                       _mmcam_dbg_warn("MMCamFaceInfo alloc failed");
 
-       _mmcam_dbg_log("ASM EXCLUSIVE callback : event code 0x%x, command 0x%x, current state %d",
-                      event_src, command, current_state);
+                                       /* free allocated memory that is not sent */
+                                       free(cam_fd_info);
+                                       cam_fd_info = NULL;
+                               }
+                       } else {
+                               cam_fd_info->face_info = NULL;
+                       }
 
-       /* set value to inform a status is changed by asm */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
+                       if (cam_fd_info) {
+                               /* send message  - cam_fd_info should be freed by application */
+                               msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO;
+                               msg.param.data = cam_fd_info;
+                               msg.param.size = sizeof(MMCamFaceDetectInfo);
+                               msg.param.code = 0;
 
-       /* set ASM event code for sending it to application */
-       hcamcorder->asm_event_code = event_src;
+                               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+                       }
 
-       switch (command) {
-       case ASM_COMMAND_STOP:
-       case ASM_COMMAND_PAUSE:
-               _mmcam_dbg_log("Got msg from asm to Stop or Pause(%d, %d)", command, current_state);
+                       /* free fd_info allocated by plugin */
+                       free(fd_info);
+                       fd_info = NULL;
 
-               __mmcamcorder_force_stop(hcamcorder);
-               cb_res = ASM_CB_RES_STOP;
+                       goto DROP_MESSAGE;
+               } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-Capture")) {
+                       int capture_done = FALSE;
 
-               _mmcam_dbg_log("Finish opeartion. Camera is released.(%d)", cb_res);
-               break;
-       case ASM_COMMAND_PLAY:
-               _mmcam_dbg_log("Got msg from asm to Play(%d, %d)", command, current_state);
+                       if (gst_structure_get_int(gst_message_get_structure(message), "capture-done", &capture_done)) {
+                               sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+                               if (sc && sc->info_image) {
+                                       /* play capture sound */
+                                       _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
+                               }
+                       }
 
-               if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
-                       _mmcam_dbg_log("Already start previewing");
-               } else {
-                       __mmcamcorder_force_resume(hcamcorder);
+                       goto DROP_MESSAGE;
                }
-
-               cb_res = ASM_CB_RES_PLAYING;
-
-               _mmcam_dbg_log("Finish opeartion. Preview is started.(%d)", cb_res);
-               break;
-       case ASM_COMMAND_RESUME:
-       {
-               _MMCamcorderMsgItem msg;
-
-               _mmcam_dbg_log("Got msg from asm to Resume(%d, %d)", command, current_state);
-
-               msg.id = MM_MESSAGE_READY_TO_RESUME;
-               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-               cb_res = ASM_CB_RES_PLAYING;
-
-               _mmcam_dbg_log("Finish opeartion.(%d)", cb_res);
-               break;
-       }
-       default: /* should not be reached here */
-               cb_res = ASM_CB_RES_PLAYING;
-               _mmcam_dbg_err("Command err.");
-               break;
        }
 
-       /* restore value */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL;
+       return GST_BUS_PASS;
+
+DROP_MESSAGE:
+       gst_message_unref(message);
+       message = NULL;
 
-       return cb_res;
+       return GST_BUS_DROP;
 }
 
 
@@ -2968,27 +2552,21 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type)
 
        switch (type) {
        case MM_CAMCORDER_MODE_AUDIO:
-               __ta__("        _mmcamcorder_create_audio_pipeline",
                ret = _mmcamcorder_create_audio_pipeline(handle);
-               );
                if (ret != MM_ERROR_NONE) {
                        return ret;
                }
                break;
        case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
        default:
-               __ta__("        _mmcamcorder_create_preview_pipeline",
                ret = _mmcamcorder_create_preview_pipeline(handle);
-               );
                if (ret != MM_ERROR_NONE) {
                        return ret;
                }
 
                /* connect capture signal */
                if (!sc->bencbin_capture) {
-                       __ta__("        _mmcamcorder_connect_capture_signal",
                        ret = _mmcamcorder_connect_capture_signal(handle);
-                       );
                        if (ret != MM_ERROR_NONE) {
                                return ret;
                        }
@@ -2998,22 +2576,15 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type)
 
        pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
        if (type != MM_CAMCORDER_MODE_AUDIO) {
-               if (hcamcorder->sync_state_change) {
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-               } else {
-                       ret = _mmcamcorder_gst_set_state_async(handle, pipeline, GST_STATE_READY);
-                       if (ret == GST_STATE_CHANGE_FAILURE) {
-                               return MM_ERROR_CAMCORDER_GST_STATECHANGE;
-                       }
-               }
+               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
        }
 #ifdef _MMCAMCORDER_GET_DEVICE_INFO
        if (!_mmcamcorder_get_device_info(handle)) {
                _mmcam_dbg_err("Getting device information error!!");
        }
 #endif
-       _mmcam_dbg_log("ret[%x]", ret);
 
+       _mmcam_dbg_log("ret[%x]", ret);
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_err("error : destroy pipeline");
                _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
@@ -3026,8 +2597,10 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type)
 void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;      
+       _MMCamcorderSubContext *sc = NULL;
        gint i = 0;
+       int element_num = 0;
+       _MMCamcorderGstElement *element = NULL;
        GstBus *bus = NULL;
 
        mmf_return_if_fail(hcamcorder);
@@ -3037,14 +2610,18 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type)
 
        _mmcam_dbg_log("");
 
-       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
-
        /* Inside each pipeline destroy function, Set GST_STATE_NULL to Main pipeline */
        switch (type) {
        case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
+               element = sc->element;
+               element_num = sc->element_num;
+               bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
                _mmcamcorder_destroy_video_capture_pipeline(handle);
                break;
        case MM_CAMCORDER_MODE_AUDIO:
+               element = sc->encode_element;
+               element_num = sc->encode_element_num;
+               bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
                _mmcamcorder_destroy_audio_pipeline(handle);
                break;
        default:
@@ -3055,10 +2632,13 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type)
        _mmcam_dbg_log("Pipeline clear!!");
 
        /* Remove pipeline message callback */
-       g_source_remove(hcamcorder->pipeline_cb_event_id);
+       if (hcamcorder->pipeline_cb_event_id > 0) {
+               g_source_remove(hcamcorder->pipeline_cb_event_id);
+               hcamcorder->pipeline_cb_event_id = 0;
+       }
 
        /* Remove remained message in bus */
-       if (bus != NULL) {
+       if (bus) {
                GstMessage *gst_msg = NULL;
                while ((gst_msg = gst_bus_pop(bus)) != NULL) {
                        _mmcamcorder_pipeline_cb_message(bus, gst_msg, (gpointer)hcamcorder);
@@ -3070,23 +2650,25 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type)
        }
 
        /* checking unreleased element */
-       for (i = 0 ; i < _MMCamcorder_PIPELINE_ELEMENT_NUM ; i++ ) {
-               if (sc->element[i].gst) {
-                       if (GST_IS_ELEMENT(sc->element[i].gst)) {
+       for (i = 0 ; i < element_num ; i++ ) {
+               if (element[i].gst) {
+                       if (GST_IS_ELEMENT(element[i].gst)) {
                                _mmcam_dbg_warn("Still alive element - ID[%d], name [%s], ref count[%d], status[%s]",
-                                               sc->element[i].id,
-                                               GST_OBJECT_NAME(sc->element[i].gst),
-                                               GST_OBJECT_REFCOUNT_VALUE(sc->element[i].gst),
-                                               gst_element_state_get_name (GST_STATE (sc->element[i].gst)));
-                               g_object_weak_unref(G_OBJECT(sc->element[i].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
+                                               element[i].id,
+                                               GST_OBJECT_NAME(element[i].gst),
+                                               GST_OBJECT_REFCOUNT(element[i].gst),
+                                               gst_element_state_get_name(GST_STATE(element[i].gst)));
+                               g_object_weak_unref(G_OBJECT(element[i].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
                        } else {
-                               _mmcam_dbg_warn("The element[%d] is still aliving, check it", sc->element[i].id);
+                               _mmcam_dbg_warn("The element[%d] is still aliving, check it", element[i].id);
                        }
 
-                       sc->element[i].id = _MMCAMCORDER_NONE;
-                       sc->element[i].gst = NULL;
+                       element[i].id = _MMCAMCORDER_NONE;
+                       element[i].gst = NULL;
                }
        }
+
+       return;
 }
 
 
@@ -3124,19 +2706,29 @@ static gboolean __mmcamcorder_set_attr_to_camsensor_cb(gpointer data)
 #endif /* _MMCAMCORDER_USE_SET_ATTR_CB */
 
 
-int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstState target_state)
+int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state)
 {
        unsigned int k = 0;
+       _MMCamcorderSubContext *sc = NULL;
        GstState pipeline_state = GST_STATE_VOID_PENDING;
        GstStateChangeReturn setChangeReturn = GST_STATE_CHANGE_FAILURE;
        GstStateChangeReturn getChangeReturn = GST_STATE_CHANGE_FAILURE;
        GstClockTime get_timeout = __MMCAMCORDER_SET_GST_STATE_TIMEOUT * GST_SECOND;
+       pthread_mutex_t *state_lock = NULL;
 
        mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       _mmcam_dbg_log("Set state to %d", target_state);
+       if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst == pipeline) {
+               _mmcam_dbg_log("Set state to %d - PREVIEW PIPELINE", target_state);
+               state_lock = &_MMCAMCORDER_GET_GST_STATE_LOCK(handle);
+       } else {
+               _mmcam_dbg_log("Set state to %d - ENDODE PIPELINE", target_state);
+               state_lock = &_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle);
+       }
 
-       _MMCAMCORDER_LOCK_GST_STATE(handle);
+       pthread_mutex_lock(state_lock);
 
        for (k = 0; k < _MMCAMCORDER_STATE_SET_COUNT; k++) {
                setChangeReturn = gst_element_set_state(pipeline, target_state);
@@ -3150,7 +2742,8 @@ int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstSt
                        case GST_STATE_CHANGE_SUCCESS:
                                /* if we reached the final target state, exit */
                                if (pipeline_state == target_state) {
-                                       _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+                                       _mmcam_dbg_log("Set state to %d - DONE", target_state);
+                                       pthread_mutex_unlock(state_lock);
                                        return MM_ERROR_NONE;
                                }
                                break;
@@ -3158,23 +2751,25 @@ int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstSt
                                _mmcam_dbg_log("status=GST_STATE_CHANGE_ASYNC.");
                                break;
                        default:
-                               _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+                               pthread_mutex_unlock(state_lock);
                                _mmcam_dbg_log("status=GST_STATE_CHANGE_FAILURE.");
                                return MM_ERROR_CAMCORDER_GST_STATECHANGE;
                        }
 
-                       _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+                       pthread_mutex_unlock(state_lock);
+
                        _mmcam_dbg_err("timeout of gst_element_get_state()!!");
+
                        return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
                }
                usleep(_MMCAMCORDER_STATE_CHECK_INTERVAL);
        }
 
-       _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+       pthread_mutex_unlock(state_lock);
 
        _mmcam_dbg_err("Failure. gst_element_set_state timeout!!");
 
-       return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;     
+       return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
 }
 
 
@@ -3188,7 +2783,7 @@ int _mmcamcorder_video_current_framerate(MMHandleType handle)
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc, -1);
-       
+
        return sc->kpi.current_fps;
 }
 
@@ -3222,341 +2817,6 @@ void _mmcamcorder_video_current_framerate_init(MMHandleType handle)
        return;
 }
 
-/* Async state change */
-void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo)
-{
-       if (cmdinfo) {
-               g_free(cmdinfo);
-       }
-}
-
-static void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder)
-{
-       int i = 0;
-       int loop = 0;
-       int itr_cnt = 0;
-       int result = MM_ERROR_NONE;
-       int current_state = MM_CAMCORDER_STATE_NONE;
-
-       mmf_return_if_fail(hcamcorder);
-
-       current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-
-       _mmcam_dbg_log( "Force STOP MMFW Camcorder" );
-
-       for (loop = 0 ; current_state > MM_CAMCORDER_STATE_NULL && loop < __MMCAMCORDER_CMD_ITERATE_MAX * 3 ; loop++) {
-               itr_cnt = __MMCAMCORDER_CMD_ITERATE_MAX;
-               switch (current_state) {
-               case MM_CAMCORDER_STATE_CAPTURING:
-               {
-                       _MMCamcorderSubContext *sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
-                       _MMCamcorderImageInfo *info = NULL;
-
-                       mmf_return_if_fail(sc);
-                       mmf_return_if_fail((info = sc->info_image));
-
-                       _mmcam_dbg_log("Stop capturing.");
-
-                       /* if caturing isn't finished, waiting for 2 sec to finish real capture operation. check 'info->capturing'. */
-                       mm_camcorder_set_attributes((MMHandleType)hcamcorder, NULL,
-                                                   MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT, TRUE,
-                                                   NULL);
-
-                       for (i = 0; i < 20 && info->capturing; i++) {
-                               usleep(100000);
-                       }
-
-                       if (i == 20) {
-                               _mmcam_dbg_err("Timeout. Can't check stop capturing.");
-                       }
-
-                       while ((itr_cnt--) && ((result = _mmcamcorder_capture_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                                       _mmcam_dbg_warn("Can't stop capturing.(%x)", result);
-                       }
-
-                       break;
-               }
-               case MM_CAMCORDER_STATE_RECORDING:
-               case MM_CAMCORDER_STATE_PAUSED:
-               {
-                       _mmcam_dbg_log("Stop recording.");
-
-                       while ((itr_cnt--) && ((result = _mmcamcorder_commit((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                               _mmcam_dbg_warn("Can't commit.(%x)", result);
-                       }
-                       break;
-               }
-               case MM_CAMCORDER_STATE_PREPARE:
-               {
-                       _mmcam_dbg_log("Stop preview.");
-
-                       while ((itr_cnt--) && ((result = _mmcamcorder_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                               _mmcam_dbg_warn("Can't stop preview.(%x)", result);
-                       }
-                       break;
-               }
-               case MM_CAMCORDER_STATE_READY:
-               {
-                       _mmcam_dbg_log("unrealize");
-
-                       if ((result = _mmcamcorder_unrealize((MMHandleType)hcamcorder)) != MM_ERROR_NONE) {
-                               _mmcam_dbg_warn("Can't unrealize.(%x)", result);
-                       }
-                       break;
-               }
-               case MM_CAMCORDER_STATE_NULL:
-               default:
-                       _mmcam_dbg_log("Already stopped.");
-                       break;
-               }
-
-               current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-       }
-
-       _mmcam_dbg_log( "Done." );
-
-       return;
-}
-
-
-static void __mmcamcorder_force_resume(mmf_camcorder_t *hcamcorder)
-{
-       int loop = 0;
-       int result = MM_ERROR_NONE;
-       int itr_cnt = 0;
-       int current_state = MM_CAMCORDER_STATE_NONE;
-
-       mmf_return_if_fail(hcamcorder);
-
-       _mmcam_dbg_log("Force RESUME MMFW Camcorder");
-
-       current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-
-       for (loop = 0 ; current_state < MM_CAMCORDER_STATE_PREPARE && loop < __MMCAMCORDER_CMD_ITERATE_MAX * 3 ; loop++) {
-               itr_cnt = __MMCAMCORDER_CMD_ITERATE_MAX;
-
-               switch (current_state) {
-               case MM_CAMCORDER_STATE_NULL:
-                       _mmcam_dbg_log("Realize");
-                       while ((itr_cnt--) && ((result = _mmcamcorder_realize((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                               _mmcam_dbg_warn("Can't realize.(%x)", result);
-                       }
-                       break;
-               case MM_CAMCORDER_STATE_READY:
-                       _mmcam_dbg_log("Start previewing");
-
-                       while ((itr_cnt--) && ((result = _mmcamcorder_start((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                               _mmcam_dbg_warn("Can't start previewing.(%x)", result);
-                       }
-                       break;
-               default:
-                       _mmcam_dbg_log("Abnormal state.");
-                       break;
-               }
-
-               current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-       }
-
-       _mmcam_dbg_log( "Done." );
-
-       return;
-}
-
-int _mmcamcorder_create_command_loop(MMHandleType handle)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderCommand *cmd;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       _mmcam_dbg_log("");
-
-       cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
-       cmd->cmd_queue = g_queue_new();
-       mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
-       sem_init(&cmd->sema, 0, 0);
-
-       if (pthread_create(&cmd->pCommandThread, NULL, _mmcamcorder_command_loop_thread, hcamcorder)) {
-               perror("Make Command Thread Fail");
-               return MM_ERROR_COMMON_UNKNOWN;
-       }
-
-       return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_destroy_command_loop(MMHandleType handle)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderCommand *cmd;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       _mmcam_dbg_log("");
-
-       cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
-       mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
-       _mmcamcorder_append_simple_command(handle, _MMCAMCORDER_CMD_QUIT);
-
-       sem_post(&cmd->sema); /* why is this needed? */
-
-       _mmcam_dbg_log("wait for pthread join");
-
-       pthread_join(cmd->pCommandThread, NULL);
-
-       _mmcam_dbg_log("pthread join!!");
-       
-       sem_destroy(&cmd->sema);
-
-       while (!g_queue_is_empty(cmd->cmd_queue)) {
-               __MMCamcorderCmdInfo *info = NULL;
-               info = g_queue_pop_head(cmd->cmd_queue);
-               _mmcamcorder_delete_command_info(info);
-       }
-       g_queue_free(cmd->cmd_queue);
-
-       _mmcam_dbg_log("Command loop clear.");  
-
-       return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info)
-{
-       int value = 0;
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderCommand *cmd;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       _mmcam_dbg_log("");
-
-       cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
-       mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
-       g_queue_push_tail (cmd->cmd_queue, (gpointer)info);
-
-       sem_getvalue(&cmd->sema, &value);
-
-       if (value == 0) {
-               sem_post(&cmd->sema);
-       } else {
-               /* Don't need to post. */
-       }
-
-       return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       __MMCamcorderCmdInfo *info = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
-       _mmcam_dbg_log("Command Type=%d", type);
-
-       info = (__MMCamcorderCmdInfo*)malloc(sizeof(__MMCamcorderCmdInfo));
-
-       info->handle = handle;
-       info->type = type;
-
-       _mmcamcorder_append_command(handle, info);      
-
-       return MM_ERROR_NONE;
-}
-
-
-void *_mmcamcorder_command_loop_thread(void *arg)
-{
-       gboolean bExit_loop = FALSE;
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(arg);
-       _MMCamcorderCommand *cmd = NULL;
-       __MMCamcorderCmdInfo *cmdinfo = NULL;
-
-       mmf_return_val_if_fail(hcamcorder, NULL);
-
-       cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
-       mmf_return_val_if_fail(cmd->cmd_queue, NULL);
-
-       _mmcam_dbg_log("");
-
-       while (!bExit_loop) {
-               sem_wait(&cmd->sema);
-
-               /* send command */
-               while (!g_queue_is_empty (cmd->cmd_queue)) {
-                       int bRet = MM_ERROR_NONE;
-
-                       cmdinfo = g_queue_pop_head(cmd->cmd_queue);
-                       if (cmdinfo->handle == (MMHandleType)NULL) {
-                               _mmcam_dbg_log("Handle in cmdinfo is Null.");
-                               bRet = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
-                       } else {
-                               switch (cmdinfo->type) {
-                               case _MMCAMCORDER_CMD_CREATE:
-                               case _MMCAMCORDER_CMD_DESTROY:
-                               case _MMCAMCORDER_CMD_CAPTURESTART:
-                               case _MMCAMCORDER_CMD_CAPTURESTOP:
-                               case _MMCAMCORDER_CMD_RECORD:
-                               case _MMCAMCORDER_CMD_PAUSE:
-                               case _MMCAMCORDER_CMD_COMMIT:
-                                       __ta__("_mmcamcorder_commit",
-                                       bRet = _mmcamcorder_commit(cmdinfo->handle);
-                                       );
-                                       break;
-                               case _MMCAMCORDER_CMD_CANCEL:
-                                       //Not used yet.
-                                       break;
-                               case _MMCAMCORDER_CMD_REALIZE:
-                                       __ta__("_mmcamcorder_realize",
-                                       bRet = _mmcamcorder_realize(cmdinfo->handle);
-                                       );
-                                       break;
-                               case _MMCAMCORDER_CMD_UNREALIZE:
-                                       __ta__("_mmcamcorder_unrealize",
-                                       bRet = _mmcamcorder_unrealize(cmdinfo->handle);
-                                       );
-                                       break;
-                               case _MMCAMCORDER_CMD_START:
-                                       __ta__("_mmcamcorder_start",
-                                       bRet = _mmcamcorder_start(cmdinfo->handle);
-                                       );
-                                       break;
-                               case _MMCAMCORDER_CMD_STOP:
-                                       __ta__("_mmcamcorder_stop",
-                                       bRet = _mmcamcorder_stop(cmdinfo->handle);
-                                       );
-                                       break;
-                               case _MMCAMCORDER_CMD_QUIT:
-                                       _mmcam_dbg_log("Exit command loop!!");
-                                       bExit_loop = TRUE;
-                                       break;
-                               default:
-                                       _mmcam_dbg_log("Wrong command type!!!");
-                                       break;
-                               }
-                       }
-
-                       if (bRet != MM_ERROR_NONE) {
-                               _mmcam_dbg_log("Error on command process!(%x)", bRet);
-                               /* Do something? */
-                       }
-
-                       _mmcamcorder_delete_command_info(cmdinfo);
-
-                       if (bExit_loop) {
-                               break;
-                       }
-                       usleep(1);
-               }
-       }
-
-       return NULL;
-}
-
 
 static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage *message, GError *error)
 {
@@ -3564,7 +2824,7 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage *
        _MMCamcorderMsgItem msg;
        gchar *msg_src_element;
        _MMCamcorderSubContext *sc = NULL;
-       
+
        return_val_if_fail(hcamcorder, FALSE);
        return_val_if_fail(error, FALSE);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
@@ -3640,7 +2900,7 @@ static gint __mmcamcorder_gst_handle_core_error(MMHandleType handle, int code, G
        mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        /* Specific plugin - video encoder plugin */
-       element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+       element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
 
        if (GST_ELEMENT_CAST(message->src) == element) {
                if (code == GST_CORE_ERROR_NEGOTIATION) {
@@ -3661,7 +2921,7 @@ static gint __mmcamcorder_gst_handle_core_error(MMHandleType handle, int code, G
                case GST_CORE_ERROR_SEEK:
                case GST_CORE_ERROR_NOT_IMPLEMENTED:
                case GST_CORE_ERROR_FAILED:
-               case GST_CORE_ERROR_TOO_LAZY:   
+               case GST_CORE_ERROR_TOO_LAZY:
                case GST_CORE_ERROR_PAD:
                case GST_CORE_ERROR_THREAD:
                case GST_CORE_ERROR_EVENT:
@@ -3725,7 +2985,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod
        }
 
        /* encodebin */
-       element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+       element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
        if (GST_ELEMENT_CAST(message->src) == element) {
                if (code == GST_RESOURCE_ERROR_FAILED) {
                        _mmcam_dbg_err("Encoder [Resource error]");
@@ -3782,7 +3042,7 @@ static gint __mmcamcorder_gst_handle_stream_error(MMHandleType handle, int code,
 
        /* Specific plugin */
        /* video encoder */
-       element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+       element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
        if (GST_ELEMENT_CAST(message->src) == element) {
                switch (code) {
                case GST_STREAM_ERROR_WRONG_TYPE:
index 87f8bf8..5c5df8c 100644 (file)
@@ -151,6 +151,26 @@ _MMCamcorderEnumConvert _mmcamcorder_enum_conv_wdr_ctrl =
        "WDR"
 };
 
+static int __enum_conv_flip_ctrl[MM_CAMCORDER_FLIP_NUM];
+
+_MMCamcorderEnumConvert _mmcamcorder_enum_conv_flip_ctrl =
+{
+       MM_CAMCORDER_FLIP_NUM,
+       __enum_conv_flip_ctrl,
+       CONFIGURE_CATEGORY_CTRL_EFFECT,
+       "Flip"
+};
+
+static int __enum_conv_rotation_ctrl[MM_CAMCORDER_ROTATION_NUM];
+
+_MMCamcorderEnumConvert _mmcamcorder_enum_conv_rotation_ctrl =
+{
+       MM_CAMCORDER_ROTATION_NUM,
+       __enum_conv_rotation_ctrl,
+       CONFIGURE_CATEGORY_CTRL_EFFECT,
+       "Rotation"
+};
+
 
 static int __enum_conv_ahs[MM_CAMCORDER_AHS_NUM];
 
@@ -378,6 +398,24 @@ static _MMCamcorderInfoConverting  g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
        },
        {
                CONFIGURE_TYPE_CTRL,
+               CONFIGURE_CATEGORY_CTRL_EFFECT,
+               MM_CAM_CAMERA_FLIP,
+               MM_CAMCORDER_ATTR_NONE,
+               "Flip",
+               MM_CAMCONVERT_TYPE_INT_ARRAY,
+               &_mmcamcorder_enum_conv_flip_ctrl,
+       },
+       {
+               CONFIGURE_TYPE_CTRL,
+               CONFIGURE_CATEGORY_CTRL_EFFECT,
+               MM_CAM_CAMERA_ROTATION,
+               MM_CAMCORDER_ATTR_NONE,
+               "Rotation",
+               MM_CAMCONVERT_TYPE_INT_ARRAY,
+               &_mmcamcorder_enum_conv_rotation_ctrl,
+       },
+       {
+               CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
                MM_CAM_CAMERA_DIGITAL_ZOOM,
                MM_CAMCORDER_ATTR_NONE,
@@ -385,7 +423,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_RANGE,
                NULL,
        },
-       {
+       { /* 20 */
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
                MM_CAM_CAMERA_OPTICAL_ZOOM,
@@ -403,7 +441,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_ARRAY,
                &_mmcamcorder_enum_conv_focus_mode,
        },
-       { /* 20 */
+       {
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
                MM_CAM_CAMERA_AF_SCAN_RANGE,
@@ -448,7 +486,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_ARRAY,
                NULL,
        },
-       { /* 25 */
+       {
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
                MM_CAM_CAMERA_ISO,
@@ -475,7 +513,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_ARRAY,
                &_mmcamcorder_enum_conv_ahs,
        },
-       {
+       { /* 30 */
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_CAPTURE,
                MM_CAM_CAPTURE_FORMAT,
@@ -493,7 +531,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_RANGE,
                NULL,
        },
-       { /* 30 */
+       {
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_CAPTURE,
                MM_CAM_CAPTURE_COUNT,
@@ -538,7 +576,7 @@ static _MMCamcorderInfoConverting   g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                MM_CAMCONVERT_TYPE_INT_RANGE,
                NULL,
        },
-       { /* 35 */
+       {
                CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_DETECT,
                MM_CAM_DETECT_SELECT_NUMBER,
@@ -558,24 +596,6 @@ static _MMCamcorderInfoConverting  g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
        },
        {
                CONFIGURE_TYPE_CTRL,
-               CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
-               MM_CAM_CAMERA_FACE_ZOOM_MODE,
-               MM_CAMCORDER_ATTR_NONE,
-               "FaceZoomMode",
-               MM_CAMCONVERT_TYPE_INT_ARRAY,
-               NULL,
-       },
-       {
-               CONFIGURE_TYPE_CTRL,
-               CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
-               MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
-               MM_CAMCORDER_ATTR_NONE,
-               "FaceZoomLevel",
-               MM_CAMCONVERT_TYPE_INT_RANGE,
-               NULL,
-       },
-       {
-               CONFIGURE_TYPE_CTRL,
                CONFIGURE_CATEGORY_CTRL_CAMERA,
                MM_CAM_RECOMMEND_CAMERA_WIDTH,
                MM_CAM_RECOMMEND_CAMERA_HEIGHT,
@@ -591,6 +611,15 @@ static _MMCamcorderInfoConverting  g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
                "VideoStabilization",
                MM_CAMCONVERT_TYPE_INT_ARRAY,
                &_mmcamcorder_enum_conv_video_stabilization,
+       },
+       {
+               CONFIGURE_TYPE_CTRL,
+               CONFIGURE_CATEGORY_CTRL_CAMERA,
+               MM_CAM_VIDEO_WIDTH,
+               MM_CAM_VIDEO_HEIGHT,
+               "VideoResolution",
+               MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
+               NULL,
        }
 };
 
@@ -671,7 +700,7 @@ int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int se
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        info = hcamcorder->caminfo_convert;
-       
+
        for( i = 0 ; i < size ; i++ )
        {
                if( info[i].attr_idx == attr_idx )
@@ -716,36 +745,32 @@ __mmcamcorder_get_valid_array(int * original_array, int original_count, int ** v
        int i = 0;
        int valid_count = 0;
        int new_default = _MMCAMCORDER_SENSOR_ENUM_NONE;
-       
-       for (i = 0; i < original_count; i++)
-       {
-               if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE)
+
+       for (i = 0; i < original_count; i++) {
+               if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) {
                        valid_count++;
+               }
        }
 
-       if (valid_count > 0)
-       {
+       if (valid_count > 0) {
                *valid_array = (int*)malloc(sizeof(int) * valid_count);
 
                valid_count = 0;
-               for (i = 0; i < original_count; i++)
-               {
-                       if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE)
-                       {
+               for (i = 0; i < original_count; i++) {
+                       if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) {
                                (*valid_array)[valid_count++] = i;
                                //_mmcam_dbg_log( "valid_array[%d] = %d", valid_count-1, (*valid_array)[valid_count-1] );
 
-                               if( original_array[i] == *valid_default )
-                               {
+                               if (original_array[i] == *valid_default &&
+                                   new_default == _MMCAMCORDER_SENSOR_ENUM_NONE) {
                                        new_default = i;
                                        //_mmcam_dbg_log( "converted MSL default[%d]", new_default );
                                }
                        }
-               }               
+               }
        }
 
-       if( new_default != _MMCAMCORDER_SENSOR_ENUM_NONE )
-       {
+       if (new_default != _MMCAMCORDER_SENSOR_ENUM_NONE) {
                *valid_default = new_default;
        }
 
@@ -779,6 +804,7 @@ int _mmcamcorder_init_attr_from_configure(MMHandleType handle)
        info = g_display_info;
        table_size = sizeof(g_display_info) / sizeof(_MMCamcorderInfoConverting);
        ret = __mmcamcorder_set_info_to_attr( handle, info, table_size );
+
        _mmcam_dbg_log( "result: %x", ret );
 
        return ret;
@@ -790,7 +816,8 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        MMHandleType     attrs      = 0;
 
-       int i;
+       int i = 0;
+       int ret = MM_ERROR_NONE;
 
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
@@ -801,8 +828,6 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
 
        for (i = 0; i < table_size ; i++ )
        {
-               int ret = MM_ERROR_NONE;
-
                /*
                _mmcam_dbg_log( "%d,%d,%d,%d,%s,%d",
                                info[i].type,
@@ -816,29 +841,27 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                if( info[i].type == CONFIGURE_TYPE_MAIN )
                {
                        conf_info = hcamcorder->conf_main;
-                       _mmcam_dbg_log( "MAIN configure [%s]", info[i].keyword );
+                       /*_mmcam_dbg_log( "MAIN configure [%s]", info[i].keyword );*/
                }
                else
                {
                        conf_info = hcamcorder->conf_ctrl;
-                       _mmcam_dbg_log( "CTRL configure [%s]", info[i].keyword );
+                       /*_mmcam_dbg_log( "CTRL configure [%s]", info[i].keyword );*/
                }
 
                switch(info[i].conv_type)
                {
                        case MM_CAMCONVERT_TYPE_INT:
                        {
-                               int iarray = (int)NULL;
+                               int ivalue = 0;
 
-                               if (!_mmcamcorder_conf_get_value_int( conf_info, info[i].category, info[i].keyword, &iarray ))
+                               if (!_mmcamcorder_conf_get_value_int(handle, conf_info, info[i].category, info[i].keyword, &ivalue))
                                {
                                        ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
                                        break;          //skip to set
                                }
 
-                               ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, iarray);
-
-                               //_mmcam_dbg_log("INT . m:%d, s:%d, arr=%d", info[i].main_key, info[i].sub_key1, iarray);
+                               ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, ivalue);
                                break;
                        }
                        case MM_CAMCONVERT_TYPE_INT_ARRAY:
@@ -857,7 +880,7 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                                if( tarray )
                                {
                                        idefault = tarray->default_value;
-                                       
+
                                        if( info[i].enum_convert )
                                        {
                                                iarray_size = __mmcamcorder_get_valid_array(tarray->value, tarray->count, &iarray, &idefault);
@@ -871,12 +894,13 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                                        if( iarray_size > 0 )
                                        {
                                                /*
-                                               _mmcam_dbg_log("INT Array. m:%d, s:%d, arr=%x, size=%d, default=%d", 
-                                                               info[i].main_key, info[i].sub_key1, iarray, iarray_size, idefault);
+                                               _mmcam_dbg_log("INT Array. attr idx=%d array=%p, size=%d, default=%d",
+                                                              info[i].attr_idx, iarray, iarray_size, idefault);
                                                */
-                                               
-                                               mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
-                                               mmf_attrs_set_valid_array(attrs,  info[i].attr_idx, iarray, iarray_size, idefault);
+
+                                               /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+                                               //mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+                                               mmf_attrs_set_valid_array(attrs, info[i].attr_idx, iarray, iarray_size, idefault);
                                        }
 
                                        ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, idefault);
@@ -900,8 +924,8 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                                if( irange )
                                {
                                        //_mmcam_dbg_log("INT Range. m:%d, s:%d, min=%d, max=%d", info[i].main_key, info[i].sub_key1, irange->min, irange->max);
-                               
-                                       mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
+                                       /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+                                       //mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
                                        mmf_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max, irange->default_value);
 
                                        ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, irange->default_value);
@@ -911,10 +935,10 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                        }
                        case MM_CAMCONVERT_TYPE_STRING:
                        {
-                               char* cString = NULL;
+                               const char *cString = NULL;
                                unsigned int iString_len = 0;
 
-                               if (!_mmcamcorder_conf_get_value_string(conf_info, info[i].category, info[i].keyword, &cString ))
+                               if (!_mmcamcorder_conf_get_value_string(handle, conf_info, info[i].category, info[i].keyword, &cString ))
                                {
                                        ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
                                        break;          //skip to set
@@ -934,7 +958,7 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                        {
                                type_int_pair_array *pair_array = NULL;
 
-                               //_mmcam_dbg_log("INT PAIR Array. type:%d, attr_idx:%d, attr_idx_pair:%d", info[i].type, info[i].attr_idx, info[i].attr_idx_pair);
+                               /*_mmcam_dbg_log("INT PAIR Array. type:%d, attr_idx:%d, attr_idx_pair:%d", info[i].type, info[i].attr_idx, info[i].attr_idx_pair);*/
 
                                if (!_mmcamcorder_conf_get_value_int_pair_array(conf_info, info[i].category, info[i].keyword, &pair_array))
                                {
@@ -944,12 +968,14 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
 
                                if( pair_array && pair_array->count > 0 )
                                {
-                                       mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+                                       /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+                                       //mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
                                        mmf_attrs_set_valid_array(attrs, info[i].attr_idx,
                                                                  pair_array->value[0],
                                                                  pair_array->count,
                                                                  pair_array->default_value[0]);
-                                       mmf_attrs_set_valid_type(attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+                                       /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+                                       //mmf_attrs_set_valid_type(attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY);
                                        mmf_attrs_set_valid_array(attrs, info[i].attr_idx_pair,
                                                                  pair_array->value[1],
                                                                  pair_array->count,
@@ -966,16 +992,11 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting
                                _mmcam_dbg_log("default : s:%d", info[i].attr_idx);
                                break;
                }
-               
-               if (ret != MM_ERROR_NONE)
-               {
-                       _mmcam_dbg_warn("Setting error. ( s:%d, ret:%x)", info[i].attr_idx, ret);
-               }
        }
 
-       if (mmf_attrs_commit(attrs) == -1)
+       if (ret != MM_ERROR_NONE || mmf_attrs_commit(attrs) == -1)
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
-       else    
+       else
                return MM_ERROR_NONE;
 }
 
@@ -1019,6 +1040,8 @@ int _mmcamcorder_init_convert_table(MMHandleType handle)
        memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]), &_mmcamcorder_enum_conv_ae_type, enum_conv_size);
        memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]), &_mmcamcorder_enum_conv_strobe_mode, enum_conv_size);
        memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WDR]), &_mmcamcorder_enum_conv_wdr_ctrl, enum_conv_size);
+       memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]), &_mmcamcorder_enum_conv_flip_ctrl, enum_conv_size);
+       memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]), &_mmcamcorder_enum_conv_rotation_ctrl, enum_conv_size);
        memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]), &_mmcamcorder_enum_conv_ahs, enum_conv_size);
        memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]), &_mmcamcorder_enum_conv_video_stabilization, enum_conv_size);
 
@@ -1032,6 +1055,8 @@ int _mmcamcorder_init_convert_table(MMHandleType handle)
        _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]));
        _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]));
        _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]));
+       _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]));
+       _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]));
        _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]));
        _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]));
 
@@ -1051,6 +1076,10 @@ int _mmcamcorder_init_convert_table(MMHandleType handle)
                                        hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]);
                                } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WDR")) {
                                        hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]);
+                               } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Flip")) {
+                                       hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]);
+                               } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Rotation")) {
+                                       hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]);
                                }
                                break;
                        case CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH:
index 28dc21f..b69b3ad 100644 (file)
@@ -24,7 +24,6 @@
 =======================================================================================*/
 #include <mm_sound.h>
 #include <mm_sound_private.h>
-#include <avsystem.h>
 #include <audio-session-manager.h>
 #include "mm_camcorder_internal.h"
 #include "mm_camcorder_sound.h"
 /*---------------------------------------------------------------------------------------
 |    LOCAL VARIABLE DEFINITIONS for internal                                           |
 ---------------------------------------------------------------------------------------*/
-#define SAMPLE_SOUND_NAME       "camera-shutter"
 #define SAMPLE_SOUND_RATE       44100
-#define DEFAULT_ACTIVE_DEVICE   -1
-
-enum {
-       SOUND_DEVICE_TYPE_SPEAKER,              /* AVSYS_AUDIO_LVOL_DEV_TYPE_SPK */
-       SOUND_DEVICE_TYPE_HEADSET,              /* AVSYS_AUDIO_LVOL_DEV_TYPE_HEADSET */
-       SOUND_DEVICE_TYPE_BTHEADSET,    /* AVSYS_AUDIO_LVOL_DEV_TYPE_BTHEADSET */
-       SOUND_DEVICE_TYPE_NUM                   /* AVSYS_AUDIO_LVOL_DEV_TYPE_MAX */
-};
+#define DEFAULT_ACTIVE_DEVICE   0xffffffff
 
 /*---------------------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                |
 ---------------------------------------------------------------------------------------*/
 static void __solo_sound_callback(void *data);
 
+static void __pulseaudio_play_sample_cb(pa_context *pulse_context, uint32_t stream_index, void *user_data)
+{
+       SOUND_INFO *info = NULL;
+
+       mmf_return_if_fail(user_data);
+
+       info = (SOUND_INFO *)user_data;
+
+       _mmcam_dbg_log("START - idx : %d", stream_index);
+
+       pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
+
+       _mmcam_dbg_log("DONE");
+
+       return;
+}
 
 static void __pulseaudio_context_state_cb(pa_context *pulse_context, void *user_data)
 {
@@ -128,6 +135,8 @@ static void __pulseaudio_stream_write_cb(pa_stream *stream, size_t length, void
        }
 
        _mmcam_dbg_log("DONE read_length %d", read_length);
+
+       return;
 }
 
 
@@ -144,6 +153,8 @@ static void __pulseaudio_remove_sample_finish_cb(pa_context *pulse_context, int
        pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
 
        _mmcam_dbg_log("DONE");
+
+       return;
 }
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
@@ -160,6 +171,7 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle)
        mm_sound_device_in device_in;
        mm_sound_device_out device_out;
        pa_mainloop_api *api = NULL;
+       int error = PA_ERR_INTERNAL;
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
 
@@ -169,7 +181,8 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle)
                                          NULL);
        _mmcam_dbg_log("Capture sound enable %d", sound_enable);
        if (!sound_enable) {
-               return TRUE;
+               _mmcam_dbg_warn("capture sound disabled");
+               return FALSE;
        }
 
        info = &(hcamcorder->snd_info);
@@ -208,36 +221,42 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle)
        }
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
-               int errorcode;
-               ASM_resource_t mm_resource = mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-
-               /* set EXCLUSIVE session as PLAYING to pause other session */
-               if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
-                                        ASM_STATE_PLAYING, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
-                       ret = MM_ERROR_POLICY_BLOCKED;
-                       goto SOUND_INIT_ERROR;
-               }
-
-               _mmcam_dbg_log("EXCLUSIVE session PLAYING done.");
-       } else {
-               _mmcam_dbg_log("do not register session to pause another playing session");
-       }
-
        /**
         * Init Pulseaudio thread
         */
        /* create pulseaudio mainloop */
        info->pulse_mainloop = pa_threaded_mainloop_new();
+       if (info->pulse_mainloop == NULL) {
+               _mmcam_dbg_err("pa_threaded_mainloop_new failed");
+               goto SOUND_INIT_ERROR;
+       }
+
+       /* start PA mainloop */
        ret = pa_threaded_mainloop_start(info->pulse_mainloop);
+       if (ret < 0) {
+               _mmcam_dbg_err("pa_threaded_mainloop_start failed");
+               goto SOUND_INIT_ERROR;
+       }
 
        /* lock pulseaudio thread */
        pa_threaded_mainloop_lock(info->pulse_mainloop);
+
        /* get pulseaudio api */
        api = pa_threaded_mainloop_get_api(info->pulse_mainloop);
+       if (api == NULL) {
+               _mmcam_dbg_err("pa_threaded_mainloop_get_api failed");
+               pa_threaded_mainloop_unlock(info->pulse_mainloop);
+               goto SOUND_INIT_ERROR;
+       }
+
        /* create pulseaudio context */
        info->pulse_context = pa_context_new(api, NULL);
+       if (info->pulse_context == NULL) {
+               _mmcam_dbg_err("pa_context_new failed");
+               pa_threaded_mainloop_unlock(info->pulse_mainloop);
+               goto SOUND_INIT_ERROR;
+       }
+
        /* set pulseaudio context callback */
        pa_context_set_state_callback(info->pulse_context, __pulseaudio_context_state_cb, info);
 
@@ -302,37 +321,58 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle)
        /* wait for upload completion */
        pa_threaded_mainloop_wait(info->pulse_mainloop);
 
-       pa_threaded_mainloop_unlock (info->pulse_mainloop);
+       pa_threaded_mainloop_unlock(info->pulse_mainloop);
 
        /* close sndfile */
        sf_close(info->infile);
        info->infile = NULL;
-#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+       if (info->sample_stream) {
+               pa_stream_connect_playback(info->sample_stream, NULL, NULL, 0, NULL, NULL);
 
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
-               /* backup current route */
-               info->active_out_backup = DEFAULT_ACTIVE_DEVICE;
+               for (;;) {
+                       pa_stream_state_t state = pa_stream_get_state(info->sample_stream);
 
-               __ta__("        mm_sound_get_active_device",
-               ret = mm_sound_get_active_device(&device_in, &device_out);
-               );
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
-                       goto SOUND_INIT_ERROR;
+                       if (state == PA_STREAM_READY) {
+                               _mmcam_dbg_warn("device READY done");
+                               break;
+                       }
+
+                       if (!PA_STREAM_IS_GOOD(state)) {
+                               error = pa_context_errno(info->pulse_context);
+                               _mmcam_dbg_err("pa context state is not good, %d", error);
+                               break;
+                       }
+
+                       /* Wait until the stream is ready */
+                       pa_threaded_mainloop_wait(info->pulse_mainloop);
                }
+       }
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
-               _mmcam_dbg_log("current out [%x]", device_out);
+       /* backup current route */
+       info->active_out_backup = DEFAULT_ACTIVE_DEVICE;
 
-               if (device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
-                       ret = mm_sound_set_active_route (MM_SOUND_ROUTE_OUT_SPEAKER);
-                       if (ret != MM_ERROR_NONE) {
-                               _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret);
-                               goto SOUND_INIT_ERROR;
-                       }
-                       info->active_out_backup = device_out;
+       ret = mm_sound_get_active_device(&device_in, &device_out);
+       if (ret != MM_ERROR_NONE) {
+               _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
+               goto SOUND_INIT_ERROR;
+       }
+
+       _mmcam_dbg_log("current out [%x]", device_out);
+
+       if (device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
+               //ret = mm_sound_set_active_route_without_broadcast (MM_SOUND_ROUTE_OUT_SPEAKER);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("mm_sound_set_active_route_without_broadcast failed [%x]. skip sound play.", ret);
+                       goto SOUND_INIT_ERROR;
                }
+               info->active_out_backup = device_out;
        }
 
+       //info->volume_type = PA_TIZEN_AUDIO_VOLUME_TYPE_FIXED;
+       info->volume_level = 0;
+
        info->state = _MMCAMCORDER_SOUND_STATE_INIT;
 
        _mmcam_dbg_log("init DONE");
@@ -355,6 +395,8 @@ SOUND_INIT_ERROR:
 
        /* remove pulse mainloop */
        if (info->pulse_mainloop) {
+               pa_threaded_mainloop_lock(info->pulse_mainloop);
+
                /* remove pulse context */
                if (info->pulse_context) {
 #ifdef _MMCAMCORDER_UPLOAD_SAMPLE
@@ -368,6 +410,13 @@ SOUND_INIT_ERROR:
                                /* Wait for async operation */
                                pa_threaded_mainloop_wait(info->pulse_mainloop);
                        }
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+                       /* release sample stream */
+                       if (info->sample_stream) {
+                               pa_stream_disconnect(info->sample_stream);
+                               pa_stream_unref(info->sample_stream);
+                               info->sample_stream = NULL;
+                       }
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
                        /* Make sure we don't get any further callbacks */
@@ -378,6 +427,8 @@ SOUND_INIT_ERROR:
                        info->pulse_context = NULL;
                }
 
+               pa_threaded_mainloop_unlock(info->pulse_mainloop);
+
                pa_threaded_mainloop_stop(info->pulse_mainloop);
                pa_threaded_mainloop_free(info->pulse_mainloop);
                info->pulse_mainloop = NULL;
@@ -393,31 +444,25 @@ SOUND_INIT_ERROR:
 }
 
 
-gboolean _mmcamcorder_sound_play(MMHandleType handle)
+gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play)
 {
-       int ret = 0;
        int sound_enable = TRUE;
-       int volume_type = AVSYS_AUDIO_VOLUME_TYPE_FIXED;
-       int device_type = SOUND_DEVICE_TYPE_SPEAKER;
-       int left_volume = 0, right_volume = 0;
-       float left_gain = 1.0f, right_gain = 1.0f;
-       int set_volume = 0;
-       int max_level = 0;
-       unsigned int volume_level;
+       int gain_type = VOLUME_GAIN_SHUTTER1;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        SOUND_INFO *info = NULL;
        pa_operation *pulse_op = NULL;
 
-       mmf_return_val_if_fail(hcamcorder, FALSE);
+       mmf_return_val_if_fail(hcamcorder && sample_name, FALSE);
 
        /* check sound play enable */
-       ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
-                                         "capture-sound-enable", &sound_enable,
-                                         NULL);
+       mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+                                   "capture-sound-enable", &sound_enable,
+                                   NULL);
        _mmcam_dbg_log("Capture sound enable %d", sound_enable);
        if (!sound_enable) {
-               return TRUE;
+               _mmcam_dbg_warn("capture sound disabled");
+               return FALSE;
        }
 
        info = &(hcamcorder->snd_info);
@@ -430,66 +475,41 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle)
                return FALSE;
        }
 
-       /* get volume level and set volume */
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_OFF) {
-               gboolean sound_status = hcamcorder->sub_context->info_image->sound_status;
-               mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
-               mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
-
-               volume_type = AVSYS_AUDIO_VOLUME_TYPE_MEDIA;
-               avsys_audio_get_volume_max_ex(volume_type, &max_level);
-
-               /* get sound path */
-               __ta__("                    mm_sound_get_active_device",
-               mm_sound_get_active_device(&device_in, &device_out);
-               );
-
-               _mmcam_dbg_log("sound status %d, device out %x", sound_status, device_out);
+       if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE)) {
+               gain_type = VOLUME_GAIN_SHUTTER2;
+       } else if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP)) {
+               gain_type = VOLUME_GAIN_CAMCORDING;
+       }
 
-               if (device_out == MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY) {
-                       device_type = SOUND_DEVICE_TYPE_HEADSET;
-               } else if (device_out == MM_SOUND_DEVICE_OUT_BT_A2DP) {
-                       device_type = SOUND_DEVICE_TYPE_BTHEADSET;
-               }
+       _mmcam_dbg_log("Play start - sample name [%s]", sample_name);
 
-               if (sound_status || device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
-                       volume_level = hcamcorder->sub_context->info_image->volume_level;
-                       _mmcam_dbg_log("current volume level %d", volume_level);
-               } else {
-                       volume_level = 0;
-                       _mmcam_dbg_log("current state is SILENT mode and SPEAKER output");
-               }
+       if (sync_play) {
+               pa_threaded_mainloop_lock(info->pulse_mainloop);
+/*
+               pulse_op = pa_ext_policy_play_sample(info->pulse_context,
+                                                 sample_name,
+                                                 info->volume_type,
+                                                 gain_type,
+                                                 info->volume_level,
+                                                 __pulseaudio_play_sample_cb,
+                                                 info);
+*/
+               _mmcam_dbg_log("wait for signal");
+               pa_threaded_mainloop_wait(info->pulse_mainloop);
+               _mmcam_dbg_log("received signal");
 
-               if (volume_level > (unsigned int)max_level) {
-                       _mmcam_dbg_warn("invalid volume level. set max");
-                       volume_level = (unsigned int)max_level;
-               }
+               pa_threaded_mainloop_unlock(info->pulse_mainloop);
        } else {
-               avsys_audio_get_volume_max_ex(volume_type, &max_level);
-               volume_level = (unsigned int)max_level;
+/*
+               pulse_op = pa_ext_policy_play_sample(info->pulse_context,
+                                                 sample_name,
+                                                 info->volume_type,
+                                                 gain_type,
+                                                 info->volume_level,
+                                                 NULL,
+                                                 NULL);
+*/
        }
-
-       avsys_audio_get_volume_table(volume_type, device_type, (int)volume_level, &left_volume, &right_volume);
-       avsys_audio_get_volume_gain_table(
-               AVSYS_AUDIO_VOLUME_GAIN_IDX(AVSYS_AUDIO_VOLUME_GAIN_SHUTTER2),
-               device_type, &left_gain, &right_gain);
-       set_volume = left_volume * left_gain;
-       _mmcam_dbg_log("volume type %d, device type %d, volume level %d, left volume %d left gain %.2f set_volume %d",
-                                       volume_type, device_type, volume_level, left_volume, left_gain, set_volume);
-
-       _mmcam_dbg_log("shutter sound policy %d, volume %d",
-                      hcamcorder->shutter_sound_policy, set_volume);
-
-       _mmcam_dbg_log("Play start");
-
-       __ta__("                    pa_context_play_sample",
-       pulse_op = pa_context_play_sample(info->pulse_context,
-                                         SAMPLE_SOUND_NAME,
-                                         NULL,
-                                         set_volume,
-                                         NULL,
-                                         NULL);
-       );
        if (pulse_op) {
                pa_operation_unref(pulse_op);
                pulse_op = NULL;
@@ -525,43 +545,43 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle)
                return TRUE;
        }
 
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
-               /**
-                * Restore route
-                */
-               _mmcam_dbg_log("restore route");
-               if (info->active_out_backup != DEFAULT_ACTIVE_DEVICE) {
-                       ret = mm_sound_get_active_device(&device_in, &device_out);
-                       if (ret != MM_ERROR_NONE) {
-                               _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
-                       }
+       /* Restore route */
+       _mmcam_dbg_log("restore route");
+       if (info->active_out_backup != DEFAULT_ACTIVE_DEVICE) {
+               ret = mm_sound_get_active_device(&device_in, &device_out);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("mm_sound_get_active_device failed [%x]", ret);
+               }
 
-                       _mmcam_dbg_log("current out [%x]", device_out);
+               _mmcam_dbg_log("current out [%x]", device_out);
 
-                       if (device_out != info->active_out_backup) {
-                               ret = mm_sound_set_active_route (info->active_out_backup);
-                               if (ret != MM_ERROR_NONE) {
-                                       _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret);
-                               }
+               if (device_out != info->active_out_backup) {
+                       //ret = mm_sound_set_active_route_without_broadcast (info->active_out_backup);
+                       if (ret != MM_ERROR_NONE) {
+                               _mmcam_dbg_err("mm_sound_set_active_route_without_broadcast [%x]", ret);
                        }
                }
        }
 
+       pa_threaded_mainloop_lock(info->pulse_mainloop);
+
 #ifdef _MMCAMCORDER_UPLOAD_SAMPLE
        /**
         * Remove sample
         */
        _mmcam_dbg_log("remove sample");
 
-       pa_threaded_mainloop_lock(info->pulse_mainloop);
-
        /* Remove sample (ASYNC) */
        pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info));
 
        /* Wait for async operation */
        pa_threaded_mainloop_wait(info->pulse_mainloop);
-
-       pa_threaded_mainloop_unlock(info->pulse_mainloop);
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+       if (info->sample_stream) {
+               pa_stream_disconnect(info->sample_stream);
+               pa_stream_unref(info->sample_stream);
+               info->sample_stream = NULL;
+       }
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
        /**
@@ -569,8 +589,6 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle)
         */
        _mmcam_dbg_log("release pulseaudio thread");
 
-       pa_threaded_mainloop_lock(info->pulse_mainloop);
-
        pa_context_disconnect(info->pulse_context);
 
        /* Make sure we don't get any further callbacks */
@@ -600,19 +618,6 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle)
        pthread_mutex_destroy(&(info->play_mutex));
        pthread_cond_destroy(&(info->play_cond));
 
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
-               int errorcode = 0;
-               ASM_resource_t mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-
-               /* stop EXCLUSIVE session */
-               if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
-                                        ASM_STATE_STOP, mm_resource, &errorcode)) {
-                       _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", errorcode);
-               } else {
-                       _mmcam_dbg_log("EXCLUSIVE session STOP done.");
-               }
-       }
-
        pthread_mutex_unlock(&(info->open_mutex));
 
        _mmcam_dbg_err("DONE");
@@ -621,40 +626,21 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle)
 }
 
 
-gboolean _mmcamcorder_sound_capture_play_cb(gpointer data)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data);
-
-       mmf_return_val_if_fail(hcamcorder, FALSE);
-
-       _mmcam_dbg_log("Capture sound PLAY in idle callback");
-
-       _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
-
-       return FALSE;
-}
-
-
-void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gboolean sync)
+void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gboolean sync_play)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
        int sound_handle = 0;
        int ret = MM_ERROR_NONE;
        int sound_enable = TRUE;
+       int sound_played = FALSE;
        int gain_type = VOLUME_GAIN_SHUTTER1;
 
        mmf_return_if_fail(filepath && hcamcorder);
 
        _mmcam_dbg_log("START : %s", filepath);
 
-       ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
-                                         "capture-sound-enable", &sound_enable,
-                                         NULL);
-       _mmcam_dbg_log("Capture sound enable %d", sound_enable);
-       if (!sound_enable) {
-               return;
-       }
+       _mmcamcorder_sound_solo_play_wait(handle);
 
        ret = pthread_mutex_trylock(&(hcamcorder->sound_lock));
        if (ret != 0) {
@@ -663,43 +649,54 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo
        }
 
        /* check filename to set gain_type */
-       if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE_SND)) {
-               gain_type = VOLUME_GAIN_SHUTTER1;
+       if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE_SND) ||
+           !strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND)) {
+               if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND)) {
+                       gain_type = VOLUME_GAIN_CAMCORDING;
+               } else {
+                       gain_type = VOLUME_GAIN_SHUTTER1;
+               }
        } else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE2_SND)) {
                gain_type = VOLUME_GAIN_SHUTTER2;
-       } else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND) ||
-                  !strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_STOP_SND)) {
+       } else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_STOP_SND)) {
                gain_type = VOLUME_GAIN_CAMCORDING;
        }
 
        _mmcam_dbg_log("gain type 0x%x", gain_type);
 
-       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
-               __ta__("CAPTURE SOUND:mm_sound_play_loud_solo_sound",
-               ret = mm_sound_play_loud_solo_sound(filepath, VOLUME_TYPE_FIXED | gain_type,
-                                                   __solo_sound_callback, (void*)hcamcorder, &sound_handle);
-               );
-       } else {
-               gboolean sound_status = hcamcorder->sub_context->info_image->sound_status;
-               mm_sound_device_in device_in;
-               mm_sound_device_out device_out;
+       ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+                                         "capture-sound-enable", &sound_enable,
+                                         NULL);
+       _mmcam_dbg_log("Capture sound enable %d", sound_enable);
 
-               /* get sound path */
-               mm_sound_get_active_device(&device_in, &device_out);
+       if (!sound_enable) {
+               /* send capture sound completed message */
+               pthread_mutex_unlock(&(hcamcorder->sound_lock));
+               return;
+       }
 
-               _mmcam_dbg_log("sound status %d, device out %x", sound_status, device_out);
 
-               if (sound_status || device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
-                       __ta__("CAPTURE SOUND:mm_sound_play_sound",
-                       ret = mm_sound_play_sound(filepath, VOLUME_TYPE_MEDIA | gain_type,
-                                                 __solo_sound_callback, (void*)hcamcorder, &sound_handle);
-                       );
-               }
+       if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON ||
+           hcamcorder->sub_context->info_image->sound_status) {
+               ret = mm_sound_play_loud_solo_sound(filepath, VOLUME_TYPE_FIXED | gain_type,
+                                                   (mm_sound_stop_callback_func)__solo_sound_callback, (void*)hcamcorder, &sound_handle);
+               sound_played = TRUE;
+       } else {
+               _mmcam_dbg_warn("skip shutter sound");
        }
+
+       _mmcam_dbg_log("sync_play %d, sound_played %d, ret 0x%x", sync_play, sound_played, ret);
+
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_err( "Capture sound play FAILED.[%x]", ret );
        } else {
-               if (sync) {
+               if (sound_played) {
+                       /* increase capture sound count */
+                       hcamcorder->capture_sound_count++;
+               }
+
+               /* wait for sound completed signal */
+               if (sync_play && sound_played) {
                        struct timespec timeout;
                        struct timeval tv;
 
@@ -709,8 +706,6 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo
 
                        _mmcam_dbg_log("Wait for signal");
 
-                       MMTA_ACUM_ITEM_BEGIN("CAPTURE SOUND:wait sound play finish", FALSE);
-
                        if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
                                _mmcam_dbg_log("signal received.");
                        } else {
@@ -719,8 +714,6 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo
                                        mm_sound_stop_sound(sound_handle);
                                }
                        }
-
-                       MMTA_ACUM_ITEM_END("CAPTURE SOUND:wait sound play finish", FALSE);
                }
        }
 
@@ -739,6 +732,16 @@ static void __solo_sound_callback(void *data)
 
        _mmcam_dbg_log("START");
 
+       /* decrease capture sound count */
+       pthread_mutex_lock(&(hcamcorder->sound_lock));
+       if (hcamcorder->capture_sound_count > 0) {
+               hcamcorder->capture_sound_count--;
+       } else {
+               _mmcam_dbg_warn("invalid capture_sound_count %d, reset count", hcamcorder->capture_sound_count);
+               hcamcorder->capture_sound_count = 0;
+       }
+       pthread_mutex_unlock(&(hcamcorder->sound_lock));
+
        _mmcam_dbg_log("Signal SEND");
        pthread_cond_broadcast(&(hcamcorder->sound_cond));
 
@@ -747,3 +750,38 @@ static void __solo_sound_callback(void *data)
        return;
 }
 
+
+void _mmcamcorder_sound_solo_play_wait(MMHandleType handle)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       mmf_return_if_fail(hcamcorder);
+
+       _mmcam_dbg_log("START");
+
+       /* check playing sound count */
+       pthread_mutex_lock(&(hcamcorder->sound_lock));
+       if (hcamcorder->capture_sound_count > 0) {
+               struct timespec timeout;
+               struct timeval tv;
+
+               gettimeofday( &tv, NULL );
+               timeout.tv_sec = tv.tv_sec + 2;
+               timeout.tv_nsec = tv.tv_usec * 1000;
+
+               _mmcam_dbg_log("Wait for signal");
+
+               if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
+                       _mmcam_dbg_log("signal received.");
+               } else {
+                       _mmcam_dbg_warn("capture sound play timeout.");
+               }
+       } else {
+               _mmcam_dbg_warn("no playing sound - count %d", hcamcorder->capture_sound_count);
+       }
+       pthread_mutex_unlock(&(hcamcorder->sound_lock));
+
+       _mmcam_dbg_log("DONE");
+
+       return;
+}
index 74c7120..b352337 100644 (file)
 #include "mm_camcorder_stillshot.h"
 #include "mm_camcorder_exifinfo.h"
 #include "mm_camcorder_exifdef.h"
+#include <libexif/exif-loader.h>
+#include <libexif/exif-utils.h>
+#include <libexif/exif-data.h>
 
 /*---------------------------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS for internal                                          |
 ---------------------------------------------------------------------------------------*/
 #define EXIF_SET_ERR( return_type,tag_id) \
        _mmcam_dbg_err("error=%x,tag=%x",return_type,tag_id); \
-       if (return_type == MM_ERROR_CAMCORDER_LOW_MEMORY) { \
+       if (return_type == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) { \
                goto exit; \
        }
 
 ---------------------------------------------------------------------------------------*/
 #define THUMBNAIL_WIDTH         320
 #define THUMBNAIL_HEIGHT        240
-#define THUMBNAIL_DEFAULT_RATIO 1.34
-#define THUMBNAIL_JPEG_QUALITY  50
+#define THUMBNAIL_JPEG_QUALITY  90
 #define TRY_LOCK_MAX_COUNT      100
-#define TRY_LOCK_TIME           50000   /* ms */
+#define TRY_LOCK_TIME           20000   /* ms */
+#define H264_PREVIEW_BITRATE    1024*10 /* kbps */
+#define H264_PREVIEW_NEWGOP_INTERVAL    1000 /* ms */
+#define _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
 
 
 /*---------------------------------------------------------------------------------------
@@ -61,9 +66,6 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle);
 int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle);
 static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sample1, GstSample *sample2, GstSample *sample3, gpointer u_data);
 
-/* Function for JPEG capture with Encode bin */
-static gboolean        __mmcamcorder_encodesink_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data);
-
 /* sound status changed callback */
 static void __sound_status_changed_cb(keynode_t* node, void *data);
 static void __volume_level_changed_cb(void* user_data);
@@ -77,78 +79,60 @@ static void __volume_level_changed_cb(void* user_data);
 ---------------------------------------------------------------------------------------*/
 
 
-int _mmcamcorder_add_stillshot_pipeline(MMHandleType handle)
+int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle)
 {
        int err = MM_ERROR_UNKNOWN;
-
        GstPad *srcpad = NULL;
        GstPad *sinkpad = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       _MMCamcorderImageInfo *info = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       info = sc->info_image;
-
        _mmcam_dbg_log("");
 
-       /* Check main pipeline */
-       if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
-               _mmcam_dbg_err( "Main Pipeline is not existed." );
-               return MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-       }
-
        /* Create gstreamer element */
        _mmcam_dbg_log("Using Encodebin for capturing");
 
-       __ta__("        _mmcamcorder_create_encodesink_bin",
+       /* Create capture pipeline */
+       _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "capture_pipeline", err);
+
        err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_IMAGE);
-       );
        if (err != MM_ERROR_NONE) {
                return err;
        }
 
-       gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                        sc->element[_MMCAMCORDER_ENCSINK_BIN].gst,
+       /* add element and encodesink bin to encode main pipeline */
+       gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst,
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
                         NULL);
 
-       /* Link each element */
-       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
-       sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
-       _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, element_link_error)
+       /* Link each element : appsrc - capsfilter - encodesink bin */
+       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "src");
+       sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "sink");
+       _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+
+       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+       sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
+       _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
 
-       MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
+       /* connect handoff signal to get capture data */
+       MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
                                   _MMCAMCORDER_HANDLER_STILLSHOT, "handoff",
-                                  G_CALLBACK(__mmcamcorder_encodesink_handoff_callback),
+                                  G_CALLBACK(__mmcamcorder_handoff_callback),
                                   hcamcorder);
 
        return MM_ERROR_NONE;
 
-element_link_error:
-       _mmcam_dbg_err("Link encodebin failed!");
-
-       if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst != NULL) {
-               int ret = MM_ERROR_NONE;
-
-               __ta__( "        EncodeBin Set NULL",
-               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
-               );
-               _mmcam_dbg_log("encodebin _mmcamcorder_gst_set_state NULL ret[%d]", ret);
-
-               gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                              sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
-
-               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
-
-               _mmcam_dbg_log("Encodebin removed");
-       }
-
-       return MM_ERROR_CAMCORDER_GST_LINK;
+pipeline_creation_error:
+       _mmcamcorder_remove_stillshot_pipeline(handle);
+       return err;
 }
 
 
@@ -162,14 +146,14 @@ int _mmcamcorder_connect_capture_signal(MMHandleType handle)
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       /*set video source element*/
+       /* check video source element */
        if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "signal-still-capture", TRUE);
-
+               _mmcam_dbg_warn("connect capture signal to _MMCAMCORDER_VIDEOSRC_SRC");
                MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
                                           _MMCAMCORDER_HANDLER_STILLSHOT, "still-capture",
                                           G_CALLBACK(__mmcamcorder_image_capture_cb),
                                           hcamcorder);
+
                return MM_ERROR_NONE;
        } else {
                _mmcam_dbg_err("videosrc element is not created yet");
@@ -180,41 +164,43 @@ int _mmcamcorder_connect_capture_signal(MMHandleType handle)
 
 int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle)
 {
+       int ret = MM_ERROR_NONE;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       _MMCamcorderImageInfo *info = NULL;
 
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       info = sc->info_image;
-
        _mmcam_dbg_log("");
 
        /* Check pipeline */
-       if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
-               _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
+       if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+               ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("Faile to change encode main pipeline state [0x%x]", ret);
+                       return ret;
+               }
 
-               if (sc->bencbin_capture) {
-                       GstPad *srcpad = NULL, *sinkpad = NULL;
-                       if (!sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
-                               _mmcam_dbg_log("ENCSINK_BIN is already removed");
-                       } else {
-                               /* Unlink each element */
-                               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
-                               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
-                               _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
+               _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
 
-                               gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                                       sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+               GstPad *reqpad = NULL;
 
-                               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
-                       }
+               /* release request pad */
+               reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
+               if (reqpad) {
+                       gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+                       gst_object_unref(reqpad);
+                       reqpad = NULL;
                }
+
+               /* release encode main pipeline */
+               gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+
+               _mmcam_dbg_log("Encoder pipeline removed");
        } else {
-               _mmcam_dbg_log("MAIN_PIPE is already removed");
+               _mmcam_dbg_log("encode main pipeline is already removed");
        }
 
        return MM_ERROR_NONE;
@@ -223,9 +209,6 @@ int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle)
 
 void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle)
 {
-       GstPad *reqpad1 = NULL;
-       GstPad *reqpad2 = NULL;
-
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
 
@@ -237,18 +220,13 @@ void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle)
        _mmcam_dbg_log("");
 
        if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
-               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
                _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
 
                _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
 
-               reqpad1 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src0");
-               reqpad2 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src1");
-               gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad1);
-               gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad2);
-               gst_object_unref(reqpad1);
-               gst_object_unref(reqpad2);
-
                gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
                /* NULL initialization will be done in _mmcamcorder_element_release_noti */
        }
@@ -265,15 +243,14 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
        int cap_format = MM_PIXEL_FORMAT_NV12;
        int image_encoder = MM_IMAGE_CODEC_JPEG;
        int strobe_mode = MM_CAMCORDER_STROBE_MODE_OFF;
+       int is_modified_size = FALSE;
+       int tag_orientation = 0;
        unsigned int cap_fourcc = 0;
 
        char *err_name = NULL;
-       char *videosrc_name = NULL;
+       const char *videosrc_name = NULL;
 
-       GstElement *pipeline = NULL;
        GstCameraControl *control = NULL;
-       GstCaps *caps = NULL;
-       GstClock *clock = NULL;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderImageInfo *info = NULL;
@@ -288,15 +265,14 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
 
        _mmcam_dbg_log("");
 
-       pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
        info = sc->info_image;
 
-       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
                                        CONFIGURE_CATEGORY_MAIN_CAPTURE,
                                        "UseCaptureMode",
                                        &UseCaptureMode);
 
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                      "VideosrcElement",
                                      &VideosrcElement);
@@ -308,29 +284,27 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                goto cmd_error;
        }
 
-       MMTA_ACUM_ITEM_BEGIN("Real First Capture Start",false);
-
        /* get current state */
        mm_camcorder_get_state(handle, &current_state);
 
        /* set capture flag */
        info->capturing = TRUE;
 
-       mm_camcorder_get_attributes(handle, &err_name,
+       ret = mm_camcorder_get_attributes(handle, &err_name,
                                    MMCAM_IMAGE_ENCODER, &image_encoder,
                                    MMCAM_CAMERA_WIDTH, &width,
                                    MMCAM_CAMERA_HEIGHT, &height,
                                    MMCAM_CAMERA_FPS, &fps,
-                                   MMCAM_CAMERA_HDR_CAPTURE, &info->hdr_capture_mode,
                                    MMCAM_CAPTURE_FORMAT, &cap_format,
                                    MMCAM_CAPTURE_WIDTH, &info->width,
                                    MMCAM_CAPTURE_HEIGHT, &info->height,
                                    MMCAM_CAPTURE_COUNT, &info->count,
                                    MMCAM_CAPTURE_INTERVAL, &info->interval,
                                    MMCAM_STROBE_MODE, &strobe_mode,
+                                   MMCAM_TAG_ORIENTATION, &tag_orientation,
                                    NULL);
        if (err_name) {
-               _mmcam_dbg_warn("get_attributes err %s", err_name);
+               _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
                free(err_name);
                err_name = NULL;
        }
@@ -348,29 +322,41 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                info->multi_shot_stop = FALSE;
 
                /* sound init to pause other session */
-               __ta__("        _mmcamcorder_sound_init",
 #ifdef _MMCAMCORDER_UPLOAD_SAMPLE
                _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND);
 #else /* _MMCAMCORDER_UPLOAD_SAMPLE */
                _mmcamcorder_sound_init(handle);
 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
-               );
        }
 
-       _mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d)",
+       _mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d), interval (%d)",
                       width, height, info->preview_format,
                       info->width, info->height, cap_format,
-                      info->count, info->hdr_capture_mode);
+                      info->count, info->hdr_capture_mode, info->interval);
 
        /* check state */
        if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
                if (info->type == _MMCamcorder_MULTI_SHOT ||
-                   info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF ||
-                   info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-                       _mmcam_dbg_err("not support multi/HDR capture while recording or NOT ITLV format");
+                   info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF) {
+                       _mmcam_dbg_err("does not support multi/HDR capture while recording");
                        ret = MM_ERROR_CAMCORDER_INVALID_STATE;
                        goto cmd_error;
                }
+
+               /* check capture size if ZSL is not supported*/
+               if (hcamcorder->support_zsl_capture == FALSE) {
+                       _mmcam_dbg_warn("Capture size should be same with preview size while recording");
+                       _mmcam_dbg_warn("Capture size %dx%d -> %dx%d", info->width, info->height, width, height);
+
+                       info->width = width;
+                       info->height = height;
+
+                       _mmcam_dbg_log("set capture width and height [%dx%d] to camera plugin", width, height);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", width);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", height);
+
+                       is_modified_size = TRUE;
+               }
        }
 
        info->capture_cur_count = 0;
@@ -381,15 +367,16 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
        if (!sc->bencbin_capture) {
                /* Check encoding method */
                if (cap_format == MM_PIXEL_FORMAT_ENCODED) {
-                       if (sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) {
+                       if ((sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) ||
+                           (sc->SensorEncodedCapture && sc->info_video->support_dual_stream) ||
+                           is_modified_size) {
                                cap_fourcc = _mmcamcorder_get_fourcc(cap_format, image_encoder, hcamcorder->use_zero_copy_format);
-                               _mmcam_dbg_log("Sensor JPEG Capture");
+                               _mmcam_dbg_log("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size);
                        } else {
                                /* no need to encode internally if ITLV format */
                                if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
                                        sc->internal_encode = TRUE;
                                }
-
                                cap_fourcc = _mmcamcorder_get_fourcc(info->preview_format, image_encoder, hcamcorder->use_zero_copy_format);
 
                                _mmcam_dbg_log("MSL JPEG Capture : capture fourcc %c%c%c%c",
@@ -397,10 +384,6 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                        }
                } else {
                        cap_fourcc = _mmcamcorder_get_fourcc(cap_format, MM_IMAGE_CODEC_INVALID, hcamcorder->use_zero_copy_format);
-                       if (info->type == _MMCamcorder_SINGLE_SHOT && !strcmp(videosrc_name, "camerasrc")) {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE );
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE );
-                       }
                }
 
                _mmcam_dbg_log("capture format (%d)", cap_format);
@@ -409,7 +392,6 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-fourcc", cap_fourcc);
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-interval", info->interval);
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", info->count);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", info->hdr_capture_mode);
 
                if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                        _mmcam_dbg_err("Can't cast Video source into camera control.");
@@ -440,28 +422,24 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                        }
                }
 
-               /* make pipeline state as READY */
-               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("failed to set state PAUSED %x", ret);
-                       return ret;
-               }
+               if (need_change) {
+                       int rotation = 0;
 
-               /* add encodesinkbin */
-               ret = _mmcamcorder_add_stillshot_pipeline((MMHandleType)hcamcorder);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("failed to create encodesinkbin %x", ret);
-                       return ret;
-               }
+                       _mmcam_dbg_log("Need to change resolution");
 
-               /* set JPEG quality */
-               mm_camcorder_get_attributes(handle, &err_name,
-                                           MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality,
-                                           NULL);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_IENC].gst, "quality", cap_jpeg_quality);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
 
-               if (need_change) {
-                       _mmcam_dbg_log("Need to change resolution");
+                       /* make pipeline state as READY */
+                       ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+                       if (ret != MM_ERROR_NONE) {
+                               _mmcam_dbg_err("failed to set state PAUSED %x", ret);
+                               return ret;
+                       }
 
                        if (UseCaptureMode) {
                                set_width = MMFCAMCORDER_HIGHQUALITY_WIDTH;
@@ -471,41 +449,65 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
                                set_height = info->height;
                        }
 
-                       caps = gst_caps_new_simple("video/x-raw",
-                                       "format", G_TYPE_STRING, sc->format_name,
-                                                  "width", G_TYPE_INT, set_width,
-                                                  "height", G_TYPE_INT, set_height,
-                                                  "framerate", GST_TYPE_FRACTION, fps, 1,
-                                                  "rotate", G_TYPE_INT, 0,
-                                                  NULL);
-                       if (caps == NULL) {
-                               _mmcam_dbg_err("failed to create caps");
-                               ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
-                               goto cmd_error;
+                       mm_camcorder_get_attributes(handle, &err_name,
+                                                   MMCAM_CAMERA_ROTATION, &rotation,
+                                                   NULL);
+                       if (err_name) {
+                               _mmcam_dbg_warn("get_attributes err %s", err_name);
+                               free(err_name);
+                               err_name = NULL;
                        }
 
-                       info->resolution_change = TRUE;
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
-                       gst_caps_unref(caps);
+                       /* set new caps */
+                       ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, set_width, set_height, fps, rotation);
+                       if (!ret) {
+                               _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed");
+                               return MM_ERROR_CAMCORDER_INTERNAL;
+                       }
 
-                       /*MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "num-buffers", info->count);*/
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "req-negotiation",TRUE);
+                       info->resolution_change = TRUE;
 
-                       /* FIXME: consider delay */
-                       clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
-                       sc->stillshot_time = gst_clock_get_time(clock) - gst_element_get_base_time(GST_ELEMENT(pipeline));
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+                       /* make pipeline state as PLAYING */
+                       ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+                       if (ret != MM_ERROR_NONE) {
+                               _mmcam_dbg_err("failed to set state PAUSED %x", ret);
+                               return ret;
+                       }
 
                        _mmcam_dbg_log("Change to target resolution(%d, %d)", set_width, set_height);
                } else {
                        _mmcam_dbg_log("No need to change resolution. Open toggle now.");
+                       info->resolution_change = FALSE;
+               }
+
+               /* add encodesinkbin */
+               ret = _mmcamcorder_create_stillshot_pipeline((MMHandleType)hcamcorder);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("failed to create encodesinkbin %x", ret);
+                       return ret;
                }
 
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,"signal-handoffs", TRUE);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+               ret = mm_camcorder_get_attributes(handle, &err_name,
+                                                 MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality,
+                                                 NULL);
+               if (err_name) {
+                       _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
+                       free(err_name);
+                       err_name = NULL;
+               }
+
+               /* set JPEG quality */
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_IENC].gst, "quality", cap_jpeg_quality);
 
-               /* make pipeline state as PLAYING */
-               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+               /* set handoff signal as TRUE */
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,"signal-handoffs", TRUE);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+
+               /* set push encoding buffer as TRUE */
+               sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_INIT;
+
+               /* make encode pipeline state as PLAYING */
+               ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING);
                if (ret != MM_ERROR_NONE) {
                        _mmcam_dbg_err("failed to set state PLAYING %x", ret);
                        return ret;
@@ -514,12 +516,13 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle)
 
        /* Play capture sound here if single capture */
        if ((info->type == _MMCamcorder_SINGLE_SHOT &&
-            (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY || strobe_mode == MM_CAMCORDER_STROBE_MODE_OFF)) ||
+            (hcamcorder->support_zsl_capture == FALSE ||
+             strobe_mode == MM_CAMCORDER_STROBE_MODE_OFF)) ||
            info->hdr_capture_mode) {
-               if (current_state < MM_CAMCORDER_STATE_RECORDING) {
-                       __ta__("        _mmcamcorder_sound_solo_play",
+               if (current_state < MM_CAMCORDER_STATE_RECORDING &&
+                   hcamcorder->support_zsl_capture == TRUE &&
+                   !info->hdr_capture_mode) {
                        _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
-                       );
                }
 
                /* set flag */
@@ -543,20 +546,14 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
        int width = 0;
        int height = 0;
        int fps = 0;
-       int cap_width = 0;
-       int cap_height = 0;
        int rotation = 0;
-       int set_width = 0;
-       int set_height = 0;
-       int set_rotate = 0;
-       int current_framecount = 0;
+       unsigned int current_framecount = 0;
        int current_state = MM_CAMCORDER_STATE_NONE;
        gboolean fps_auto = FALSE;
        char *err_name = NULL;
-       char *videosrc_name = NULL;
+       const char *videosrc_name = NULL;
 
        GstState state;
-       GstCaps *caps = NULL;
        GstElement *pipeline = NULL;
        GstCameraControl *control = NULL;
 
@@ -570,14 +567,12 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       _mmcam_dbg_log("");
+       /*_mmcam_dbg_log("");*/
 
        pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
        info = sc->info_image;
 
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
                                      "VideosrcElement",
                                      &VideosrcElement);
@@ -598,7 +593,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
        _mmcam_dbg_log("current state [%d]", current_state);
 
        if (!sc->bencbin_capture) {
-               _mmcam_dbg_log("Capture Preview start : avsysvideosrc - No need to set new caps.");
+               _mmcam_dbg_log("Preview start");
 
                /* just set capture stop command if current state is CAPTURING */
                if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
@@ -613,10 +608,12 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
                        current_framecount = sc->kpi.video_framecount;
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
                        if (info->type == _MMCamcorder_SINGLE_SHOT) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
                                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
                        }
                } else {
                        int focus_mode = 0;
+                       mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
 
                        /* This case is starting of preview */
                        ret = mm_camcorder_get_attributes(handle, &err_name,
@@ -628,162 +625,114 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
                                SAFE_FREE (err_name);
                        }
 
+                       _mmcam_dbg_log("focus mode %d", focus_mode);
+
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto);
 
                        /* set focus mode */
-                       mm_camcorder_set_attributes(handle, NULL,
-                                                   MMCAM_CAMERA_FOCUS_MODE, focus_mode,
-                                                   NULL);
-               }
-       } else {
-               /* check if resolution need to rollback */
-               mm_camcorder_get_attributes(handle, &err_name,
-                                           MMCAM_CAMERA_WIDTH, &width,
-                                           MMCAM_CAMERA_HEIGHT, &height,
-                                           MMCAM_CAMERA_FPS, &fps,
-                                           MMCAM_CAMERA_FPS_AUTO, &fps_auto,
-                                           MMCAM_CAMERA_ROTATION, &rotation,
-                                           MMCAM_CAPTURE_WIDTH, &cap_width,
-                                           MMCAM_CAPTURE_HEIGHT, &cap_height,
-                                           NULL);
-
-               if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
-                       switch (rotation) {
-                       case MM_VIDEO_INPUT_ROTATION_90:
-                               set_width = height;
-                               set_height = width;
-                               set_rotate = 90;
-                               break;
-                       case MM_VIDEO_INPUT_ROTATION_180:
-                               set_width = width;
-                               set_height = height;
-                               set_rotate = 180;
-                               break;
-                       case MM_VIDEO_INPUT_ROTATION_270:
-                               set_width = height;
-                               set_height = width;
-                               set_rotate = 270;
-                               break;
-                       case MM_VIDEO_INPUT_ROTATION_NONE:
-                       default:
-                               set_width = width;
-                               set_height = height;
-                               set_rotate = 0;
-                               break;
-                       }
-
-                       caps = gst_caps_new_simple("video/x-raw",
-                                       "format", G_TYPE_STRING, sc->format_name,
-                                                  "width", G_TYPE_INT, set_width,
-                                                  "height", G_TYPE_INT,set_height,
-                                                  "framerate", GST_TYPE_FRACTION, fps, 1,
-                                                  "rotate", G_TYPE_INT, set_rotate,
-                                                  NULL);
-                       if (caps != NULL) {
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
-                               gst_caps_unref(caps);
-                               _mmcam_dbg_log("Rollback to original resolution(%d, %d)", width, height);
+                       if (attr) {
+                               if (_mmcamcorder_check_supported_attribute(handle, MM_CAM_CAMERA_FOCUS_MODE)) {
+                                       mmf_attribute_set_modified(&(attr->items[MM_CAM_CAMERA_FOCUS_MODE]));
+                                       if (mmf_attrs_commit((MMHandleType)attr) == -1) {
+                                               _mmcam_dbg_err("set focus mode error");
+                                       } else {
+                                               _mmcam_dbg_log("set focus mode success");
+                                       }
+                               } else {
+                                       _mmcam_dbg_log("focus mode is not supported");
+                               }
                        } else {
-                               _mmcam_dbg_err("failed to create caps");
-                               ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
-                               goto cmd_error;
+                               _mmcam_dbg_err("failed to get attributes");
                        }
                }
        }
 
+       /* init prev_time */
+       sc->info_video->prev_preview_ts = 0;
+
        gst_element_get_state(pipeline, &state, NULL, -1);
 
        if (state == GST_STATE_PLAYING) {
-               if (!strcmp(videosrc_name, "avsysvideosrc") || !strcmp(videosrc_name, "camerasrc")) {
+               if (!sc->bencbin_capture) {
                        int try_count = 0;
 
-                       if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
+                       if (hcamcorder->support_zsl_capture == FALSE) {
                                mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
 
                                /* Set strobe mode - strobe mode can not be set to driver while captuing */
                                if (attr) {
-                                       __ta__("    Set strobe mode after capture",
                                        mmf_attribute_set_modified(&(attr->items[MM_CAM_STROBE_MODE]));
                                        if (mmf_attrs_commit((MMHandleType) attr) == -1) {
                                                _mmcam_dbg_warn("Failed to set strobe mode");
                                        }
-                                       );
                                }
 
-                               __ta__("    Wait preview frame after capture",
                                while (current_framecount >= sc->kpi.video_framecount &&
                                       try_count++ < _MMCAMCORDER_CAPTURE_STOP_CHECK_COUNT) {
                                        usleep(_MMCAMCORDER_CAPTURE_STOP_CHECK_INTERVAL);
                                }
-                               );
                        }
 
                        if (info->type == _MMCamcorder_MULTI_SHOT) {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
                        }
 
                        _mmcam_dbg_log("Wait Frame Done. count before[%d],after[%d], try_count[%d]",
                                       current_framecount, sc->kpi.video_framecount, try_count);
                } else {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+                       ret = _mmcamcorder_remove_stillshot_pipeline(handle);
                        if (ret != MM_ERROR_NONE) {
                                goto cmd_error;
                        }
 
-                       /* remove handoff signal handler */
-                       _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
-
-                       /* remove encodesinkbin after capture */
-                       if (!sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
-                               _mmcam_dbg_log("ENCSINK_BIN is already removed");
-                       } else {
-                               GstPad *reqpad0 = NULL;
-                               GstPad *srcpad = NULL;
-                               GstPad *sinkpad = NULL;
-
-                               /* release requested pad */
-                               reqpad0 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
-                               gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad0);
-                               gst_object_unref(reqpad0);
-
-                               /* Unlink each element */
-                               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
-                               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
-                               _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
-
-                               /* make state of encodesinkbin as NULL */
-                               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
-
-                               gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                                              sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+                       if (info->resolution_change) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                               if (ret != MM_ERROR_NONE) {
+                                       goto cmd_error;
+                               }
 
-                               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
-                       }
+                               /* check if resolution need to rollback */
+                               mm_camcorder_get_attributes(handle, &err_name,
+                                                           MMCAM_CAMERA_WIDTH, &width,
+                                                           MMCAM_CAMERA_HEIGHT, &height,
+                                                           MMCAM_CAMERA_FPS, &fps,
+                                                           MMCAM_CAMERA_ROTATION, &rotation,
+                                                           NULL);
+
+                               /* set new caps */
+                               ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, rotation);
+                               if (!ret) {
+                                       _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed");
+                                       ret = MM_ERROR_CAMCORDER_INTERNAL;
+                                       goto cmd_error;
+                               }
 
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-                       if (ret != MM_ERROR_NONE) {
-                               goto cmd_error;
+                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+                               if (ret != MM_ERROR_NONE) {
+                                       goto cmd_error;
+                               }
                        }
                }
 
                /* sound finalize */
                if (info->type == _MMCamcorder_MULTI_SHOT) {
-                       __ta__("    _mmcamcorder_sound_finalize",
                        _mmcamcorder_sound_finalize(handle);
-                       );
                }
        } else {
-               int cap_count = 0;
-               int sound_ret = FALSE;
+               if (info->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "bitrate", H264_PREVIEW_BITRATE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "newgop-interval", H264_PREVIEW_NEWGOP_INTERVAL);
+               }
 
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
 
-               __ta__("        _MMCamcorder_CMD_PREVIEW_START:GST_STATE_PLAYING",
                ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-               );
                if (ret != MM_ERROR_NONE) {
                        goto cmd_error;
                }
@@ -794,33 +743,18 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle)
                        _mmcam_dbg_log("get sound status/volume level and register vconf changed_cb");
 
                        /* get sound status */
-                       __ta__("        GET:VCONFKEY_SETAPPL_SOUND_STATUS_BOOL",
                        vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
-                       );
 
                        _mmcam_dbg_log("sound status %d", info->sound_status);
 
                        /* get volume level */
-                       __ta__("        mm_sound_volume_get_value",
-                       mm_sound_volume_get_value(VOLUME_TYPE_MEDIA, &info->volume_level);
-                       );
+                       mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &info->volume_level);
 
                        _mmcam_dbg_log("volume level %d", info->volume_level);
 
                        /* register changed_cb */
                        vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb, hcamcorder);
-                       mm_sound_volume_add_callback(VOLUME_TYPE_MEDIA, __volume_level_changed_cb, hcamcorder);
-               }
-
-               mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_COUNT, &cap_count, NULL);
-               if (cap_count > 1) {
-                       __ta__("_mmcamcorder_sound_init",
-#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
-                       sound_ret = _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND);
-#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
-                       sound_ret = _mmcamcorder_sound_init(handle);
-#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
-                       );
+                       mm_sound_volume_add_callback(VOLUME_TYPE_SYSTEM, __volume_level_changed_cb, hcamcorder);
                }
        }
 
@@ -832,6 +766,10 @@ cmd_error:
 int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle)
 {
        int ret = MM_ERROR_NONE;
+       int strobe_mode = MM_CAMCORDER_STROBE_MODE_OFF;
+       int set_strobe = 0;
+       GstCameraControl *control = NULL;
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
        GstElement *pipeline = NULL;
 
@@ -839,27 +777,58 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle)
 
        _mmcam_dbg_log("");
 
-       mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
+       /* check strobe and set OFF if PERMANENT mode */
+       mm_camcorder_get_attributes(handle, NULL,
+                                   MMCAM_STROBE_MODE, &strobe_mode,
+                                   NULL);
+       if (strobe_mode == MM_CAMCORDER_STROBE_MODE_PERMANENT &&
+           GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+               _mmcam_dbg_log("current strobe mode is PERMANENT, set OFF");
+
+               /* get camera control */
+               control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+
+               /* convert MSL to sensor value */
+               set_strobe = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, MM_CAMCORDER_STROBE_MODE_OFF);
+
+               /* set strobe OFF */
+               gst_camera_control_set_strobe(control, GST_CAMERA_CONTROL_STROBE_MODE, set_strobe);
+
+               _mmcam_dbg_log("set strobe OFF done - value: %d", set_strobe);
+       }
+
        pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
 
+       if(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+               _mmcam_dbg_log("pipeline is exist so need to remove pipeline and sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst=%p",sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+               _mmcamcorder_remove_recorder_pipeline(handle);
+       }
+
+       /* Disable skip flush buffer  */
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "enable-flush-buffer", FALSE);
+
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
        ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+
+       /* Enable skip flush buffer  */
+       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "enable-flush-buffer", TRUE);
 
        /* deregister sound status callback */
        if (sc->info_image->sound_status != _SOUND_STATUS_INIT) {
                _mmcam_dbg_log("deregister sound status callback");
 
-               __ta__("    vconf_ignore_key_changed",
                vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb);
-               );
-               __ta__("    mm_sound_volume_remove_callback",
-               mm_sound_volume_remove_callback(VOLUME_TYPE_MEDIA);
-               );
+               mm_sound_volume_remove_callback(VOLUME_TYPE_SYSTEM);
 
                sc->info_image->sound_status = _SOUND_STATUS_INIT;
        }
@@ -907,12 +876,6 @@ int _mmcamcorder_video_capture_command(MMHandleType handle, int command)
                break;
        }
 
-       if (ret != MM_ERROR_NONE && sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
-               int op_status = 0;
-               MMCAMCORDER_G_OBJECT_GET (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "operation-status", &op_status);
-               _mmcam_dbg_err("Current Videosrc status[0x%x]", op_status);
-       }
-
        return ret;
 }
 
@@ -951,46 +914,53 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD
        int ret = MM_ERROR_NONE;
        unsigned char *data = NULL;
        unsigned int datalen = 0;
-
+       int provide_exif = FALSE;
+       _MMCamcorderSubContext *sc = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
+       sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+       mmf_return_val_if_fail(sc, FALSE);
 
        _mmcam_dbg_log("");
 
        if (!original || original->data == NULL || original->length == 0) {
-               _mmcam_dbg_err("original=%p, data=%p, length=%d", original, original->data, original->length);
+               if (!original) {
+                       _mmcam_dbg_log("original is null");
+               } else {
+                       _mmcam_dbg_log("data=%p, length=%d", original->data, original->length);
+               }
                return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
        } else {
                /* original is input/output param. save original values to local var. */
                data = original->data;
                datalen = original->length;
        }
-
-       if (thumbnail) {
-               if (thumbnail->data && thumbnail->length > 0) {
-                       _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
-                                      thumbnail->data, thumbnail->width, thumbnail->height);
-
-                       /* add thumbnail exif info */
-                       __ta__("                    mm_exif_add_thumbnail_info",
-                       ret = mm_exif_add_thumbnail_info(hcamcorder->exif_info,
-                                                        thumbnail->data,
-                                                        thumbnail->width,
-                                                        thumbnail->height,
-                                                        thumbnail->length);
-                       );
-               } else {
-                       _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)",
-                                      thumbnail->data, thumbnail->length);
+       MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
+       if(provide_exif == 0){
+               if (thumbnail) {
+                       if (thumbnail->data && thumbnail->length > 0) {
+                               _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
+                                              thumbnail->data, thumbnail->width, thumbnail->height);
+
+                               /* add thumbnail exif info */
+                               ret = mm_exif_add_thumbnail_info(hcamcorder->exif_info,
+                                                                thumbnail->data,
+                                                                thumbnail->width,
+                                                                thumbnail->height,
+                                                                thumbnail->length);
+                       } else {
+                               _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)",
+                                              thumbnail->data, thumbnail->length);
+                       }
                }
+       } else {
+               ret = MM_ERROR_NONE;
        }
 
        if (ret == MM_ERROR_NONE) {
                /* write jpeg with exif */
-               __ta__("                    mm_exif_write_exif_jpeg_to_memory",
-               ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length ,hcamcorder->exif_info,  data, datalen);
-               );
+               ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length ,hcamcorder->exif_info, data, datalen);
                if (ret != MM_ERROR_NONE) {
                        _mmcam_dbg_err("mm_exif_write_exif_jpeg_to_memory error! [0x%x]",ret);
                }
@@ -1005,34 +975,34 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD
 void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstSample *sample)
 {
        GstCaps *caps = NULL;
-    GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+       GstMapInfo mapinfo = GST_MAP_INFO_INIT;
        const GstStructure *structure;
 
        mmf_return_if_fail(capture_data && sample);
 
-    caps = gst_sample_get_caps(sample);
+       caps = gst_sample_get_caps(sample);
        if (caps == NULL) {
                _mmcam_dbg_err("failed to get caps");
                goto GET_FAILED;
        }
 
        structure = gst_caps_get_structure(caps, 0);
-       if (caps == NULL) {
+       if (structure == NULL) {
                _mmcam_dbg_err("failed to get structure");
                goto GET_FAILED;
        }
 
-    gst_buffer_map(gst_sample_get_buffer(sample), &mapinfo, GST_MAP_READ);
-    capture_data->data = mapinfo.data;
+       gst_buffer_map(gst_sample_get_buffer(sample), &mapinfo, GST_MAP_READ);
+       capture_data->data = mapinfo.data;
        capture_data->format = pixtype;
        gst_structure_get_int(structure, "width", &capture_data->width);
        gst_structure_get_int(structure, "height", &capture_data->height);
-    capture_data->length = mapinfo.size;
-    gst_buffer_unmap(gst_sample_get_buffer(sample), &mapinfo);
+       capture_data->length = mapinfo.size;
+       gst_buffer_unmap(gst_sample_get_buffer(sample), &mapinfo);
 
-        _mmcam_dbg_warn("buffer data[%p],size[%dx%d],length[%d],format[%d]",
-                        capture_data->data, capture_data->width, capture_data->height,
-                        capture_data->length, capture_data->format);
+       _mmcam_dbg_warn("buffer data[%p],size[%dx%d],length[%d],format[%d]",
+                       capture_data->data, capture_data->width, capture_data->height,
+                       capture_data->length, capture_data->format);
        return;
 
 GET_FAILED:
@@ -1082,17 +1052,13 @@ void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureData
 
        _mmcam_dbg_log("");
 
-       __ta__( "                  Get:MMCAM_TAG_ENABLE and \"provide-exif\"",
        mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL);
        MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
-       );
 
        /* if dest->data is allocated in MSL, release it */
        if (tag_enable && !provide_exif) {
                if (dest->data) {
-                       __ta__( "                  Free data",
                        free(dest->data);
-                       );
                        dest->length = 0;
                        dest->data = NULL;
                        _mmcam_dbg_log("Jpeg is released!");
@@ -1108,8 +1074,9 @@ void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureData
 static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sample1, GstSample *sample2, GstSample *sample3, gpointer u_data)
 {
        int ret = MM_ERROR_NONE;
-       int pixtype = MM_PIXEL_FORMAT_INVALID;
-       int pixtype_sub = MM_PIXEL_FORMAT_INVALID;
+       int pixtype_main = MM_PIXEL_FORMAT_INVALID;
+       int pixtype_thumb = MM_PIXEL_FORMAT_INVALID;
+       int pixtype_scrnl = MM_PIXEL_FORMAT_INVALID;
        int codectype = MM_IMAGE_CODEC_JPEG;
        int attr_index = 0;
        int count = 0;
@@ -1120,6 +1087,11 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
        int try_lock_count = 0;
        gboolean send_captured_message = FALSE;
        unsigned char *exif_raw_data = NULL;
+       unsigned char *internal_main_data = NULL;
+       unsigned int internal_main_length = 0;
+       unsigned char *internal_thumb_data = NULL;
+       unsigned int internal_thumb_length = 0;
+       unsigned char *compare_data = NULL;
 
        MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
@@ -1128,9 +1100,10 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
        MMCamcorderCaptureDataType dest = {0,};
        MMCamcorderCaptureDataType thumb = {0,};
        MMCamcorderCaptureDataType scrnail = {0,};
-    GstMapInfo mapinfo1;
-    GstMapInfo mapinfo2;
-    GstMapInfo mapinfo3;
+       MMCamcorderCaptureDataType encode_src = {0,};
+       GstMapInfo mapinfo1 = GST_MAP_INFO_INIT;
+       GstMapInfo mapinfo2 = GST_MAP_INFO_INIT;
+       GstMapInfo mapinfo3 = GST_MAP_INFO_INIT;
 
        mmf_attrs_t *attrs = NULL;
        mmf_attribute_t *item_screennail = NULL;
@@ -1148,8 +1121,6 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
 
        _mmcam_dbg_err("START - current state %d", current_state);
 
-       MMTA_ACUM_ITEM_BEGIN("            MSL capture callback", FALSE);
-
        /* check capture state */
        if (info->type == _MMCamcorder_MULTI_SHOT && info->capture_send_count > 0) {
                mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, "capture-break-cont-shot", &stop_cont_shot, NULL);
@@ -1159,23 +1130,15 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
                _mmcam_dbg_warn("stop command[%d] or not capturing state[%d]. skip this...",
                                stop_cont_shot, info->capturing);
 
-               MMTA_ACUM_ITEM_END("            MSL capture callback", FALSE);
-
                /*free GstBuffer*/
                if (sample1) {
-                   gst_caps_unref(gst_sample_get_caps(sample1));
-                   gst_buffer_unref(gst_sample_get_buffer(sample1));
                        gst_sample_unref(sample1);
                }
                if (sample2) {
-            gst_caps_unref(gst_sample_get_caps(sample2));
-            gst_buffer_unref(gst_sample_get_buffer(sample2));
-            gst_sample_unref(sample2);
+                       gst_sample_unref(sample2);
                }
                if (sample3) {
-            gst_caps_unref(gst_sample_get_caps(sample3));
-            gst_buffer_unref(gst_sample_get_buffer(sample3));
-            gst_sample_unref(sample3);
+                       gst_sample_unref(sample3);
                }
 
                return;
@@ -1205,13 +1168,13 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
                /* play capture sound here if multi capture
                   or preview format is ITLV(because of AF and flash control in plugin) */
                if (info->type == _MMCamcorder_MULTI_SHOT) {
-                       __ta__("                _mmcamcorder_sound_play",
-                       _mmcamcorder_sound_play((MMHandleType)hcamcorder);
-                       );
+                       pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+                       _mmcam_dbg_log("send signal for sound play");
+                       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START;
+                       pthread_cond_signal(&(hcamcorder->task_thread_cond));
+                       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
                } else if (!info->played_capture_sound) {
-                       __ta__("                _mmcamcorder_sound_solo_play",
                        _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
-                       );
                }
        }
 
@@ -1221,166 +1184,268 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
        memset((void *)&scrnail, 0x0, sizeof(MMCamcorderCaptureDataType));
 
        /* Prepare main, thumbnail buffer */
-    pixtype = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample1));
-       if (pixtype == MM_PIXEL_FORMAT_INVALID) {
+       pixtype_main = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample1));
+       if (pixtype_main == MM_PIXEL_FORMAT_INVALID) {
                _mmcam_dbg_err("Unsupported pixel type");
-
                MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
-
                goto error;
        }
 
        /* Main image buffer */
-    gst_buffer_map(gst_sample_get_buffer(sample1), &mapinfo1, GST_MAP_READ);
-    if (sample1 && mapinfo1.data && (mapinfo1.size !=0)) {
-        __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype, sample1);
-       } else {
-               _mmcam_dbg_err("Sample1 has wrong pointer. (sample1=%p)",sample1);
+       if (!sample1 || !gst_buffer_map(gst_sample_get_buffer(sample1), &mapinfo1, GST_MAP_READ)) {
+               _mmcam_dbg_err("sample1[%p] is NULL or gst_buffer_map failed", sample1);
                MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
-        gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
                goto error;
+       }else{
+               if ( (mapinfo1.data == NULL) && (mapinfo1.size == 0) ){
+                       _mmcam_dbg_err("mapinfo1 is wrong (%p, size %d)", mapinfo1.data, mapinfo1.size);
+                       MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
+                       gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
+                       goto error;
+               }else
+                       __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype_main, sample1);
        }
 
-       /* Encode JPEG */
-       if (sc->internal_encode) {
-#ifdef _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
-               int thumb_width = 0;
-               int thumb_height = 0;
-               int thumb_length = 0;
-               unsigned char *thumb_raw_data = NULL;
-#endif /* _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE */
-
-               mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
-                                           MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality,
-                                           NULL);
-               _mmcam_dbg_log("Start Internal Encode - capture_quality %d", capture_quality);
-
-               __ta__("                _mmcamcorder_encode_jpeg:MAIN",
-        ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height,
-                                              pixtype, dest.length, capture_quality, &(dest.data), &(dest.length));
-               );
-
-        if (!ret) {
-                       _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed");
+       if ( !sample2 || !gst_buffer_map(gst_sample_get_buffer(sample2), &mapinfo2, GST_MAP_READ) ) {
+               _mmcam_dbg_log("sample2[%p] is NULL or gst_buffer_map failed. Not Error.", sample2);
+       }
+       if ( !sample3 || !gst_buffer_map(gst_sample_get_buffer(sample3), &mapinfo3, GST_MAP_READ)) {
+               _mmcam_dbg_log("sample3[%p] is NULL or gst_buffer_map failed. Not Error.", sample3);
+       }
 
-                       MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
+       /* Screennail image buffer */
+       attrs = (mmf_attrs_t*)MMF_CAMCORDER_ATTRS(hcamcorder);
+       mm_attrs_get_index((MMHandleType)attrs, MMCAM_CAPTURED_SCREENNAIL, &attr_index);
+       item_screennail = &attrs->items[attr_index];
 
-                       goto error;
-               }
+       if (sample3 && mapinfo3.data && mapinfo3.size != 0) {
+               _mmcam_dbg_log("Screennail (sample3=%p,size=%d)", sample3, mapinfo3.size);
 
-               /* set format */
-               dest.format = MM_PIXEL_FORMAT_ENCODED;
+               pixtype_scrnl = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3));
+               __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_scrnl, sample3);
 
-               _mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length);
+               /* Set screennail attribute for application */
+               ret = mmf_attribute_set_data(item_screennail, &scrnail, sizeof(scrnail));
+               _mmcam_dbg_log("Screennail set attribute data %p, size %d, ret %x", &scrnail, sizeof(scrnail), ret);
+       } else {
+               _mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)",sample3);
+               mmf_attribute_set_data(item_screennail, NULL, 0);
+       }
 
-#ifdef _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
-               /* make thumbnail image */
-               _mmcam_dbg_log("Make thumbnail image");
+       /* commit screennail data */
+       mmf_attribute_commit(item_screennail);
 
-               if (dest.width > THUMBNAIL_WIDTH) {
-                       float img_ratio = (float)dest.width / (float)dest.height;
+       /* init thumb data */
+       memset(&encode_src, 0x0, sizeof(MMCamcorderCaptureDataType));
 
-                       _mmcam_dbg_log("image ratio %f , default ratio %f", img_ratio, THUMBNAIL_DEFAULT_RATIO);
+       /* get provide-exif */
+       MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
 
-                       if (img_ratio > THUMBNAIL_DEFAULT_RATIO) {
-                               thumb_height = THUMBNAIL_HEIGHT;
-                               thumb_width = (thumb_height * dest.width) / dest.height;
+       /* Thumbnail image buffer */
+       if (sample2 && mapinfo2.data && (mapinfo2.size != 0)) {
+               _mmcam_dbg_log("Thumbnail (buffer2=%p)",gst_sample_get_buffer(sample2));
+               pixtype_thumb = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample2));
+               __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_thumb, sample2);
+       } else {
+               _mmcam_dbg_log("Sample2 has wrong pointer. Not Error. (sample2 %p)", sample2);
+
+               if (pixtype_main == MM_PIXEL_FORMAT_ENCODED && provide_exif) {
+                       ExifLoader *l;
+                       /* get thumbnail from EXIF */
+                       l = exif_loader_new();
+                       if (l) {
+                               ExifData *ed;
+                               char  width[10];
+                               char  height[10];
+                               ExifEntry *entry = NULL;
+
+                               exif_loader_write (l, dest.data, dest.length);
+
+                               /* Get a pointer to the EXIF data */
+                               ed = exif_loader_get_data(l);
+
+                               /* The loader is no longer needed--free it */
+                               exif_loader_unref(l);
+                               l = NULL;
+                               if (ed) {
+                                       entry = exif_content_get_entry(ed->ifd[EXIF_IFD_1], EXIF_TAG_IMAGE_WIDTH);
+                                       if (entry != NULL) {
+                                               exif_entry_get_value(entry,width,10);
+                                       }
+                                       entry = NULL;
+                                       entry = exif_content_get_entry(ed->ifd[EXIF_IFD_1], EXIF_TAG_IMAGE_LENGTH);
+                                       if (entry != NULL) {
+                                               exif_entry_get_value(entry,height , 10);
+                                       }
+                                       entry = NULL;
+                                       /* Make sure the image had a thumbnail before trying to write it */
+                                       if (ed->data && ed->size) {
+                                               thumb.data = malloc(ed->size);
+                                               memcpy(thumb.data,ed->data,ed->size);
+                                               thumb.length = ed->size;
+                                               #if 0
+                                               {
+                                                   FILE *fp = NULL;
+                                                   fp = fopen ("/opt/usr/media/thumbnail_test.jpg", "a+");
+                                                   fwrite (thumb.data, 1, thumb.length, fp);
+                                                   fclose (fp);
+                                               }
+                                               #endif
+                                               thumb.format = MM_PIXEL_FORMAT_ENCODED;
+                                               thumb.width = atoi(width);
+                                               thumb.height = atoi(height);
+                                               internal_thumb_data = thumb.data;
+                                       }
+                                       exif_data_unref(ed);
+                                       ed = NULL;
+                               } else {
+                                       _mmcam_dbg_warn("failed to get exif data");
+                               }
                        } else {
-                               thumb_width = THUMBNAIL_WIDTH;
-                               thumb_height = (thumb_width * dest.height) / dest.width;
+                               _mmcam_dbg_warn("failed to create exif loader");
                        }
+               }
 
-                       _mmcam_dbg_log("need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
-
-            if (!_mmcamcorder_resize_frame(mapinfo1.data, dest.width, dest.height, GST_BUFFER_SIZE(buffer1), pixtype,
-                                                      &thumb_raw_data, &thumb_width, &thumb_height, &thumb_length)) {
-                               thumb_raw_data = NULL;
-                               _mmcam_dbg_warn("_mmcamcorder_resize_frame failed. skip thumbnail making...");
+               if (thumb.data == NULL) {
+                       if (pixtype_main == MM_PIXEL_FORMAT_ENCODED &&
+                           scrnail.data && scrnail.length != 0) {
+                               /* make thumbnail image with screennail data */
+                               memcpy(&encode_src, &scrnail, sizeof(MMCamcorderCaptureDataType));
+                       } else if (sc->internal_encode) {
+                               /* make thumbnail image with main data, this is raw data */
+                               memcpy(&encode_src, &dest, sizeof(MMCamcorderCaptureDataType));
                        }
-               } else {
-                       thumb_width = dest.width;
-                       thumb_height = dest.height;
+               }
 
-                       _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
+               /* encode thumbnail */
+               if (encode_src.data) {
+                       unsigned int thumb_width = 0;
+                       unsigned int thumb_height = 0;
+                       unsigned int thumb_length = 0;
+                       unsigned char *thumb_raw_data = NULL;
 
-            thumb_raw_data = mapinfo1.data;
-               }
+                       /* encode image */
+                       _mmcam_dbg_log("Encode Thumbnail");
 
-               if (thumb_raw_data) {
-                       __ta__("                _mmcamcorder_encode_jpeg:THUMBNAIL",
-                       ret = _mmcamcorder_encode_jpeg(thumb_raw_data, thumb_width, thumb_height,
-                                                      pixtype, thumb_length, THUMBNAIL_JPEG_QUALITY, &(thumb.data), &(thumb.length));
-                       );
-                       if (ret) {
-                               _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d", thumb.data, thumb.length);
+                       if (encode_src.width > THUMBNAIL_WIDTH) {
+                               /* calculate thumbnail size */
+                               thumb_width = THUMBNAIL_WIDTH;
+                               thumb_height = (thumb_width * encode_src.height) / encode_src.width;
+                               if (thumb_height % 2 != 0) {
+                                       thumb_height += 1;
+                               }
 
-                               thumb.width = thumb_width;
-                               thumb.height = thumb_height;
-                               thumb.format = MM_PIXEL_FORMAT_ENCODED;
+                               _mmcam_dbg_log("need to resize : thumbnail size %dx%d, format %d",
+                                              thumb_width, thumb_height, encode_src.format);
+
+                               if ((encode_src.format == MM_PIXEL_FORMAT_UYVY ||
+                                    encode_src.format == MM_PIXEL_FORMAT_YUYV) &&
+                                    encode_src.width % thumb_width == 0 &&
+                                    encode_src.height % thumb_height == 0) {
+                                       if (!_mmcamcorder_downscale_UYVYorYUYV(encode_src.data, encode_src.width, encode_src.height,
+                                                                             &thumb_raw_data, thumb_width, thumb_height)) {
+                                               thumb_raw_data = NULL;
+                                               _mmcam_dbg_warn("_mmcamcorder_downscale_UYVYorYUYV failed. skip thumbnail making...");
+                                       }
+                               } else {
+                                       if (!_mmcamcorder_resize_frame(encode_src.data, encode_src.width, encode_src.height,
+                                                                          encode_src.length, encode_src.format,
+                                                                          &thumb_raw_data, &thumb_width, &thumb_height, &thumb_length)) {
+                                               thumb_raw_data = NULL;
+                                               _mmcam_dbg_warn("_mmcamcorder_resize_frame failed. skip thumbnail making...");
+                                       }
+                               }
                        } else {
-                               _mmcam_dbg_warn("failed to encode THUMBNAIL");
-                       }
+                               thumb_width = encode_src.width;
+                               thumb_height = encode_src.height;
 
-            if (thumb_raw_data != mapinfo1.data) {
-                               free(thumb_raw_data);
-                               thumb_raw_data = NULL;
-                               _mmcam_dbg_log("release thumb_raw_data");
+                               _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
+
+                               thumb_raw_data = encode_src.data;
+                               thumb_length = encode_src.length;
                        }
-               } else {
-                       _mmcam_dbg_warn("thumb_raw_data is NULL");
-               }
-#endif /* _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE */
-        gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
-       } else {
-        gst_buffer_map(gst_sample_get_buffer(sample2), &mapinfo2, GST_MAP_READ);
-               /* Thumbnail image buffer */
-        if (sample2 && mapinfo2.data && (mapinfo2.size !=0)) {
-                       _mmcam_dbg_log("Thumnail (sample2=%p)",sample2);
 
-            pixtype_sub = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample2));
-            __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_sub, sample2);
+                       if (thumb_raw_data) {
+                               ret = _mmcamcorder_encode_jpeg(thumb_raw_data, thumb_width, thumb_height,
+                                                              encode_src.format, thumb_length, THUMBNAIL_JPEG_QUALITY,
+                                                              (void **)&internal_thumb_data, &internal_thumb_length, JPEG_ENCODER_SOFTWARE);
+                               if (ret) {
+                                       _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d",
+                                                      internal_thumb_data, internal_thumb_length);
+
+                                       thumb.data = internal_thumb_data;
+                                       thumb.length = internal_thumb_length;
+                                       thumb.width = thumb_width;
+                                       thumb.height = thumb_height;
+                                       thumb.format = MM_PIXEL_FORMAT_ENCODED;
+                               } else {
+                                       _mmcam_dbg_warn("failed to encode THUMBNAIL");
+                               }
+
+                               /* release allocated raw data memory */
+                               if (thumb_raw_data != encode_src.data) {
+                                       free(thumb_raw_data);
+                                       thumb_raw_data = NULL;
+                                       _mmcam_dbg_log("release thumb_raw_data");
+                               }
+                       } else {
+                               _mmcam_dbg_warn("thumb_raw_data is NULL");
+                       }
                } else {
-                       _mmcam_dbg_log("Sample2 has wrong pointer. Not Error. (sample2=%p)",sample2);
+                       // no raw data src for thumbnail
+                       _mmcam_dbg_log("no need to encode thumbnail");
                }
-        gst_buffer_unmap(gst_sample_get_buffer(sample2), &mapinfo2);
        }
 
-       /* Screennail image buffer */
-       attrs = (mmf_attrs_t*)MMF_CAMCORDER_ATTRS(hcamcorder);
-       mm_attrs_get_index((MMHandleType)attrs, MMCAM_CAPTURED_SCREENNAIL, &attr_index);
-       item_screennail = &attrs->items[attr_index];
+       /* Encode JPEG */
+       if (sc->internal_encode && pixtype_main != MM_PIXEL_FORMAT_ENCODED) {
+               mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+                                           MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality,
+                                           NULL);
+               _mmcam_dbg_log("Start Internal Encode - capture_quality %d", capture_quality);
 
-    gst_buffer_map(gst_sample_get_buffer(sample3), &mapinfo3, GST_MAP_READ);
-    if (sample3 && mapinfo3.data && mapinfo3.size != 0) {
-        _mmcam_dbg_log("Screennail (sample3=%p,size=%d)", sample3, mapinfo3.size);
+               ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height,
+                                              pixtype_main, dest.length, capture_quality,
+                                              (void **)&internal_main_data, &internal_main_length, JPEG_ENCODER_HARDWARE);
+               if (!ret) {
+                       _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed");
 
-        pixtype_sub = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3));
-        __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_sub, sample3);
+                       MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
 
-               /* Set screennail attribute for application */
-               ret = mmf_attribute_set_data(item_screennail, &scrnail, sizeof(scrnail));
-               _mmcam_dbg_log("Screennail set attribute data %p, size %d, ret %x", &scrnail, sizeof(scrnail), ret);
-       } else {
-               _mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)",sample3);
-               mmf_attribute_set_data(item_screennail, NULL, 0);
-       }
-    gst_buffer_unmap(gst_sample_get_buffer(sample3), &mapinfo3);
+                       goto error;
+               }
 
-       /* commit screennail data */
-       mmf_attribute_commit(item_screennail);
+               /* set format */
+               dest.data = internal_main_data;
+               dest.length = internal_main_length;
+               dest.format = MM_PIXEL_FORMAT_ENCODED;
+
+               _mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length);
+       }
 
        /* create EXIF info */
-       __ta__("                    mm_exif_create_exif_info",
-       ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
-       );
+       if(!provide_exif){ // make new exif
+               ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
+       } else { // load from jpeg buffer dest.data
+               ret = mm_exif_load_exif_info(&(hcamcorder->exif_info), dest.data, dest.length);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("Failed to load exif_info [%x], try to create EXIF", ret);
+                       provide_exif = FALSE;
+                       ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
+               }
+       }
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_err("Failed to create exif_info [%x], but keep going...", ret);
        } else {
                /* add basic exif info */
-               _mmcam_dbg_log("add basic exif info");
-               __ta__("                    __mmcamcorder_set_exif_basic_info",
-               ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height);
-               );
+               if(!provide_exif) {
+                       _mmcam_dbg_log("add basic exif info");
+                       ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height);
+               } else {
+                       _mmcam_dbg_log("update exif info");
+                       ret = __mmcamcorder_update_exif_info((MMHandleType)hcamcorder, dest.data, dest.length);
+               }
+
                if (ret != MM_ERROR_NONE) {
                        _mmcam_dbg_warn("Failed set_exif_basic_info [%x], but keep going...", ret);
                        ret = MM_ERROR_NONE;
@@ -1409,37 +1474,33 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
        /* commit EXIF data */
        mmf_attribute_commit(item_exif_raw_data);
 
-       /* get tag-enable and provide-exif */
+       /* get tag-enable */
        mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL);
-       MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
 
        /* Set extra data for JPEG if tag enabled and doesn't provide EXIF */
-       if (dest.format == MM_PIXEL_FORMAT_ENCODED &&
-           tag_enable && !provide_exif) {
-               mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
-                                           MMCAM_IMAGE_ENCODER, &codectype,
-                                           NULL);
-               _mmcam_dbg_log("codectype %d", codectype);
-
-               switch (codectype) {
-               case MM_IMAGE_CODEC_JPEG:
-               case MM_IMAGE_CODEC_SRW:
-               case MM_IMAGE_CODEC_JPEG_SRW:
-                       __ta__( "                __mmcamcorder_set_jpeg_data",
-                       ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb);
-                       );
-                       if (ret != MM_ERROR_NONE) {
-                               _mmcam_dbg_err("Error on setting extra data to jpeg");
-                               MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, ret);
+       if (dest.format == MM_PIXEL_FORMAT_ENCODED){
+               if (tag_enable) {
+                       mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+                                                   MMCAM_IMAGE_ENCODER, &codectype,
+                                                   NULL);
+                       _mmcam_dbg_log("codectype %d", codectype);
+
+                       switch (codectype) {
+                       case MM_IMAGE_CODEC_JPEG:
+                       case MM_IMAGE_CODEC_SRW:
+                       case MM_IMAGE_CODEC_JPEG_SRW:
+                               ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb);
+                               if (ret != MM_ERROR_NONE) {
+                                       _mmcam_dbg_err("Error on setting extra data to jpeg");
+                                       MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, ret);
+                                       goto error;
+                               }
+                               break;
+                       default:
+                               _mmcam_dbg_err("The codectype is not supported. (%d)", codectype);
+                               MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
                                goto error;
                        }
-                       break;
-               default:
-                       _mmcam_dbg_err("The codectype is not supported. (%d)", codectype);
-
-                       MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
-
-                       goto error;
                }
        }
 
@@ -1448,13 +1509,11 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl
 
        if (hcamcorder->vcapture_cb) {
                _mmcam_dbg_log("APPLICATION CALLBACK START");
-               MMTA_ACUM_ITEM_BEGIN("                Application capture callback", 0);
                if (thumb.data) {
                        ret = hcamcorder->vcapture_cb(&dest, &thumb, hcamcorder->vcapture_cb_param);
                } else {
                        ret = hcamcorder->vcapture_cb(&dest, NULL, hcamcorder->vcapture_cb_param);
                }
-               MMTA_ACUM_ITEM_END("                Application capture callback", 0);
                _mmcam_dbg_log("APPLICATION CALLBACK END");
        } else {
                _mmcam_dbg_err("Capture callback is NULL.");
@@ -1472,7 +1531,6 @@ err_release_exif:
        _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(hcamcorder);
 
        /* init screennail and EXIF raw data */
-       __ta__("                init attributes:scrnl and EXIF",
        mmf_attribute_set_data(item_screennail, NULL, 0);
        mmf_attribute_commit(item_screennail);
        if (exif_raw_data) {
@@ -1482,13 +1540,10 @@ err_release_exif:
                mmf_attribute_set_data(item_exif_raw_data, NULL, 0);
                mmf_attribute_commit(item_exif_raw_data);
        }
-       );
 
        /* Release jpeg data */
-       if (pixtype == MM_PIXEL_FORMAT_ENCODED) {
-               __ta__("                __mmcamcorder_release_jpeg_data",
+       if (pixtype_main == MM_PIXEL_FORMAT_ENCODED) {
                __mmcamcorder_release_jpeg_data((MMHandleType)hcamcorder, &dest);
-               );
        }
 
 error:
@@ -1500,52 +1555,52 @@ error:
 
        /* release internal allocated data */
        if (sc->internal_encode) {
-               if (dest.data) {
-                       free(dest.data);
-                       dest.data = NULL;
-                       dest.length = 0;
-                       _mmcam_dbg_log("release internal encoded data MAIN");
-               }
-               if (thumb.data) {
-                       free(thumb.data);
-                       thumb.data = NULL;
-                       thumb.length = 0;
-                       _mmcam_dbg_log("release internal encoded data THUMB");
-               }
+               compare_data = internal_main_data;
+       } else {
+               compare_data = mapinfo1.data;
+       }
+       if (dest.data && compare_data &&
+           dest.data != compare_data) {
+               _mmcam_dbg_log("release internal allocated data %p", dest.data);
+               free(dest.data);
+               dest.data = NULL;
+               dest.length = 0;
+       }
+       if (internal_main_data) {
+               _mmcam_dbg_log("release internal main data %p", internal_main_data);
+               free(internal_main_data);
+               internal_main_data = NULL;
        }
+       if (internal_thumb_data) {
+               _mmcam_dbg_log("release internal thumb data %p", internal_thumb_data);
+               free(internal_thumb_data);
+               internal_thumb_data = NULL;
+       }
+
+       /* reset compare_data */
+       compare_data = NULL;
 
        /*free GstBuffer*/
-    if (sample1) {
-        gst_caps_unref(gst_sample_get_caps(sample1));
-        gst_buffer_unref(gst_sample_get_buffer(sample1));
-        gst_sample_unref(sample1);
-    }
-    if (sample2) {
-        gst_caps_unref(gst_sample_get_caps(sample2));
-        gst_buffer_unref(gst_sample_get_buffer(sample2));
-        gst_sample_unref(sample2);
-    }
-    if (sample3) {
-        gst_caps_unref(gst_sample_get_caps(sample3));
-        gst_buffer_unref(gst_sample_get_buffer(sample3));
-        gst_sample_unref(sample3);
-    }
+       if (sample1) {
+               gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
+               gst_sample_unref(sample1);
+       }
+       if (sample2) {
+               gst_buffer_unmap(gst_sample_get_buffer(sample2), &mapinfo2);
+               gst_sample_unref(sample2);
+       }
+       if (sample3) {
+               gst_buffer_unmap(gst_sample_get_buffer(sample3), &mapinfo3);
+               gst_sample_unref(sample3);
+       }
 
        /* destroy exif info */
-       __ta__("                mm_exif_destory_exif_info",
        mm_exif_destory_exif_info(hcamcorder->exif_info);
-       );
        hcamcorder->exif_info = NULL;
 
        /* send captured message */
        if (send_captured_message) {
-               MMTA_ACUM_ITEM_BEGIN("                CAPTURED MESSAGE DELAY", FALSE);
-
                if (info->hdr_capture_mode != MM_CAMCORDER_HDR_ON_AND_ORIGINAL) {
-                       MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
-
-                       mm_camcorder_get_state((MMHandleType)hcamcorder, &current_state);
-
                        /* Send CAPTURED message and count - capture success */
                        if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
                                MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED, count);
@@ -1558,7 +1613,10 @@ error:
                }
        }
 
-       MMTA_ACUM_ITEM_END( "            MSL capture callback", FALSE );
+       /* Handle capture in recording case */
+       if (hcamcorder->capture_in_recording) {
+               hcamcorder->capture_in_recording = FALSE;
+       }
 
        _mmcam_dbg_err("END");
 
@@ -1566,7 +1624,7 @@ error:
 }
 
 
-static gboolean __mmcamcorder_encodesink_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data)
+gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
        _MMCamcorderSubContext *sc = NULL;
@@ -1577,61 +1635,412 @@ static gboolean __mmcamcorder_encodesink_handoff_callback(GstElement *fakesink,
        mmf_return_val_if_fail(sc && sc->element, FALSE);
 
        _mmcam_dbg_log("");
-       /* FIXME. How could you get a thumbnail? */
 
-    __mmcamcorder_image_capture_cb(fakesink, gst_sample_new(buffer, gst_pad_get_current_caps(pad), NULL, NULL), NULL, NULL, u_data);
+       /* FIXME. How could you get a thumbnail? */
+       __mmcamcorder_image_capture_cb(fakesink, gst_sample_new(buffer, gst_pad_get_current_caps(pad), NULL, NULL), NULL, NULL, u_data);
 
-       if (sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "signal-handoffs", FALSE);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+       if (sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "signal-handoffs", FALSE);
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+               sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
        }
 
        return TRUE;
 }
 
 
-/* Take a picture with capture mode */
-int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int capture_height)
+static ExifData *__mmcamcorder_update_exif_orientation(MMHandleType handle, ExifData *ed)
 {
-       int ELEMENT_CROP = 0;
-       int ELEMENT_FILTER = 0;
+       int value = 0;
+       ExifShort eshort = 0;
+       int ret = MM_ERROR_NONE;
 
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;
+       mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL);
+       _mmcam_dbg_log("get orientation [%d]",value);
+       if (value == 0) {
+               value = MM_EXIF_ORIENTATION;
+       }
 
-       _mmcam_dbg_log("");
+       exif_set_short((unsigned char *)&eshort, exif_data_get_byte_order(ed), value);
+       ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_ORIENTATION,
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort);
+       if (ret != MM_ERROR_NONE) {
+               EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
+       }
 
-       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+exit:
+       return ed;
+}
 
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       ELEMENT_CROP = _MMCAMCORDER_ENCSINK_ICROP;
-       ELEMENT_FILTER = _MMCAMCORDER_ENCSINK_IFILT;
+static ExifData *__mmcamcorder_update_exif_make(MMHandleType handle, ExifData *ed)
+{
+       int ret = MM_ERROR_NONE;
+       char *make = strdup(MM_MAKER_NAME);
+
+       if (make) {
+               _mmcam_dbg_log("maker [%s]", make);
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MAKE,
+                                           EXIF_FORMAT_ASCII, strlen(make)+1, (const char *)make);
+               free(make);
+               if (ret != MM_ERROR_NONE) {
+                       EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
+               }
+       } else {
+               ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
+               EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
+       }
+
+exit:
+       return ed;
+}
 
-       /*TODO: this is not needed now. */
 
-       return MM_ERROR_NONE;
+static ExifData *__mmcamcorder_update_exif_software(MMHandleType handle, ExifData *ed)
+{
+       int ret = MM_ERROR_NONE;
+       mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+
+       if (hcamcorder == NULL || ed == NULL) {
+               _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+               return NULL;
+       }
+
+       if (hcamcorder->software_version) {
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE, EXIF_FORMAT_ASCII,
+                                           strlen(hcamcorder->software_version)+1, (const char *)hcamcorder->software_version);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("set software_version[%s] failed", hcamcorder->software_version);
+               } else {
+                       _mmcam_dbg_log("set software_version[%s] done", hcamcorder->software_version);
+               }
+       } else {
+               _mmcam_dbg_err("model_name is NULL");
+       }
+
+       return ed;
 }
 
 
+static ExifData *__mmcamcorder_update_exif_model(MMHandleType handle, ExifData *ed)
+{
+       int ret = MM_ERROR_NONE;
+       mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+
+       if (hcamcorder == NULL || ed == NULL) {
+               _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+               return NULL;
+       }
+
+       if (hcamcorder->model_name) {
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MODEL, EXIF_FORMAT_ASCII,
+                                           strlen(hcamcorder->model_name)+1, (const char *)hcamcorder->model_name);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("set model name[%s] failed", hcamcorder->model_name);
+               } else {
+                       _mmcam_dbg_log("set model name[%s] done", hcamcorder->model_name);
+               }
+       } else {
+               _mmcam_dbg_err("model_name is NULL");
+       }
+
+       return ed;
+}
+
+static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed)
+{
+       int ret = MM_ERROR_NONE;
+       int gps_enable = TRUE;
+       char *err_name = NULL;
+       double latitude = INVALID_GPS_VALUE;
+       double longitude = INVALID_GPS_VALUE;
+       double altitude = INVALID_GPS_VALUE;
+
+       ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_GPS_ENABLE, &gps_enable, NULL);
+       if (ret == MM_ERROR_NONE && gps_enable) {
+               ExifByte GpsVersion[4]={2,2,0,0};
+
+               _mmcam_dbg_log("Tag for GPS is ENABLED.");
+
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_VERSION_ID,
+                                           EXIF_FORMAT_BYTE, 4, (const char *)&GpsVersion);
+               if (ret != MM_ERROR_NONE) {
+                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_VERSION_ID);
+               }
+
+               ret = mm_camcorder_get_attributes(handle, &err_name,
+                                                 MMCAM_TAG_LATITUDE, &latitude,
+                                                 MMCAM_TAG_LONGITUDE, &longitude,
+                                                 MMCAM_TAG_ALTITUDE, &altitude, NULL);
+               if (ret != MM_ERROR_NONE) {
+                       _mmcam_dbg_err("failed to get gps info [%x][%s]", ret, err_name);
+                       SAFE_FREE(err_name);
+                       goto exit;
+               }
+
+               _mmcam_dbg_log("latitude [%f]", latitude);
+               if (latitude != INVALID_GPS_VALUE) {
+                       unsigned char *b = NULL;
+                       unsigned int deg;
+                       unsigned int min;
+                       unsigned int sec;
+                       ExifRational rData;
+
+                       if (latitude < 0) {
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
+                                                           EXIF_FORMAT_ASCII, 2, "S");
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
+                               }
+                               latitude = -latitude;
+                       } else if (latitude > 0) {
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
+                                                           EXIF_FORMAT_ASCII, 2, "N");
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
+                               }
+                       }
+
+                       deg = (unsigned int)(latitude);
+                       min = (unsigned int)((latitude-deg)*60);
+                       sec = (unsigned int)(((latitude-deg)*3600)-min*60);
+
+                       _mmcam_dbg_log("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec);
+                       b = malloc(3 * sizeof(ExifRational));
+                       if (b) {
+                               rData.numerator = deg;
+                               rData.denominator = 1;
+                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+                               rData.numerator = min;
+                               exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
+                               rData.numerator = sec;
+                               exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
+
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE,
+                                                           EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+                               free(b);
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE);
+                               }
+                       } else {
+                               _mmcam_dbg_warn("malloc failed");
+                       }
+               }
+
+               _mmcam_dbg_log("longitude [%f]", longitude);
+               if (longitude != INVALID_GPS_VALUE) {
+                       unsigned char *b = NULL;
+                       unsigned int deg;
+                       unsigned int min;
+                       unsigned int sec;
+                       ExifRational rData;
+
+                       if (longitude < 0) {
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
+                                                           EXIF_FORMAT_ASCII, 2, "W");
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
+                               }
+                               longitude = -longitude;
+                       } else if (longitude > 0) {
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
+                                                           EXIF_FORMAT_ASCII, 2, "E");
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
+                               }
+                       }
+
+                       deg = (unsigned int)(longitude);
+                       min = (unsigned int)((longitude-deg)*60);
+                       sec = (unsigned int)(((longitude-deg)*3600)-min*60);
+
+                       _mmcam_dbg_log("longitude deg[%d], min[%d], sec[%d]", deg, min, sec);
+                       b = malloc(3 * sizeof(ExifRational));
+                       if (b) {
+                               rData.numerator = deg;
+                               rData.denominator = 1;
+                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+                               rData.numerator = min;
+                               exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
+                               rData.numerator = sec;
+                               exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE,
+                                                           EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+                               free(b);
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE);
+                               }
+                       } else {
+                               _mmcam_dbg_warn("malloc failed");
+                       }
+               }
+
+               _mmcam_dbg_log("f_altitude [%f]", altitude);
+               if (altitude != INVALID_GPS_VALUE) {
+                       ExifByte alt_ref = 0;
+                       unsigned char *b = NULL;
+                       ExifRational rData;
+                       b = malloc(sizeof(ExifRational));
+                       if (b) {
+                               if (altitude < 0) {
+                                       alt_ref = 1;
+                                       altitude = -altitude;
+                               }
+
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE_REF,
+                                                           EXIF_FORMAT_BYTE, 1, (const char *)&alt_ref);
+                               if (ret != MM_ERROR_NONE) {
+                                       _mmcam_dbg_err("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF);
+                                       if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
+                                               free(b);
+                                               b = NULL;
+                                               goto exit;
+                                       }
+                               }
+
+                               rData.numerator = (unsigned int)(altitude + 0.5)*100;
+                               rData.denominator = 100;
+                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE,
+                                                           EXIF_FORMAT_RATIONAL, 1, (const char *)b);
+                               free(b);
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE);
+                               }
+                       } else {
+                               _mmcam_dbg_warn("malloc failed");
+                       }
+               }
+
+               {
+                       double gps_timestamp = INVALID_GPS_VALUE;
+                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-time-stamp", &gps_timestamp, NULL);
+                       _mmcam_dbg_log("Gps timestamp [%f]", gps_timestamp);
+                       if (gps_timestamp > 0.0) {
+                               unsigned char *b = NULL;
+                               unsigned int hour;
+                               unsigned int min;
+                               unsigned int microsec;
+                               ExifRational rData;
+
+                               hour = (unsigned int)(gps_timestamp / 3600);
+                               min = (unsigned int)((gps_timestamp - 3600 * hour) / 60);
+                               microsec = (unsigned int)(((double)((double)gps_timestamp -(double)(3600 * hour)) -(double)(60 * min)) * 1000000);
+
+                               _mmcam_dbg_log("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec);
+                               b = malloc(3 * sizeof(ExifRational));
+                               if (b) {
+                                       rData.numerator = hour;
+                                       rData.denominator = 1;
+                                       exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+
+                                       rData.numerator = min;
+                                       rData.denominator = 1;
+                                       exif_set_rational(b + 8, exif_data_get_byte_order(ed), rData);
+
+                                       rData.numerator = microsec;
+                                       rData.denominator = 1000000;
+                                       exif_set_rational(b + 16, exif_data_get_byte_order(ed), rData);
+
+                                       ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_TIME_STAMP,
+                                                                   EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+                                       free(b);
+                                       if (ret != MM_ERROR_NONE) {
+                                               EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP);
+                                       }
+                               } else {
+                                       _mmcam_dbg_warn( "malloc failed." );
+                               }
+                       }
+               }
+
+               {
+                       unsigned char *date_stamp = NULL;
+                       int date_stamp_len = 0;
+
+                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-date-stamp", &date_stamp, &date_stamp_len, NULL);
+
+                       if (date_stamp) {
+                               _mmcam_dbg_log("Date stamp [%s]", date_stamp);
+
+                               /* cause it should include NULL char */
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP,
+                                                           EXIF_FORMAT_ASCII, date_stamp_len + 1, (const char *)date_stamp);
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_DATE_STAMP);
+                               }
+                       }
+               }
+
+               {
+                       unsigned char *processing_method = NULL;
+                       int processing_method_len = 0;
+
+                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-processing-method", &processing_method, &processing_method_len, NULL);
+
+                       if (processing_method) {
+                               _mmcam_dbg_log("Processing method [%s]", processing_method);
+
+                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_PROCESSING_METHOD,
+                                                           EXIF_FORMAT_UNDEFINED, processing_method_len, (const char *)processing_method);
+                               if (ret != MM_ERROR_NONE) {
+                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_PROCESSING_METHOD);
+                               }
+                       }
+               }
+       } else {
+               _mmcam_dbg_log( "Tag for GPS is DISABLED." );
+       }
+
+exit:
+       return ed;
+}
+
+
+int __mmcamcorder_update_exif_info(MMHandleType handle, void* imagedata, int imgln)
+{
+       int ret = MM_ERROR_NONE;
+       mmf_camcorder_t *hcamcorder = NULL;
+       ExifData *ed = NULL;
+
+       hcamcorder = MMF_CAMCORDER(handle);
+
+       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       ed = exif_data_new_from_data(imagedata, imgln);
+       //ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);
+
+       if (ed == NULL || ed->ifd == NULL) {
+               _mmcam_dbg_err("get exif data error!!(%p, %p)", ed, (ed ? ed->ifd : NULL));
+               return MM_ERROR_INVALID_HANDLE;
+       }
+
+       /* update necessary */
+
+       __mmcamcorder_update_exif_make(handle, ed);
+       __mmcamcorder_update_exif_software(handle, ed);
+       __mmcamcorder_update_exif_model(handle, ed);
+       __mmcamcorder_update_exif_orientation(handle, ed);
+       __mmcamcorder_update_exif_gps(handle, ed);
+       ret = mm_exif_set_exif_to_info(hcamcorder->exif_info, ed);
+       if (ret != MM_ERROR_NONE) {
+               _mmcam_dbg_err("mm_exif_set_exif_to_info err!! [%x]", ret);
+       }
+
+       exif_data_unref(ed);
+       ed = NULL;
+       return ret;
+}
+
 int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int image_height)
 {
        int ret = MM_ERROR_NONE;
        int value;
        int str_val_len = 0;
-       int gps_enable = TRUE;
        int cntl = 0;
        int cnts = 0;
-       double f_latitude = INVALID_GPS_VALUE;
-       double f_longitude = INVALID_GPS_VALUE;
-       double f_altitude = INVALID_GPS_VALUE;
        char *str_value = NULL;
-#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
-       char *maker = NULL;
-#endif
        char *user_comment = NULL;
-       char *err_name = NULL;
        ExifData *ed = NULL;
        ExifLong config;
        ExifLong ExifVersion;
@@ -1658,15 +2067,11 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        } else {
                control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
                /* get device information */
-               __ta__("                        gst_camera_control_get_exif_info",
                gst_camera_control_get_exif_info(control, &avsys_exif_info);
-               );
        }
 
        /* get ExifData from exif info */
-       __ta__("                        mm_exif_get_exif_from_info",
        ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);
-       );
        if (ed == NULL || ed->ifd == NULL) {
                _mmcam_dbg_err("get exif data error!!(%p, %p)", ed, (ed ? ed->ifd : NULL));
                return MM_ERROR_INVALID_HANDLE;
@@ -1679,7 +2084,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        /*0. EXIF_TAG_EXIF_VERSION */
        ExifVersion = MM_EXIF_VERSION;
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXIF_VERSION,
-                                   EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&ExifVersion);
+                                   EXIF_FORMAT_UNDEFINED, 4, (const char *)&ExifVersion);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_EXIF_VERSION);
        }
@@ -1689,13 +2094,13 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
        exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH,
-                                   EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl]);
+                                   EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_WIDTH);
        }
 
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION,
-                                   EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+                                   EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_X_DIMENSION);
        }
@@ -1706,13 +2111,13 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
        exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order (ed), value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH,
-                                   EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl]);
+                                   EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_LENGTH);
        }
 
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION,
-                                   EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+                                   EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_Y_DIMENSION);
        }
@@ -1745,66 +2150,41 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                         tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
                         tm.tm_hour, tm.tm_min, tm.tm_sec);
 
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, 20, b);
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, 20, (const char *)b);
                if (ret != MM_ERROR_NONE) {
-                       if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
+                       if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
                                free(b);
                        }
                        EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME);
                }
 
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, 20, b);
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, 20, (const char *)b);
                if (ret != MM_ERROR_NONE) {
-                       if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
+                       if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
                                free(b);
                        }
                        EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_ORIGINAL);
                }
 
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, 20, b);
-               if (ret != MM_ERROR_NONE) {
-                       if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
-                               free(b);
-                       }
-                       EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_DIGITIZED);
-               }
-
-               free(b);
-       }
-
-#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
-       /*5. EXIF_TAG_MAKE */
-       maker = strdup(MM_MAKER_NAME);
-       if (maker) {
-               _mmcam_dbg_log("maker [%s]", maker);
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MAKE,
-                                           EXIF_FORMAT_ASCII, strlen(maker), (unsigned char *)maker);
-               free(maker);
-               if (ret != MM_ERROR_NONE) {
-                       EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
-               }
-       } else {
-               ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
-               EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
-       }
-
-       /*6. EXIF_TAG_MODEL */
-       _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
-                                          CONFIGURE_CATEGORY_MAIN_GENERAL,
-                                          "ModelName",
-                                          &str_value);
-       _mmcam_dbg_log("model_name [%s]", str_value);
-       if (str_value) {
-               char *model = strdup(str_value);
-               mm_exif_set_add_entry(ed,EXIF_IFD_0,EXIF_TAG_MODEL,EXIF_FORMAT_ASCII,strlen(model)+1, (unsigned char*)model);
-               free(model);
-               str_value = NULL;
+               ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, 20, (const char *)b);
                if (ret != MM_ERROR_NONE) {
-                       EXIF_SET_ERR(ret, EXIF_TAG_MODEL);
+                       if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
+                               free(b);
+                       }
+                       EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_DIGITIZED);
                }
-       } else {
-               _mmcam_dbg_warn("failed to get model name");
+
+               free(b);
        }
+
+       /*5. EXIF_TAG_MAKE */
+       __mmcamcorder_update_exif_make(handle, ed);
+
+#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
+
+       /*6. EXIF_TAG_MODEL */
+       __mmcamcorder_update_exif_model(handle, ed);
+
 #endif
        /*6. EXIF_TAG_IMAGE_DESCRIPTION */
        mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &str_value, &str_val_len, NULL);
@@ -1812,7 +2192,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        if (str_value && str_val_len > 0) {
                char *description = strdup(str_value);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION,
-                                           EXIF_FORMAT_ASCII, strlen(description), (unsigned char *)description);
+                                           EXIF_FORMAT_ASCII, strlen(description), (const char *)description);
                free(description);
                str_value = NULL;
                str_val_len = 0;
@@ -1824,6 +2204,8 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        }
 
        /*7. EXIF_TAG_SOFTWARE*/
+       __mmcamcorder_update_exif_software(handle, ed);
+
 /*
        if (control != NULL) {
                char software[50] = {0,};
@@ -1832,26 +2214,14 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                len = snprintf(software, sizeof(software), "%x.%x ", avsys_exif_info.software_used>>8,(avsys_exif_info.software_used & 0xff));
                _mmcam_dbg_log("software [%s], len [%d]", software, len);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE,
-                                           EXIF_FORMAT_ASCII, len, software);
+                                           EXIF_FORMAT_ASCII, len, (const char *)software);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_SOFTWARE);
                }
        }
 */
 
-       /*8. EXIF_TAG_ORIENTATION */
-       mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL);
-       _mmcam_dbg_log("get orientation [%d]",value);
-       if (value == 0) {
-               value = MM_EXIF_ORIENTATION;
-       }
-
-       exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value);
-       ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_ORIENTATION,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char*)&eshort[cnts++]);
-       if (ret != MM_ERROR_NONE) {
-               EXIF_SET_ERR(ret, EXIF_TAG_ORIENTATION);
-       }
+       __mmcamcorder_update_exif_orientation(handle, ed);
 
        /* START INSERT EXIF_IFD */
 
@@ -1861,7 +2231,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        if (user_comment) {
                _mmcam_dbg_log("user_comment=%s",user_comment);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_USER_COMMENT,
-                                           EXIF_FORMAT_ASCII, strlen(user_comment), (unsigned char *)user_comment);
+                                           EXIF_FORMAT_ASCII, strlen(user_comment), (const char *)user_comment);
                free(user_comment);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_USER_COMMENT);
@@ -1875,7 +2245,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        if (control != NULL) {
                exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.colorspace);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COLOR_SPACE,
-                                           EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                           EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_COLOR_SPACE);
                }
@@ -1886,7 +2256,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                config = avsys_exif_info.component_configuration;
                _mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ",config);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION,
-                                           EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&config);
+                                           EXIF_FORMAT_UNDEFINED, 4, (const char *)&config);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_COMPONENTS_CONFIGURATION);
                }
@@ -1904,7 +2274,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                ExifRational rData;
 
                _mmcam_dbg_log("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
-                              avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator)
+                              avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator);
 
                b = malloc(sizeof(ExifRational));
                if (b) {
@@ -1913,7 +2283,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                        exif_set_rational(b, exif_data_get_byte_order(ed), rData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_TIME,
-                                                   EXIF_FORMAT_RATIONAL, 1, b);
+                                                   EXIF_FORMAT_RATIONAL, 1, (const char *)b);
                        free(b);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_TIME);
@@ -1940,7 +2310,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                        rData.denominator = avsys_exif_info.aperture_f_num_denominator;
                        exif_set_rational(b, exif_data_get_byte_order(ed), rData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FNUMBER,
-                                                   EXIF_FORMAT_RATIONAL, 1, b);
+                                                   EXIF_FORMAT_RATIONAL, 1, (const char *)b);
                        free(b);
                        if(ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_FNUMBER);
@@ -1958,7 +2328,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_EXPOSURE_PROGRAM;
        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_PROGRAM,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_PROGRAM);
        }
@@ -1968,7 +2338,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                _mmcam_dbg_log("EXIF_TAG_ISO_SPEED_RATINGS [%d]", avsys_exif_info.iso);
                exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.iso);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_ISO_SPEED_RATINGS,
-                                           EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                           EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_ISO_SPEED_RATINGS);
                }
@@ -1988,7 +2358,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                        rsData.denominator = avsys_exif_info.shutter_speed_denominator;
                        exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE,
-                                                   EXIF_FORMAT_SRATIONAL, 1, b);
+                                                   EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
                        free(b);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_SHUTTER_SPEED_VALUE);
@@ -2014,7 +2384,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                        rData.denominator = 1;
                        exif_set_rational(b, exif_data_get_byte_order(ed), rData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_APERTURE_VALUE,
-                                                   EXIF_FORMAT_RATIONAL, 1, b);
+                                                   EXIF_FORMAT_RATIONAL, 1, (const char *)b);
                        free(b);
                        if(ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_APERTURE_VALUE);
@@ -2040,7 +2410,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                        rsData.denominator = avsys_exif_info.brightness_denominator;
                        exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE,
-                                                   EXIF_FORMAT_SRATIONAL, 1, b);
+                                                   EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
                        free(b);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_BRIGHTNESS_VALUE);
@@ -2055,29 +2425,26 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
        /*21. EXIF_TAG_EXPOSURE_BIAS_VALUE*/
        value = 0;
-       MMCamAttrsInfo info;
-       mm_camcorder_get_attribute_info(handle, MMCAM_FILTER_BRIGHTNESS, &info);
-
        ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_BRIGHTNESS, &value, NULL);
        if (ret == MM_ERROR_NONE) {
                unsigned char *b = NULL;
                ExifSRational rsData;
 
-               _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d",value);
+               _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d",
+                              value, hcamcorder->brightness_default, hcamcorder->brightness_step_denominator);
 
                b = malloc(sizeof(ExifSRational));
                if (b) {
-                       if( info.int_range.min < info.int_range.max) {
-                               rsData.numerator = (value - 4) * 5;
-                               rsData.denominator = 10;
-                       }
-                       else {
-                               rsData.numerator = 0;
-                               rsData.denominator = 10;
+                       rsData.numerator = value - hcamcorder->brightness_default;
+                       if (hcamcorder->brightness_step_denominator != 0) {
+                               rsData.denominator = hcamcorder->brightness_step_denominator;
+                       } else {
+                               _mmcam_dbg_warn("brightness_step_denominator is ZERO, so set 1");
+                               rsData.denominator = 1;
                        }
                        exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE,
-                                                   EXIF_FORMAT_SRATIONAL, 1, b);
+                                                   EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
                        free(b);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_BIAS_VALUE);
@@ -2122,7 +2489,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed),avsys_exif_info.metering_mode);
                _mmcam_dbg_log("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE,
-                                           EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                           EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_METERING_MODE);
                }
@@ -2135,7 +2502,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order (ed),avsys_exif_info.flash);
                _mmcam_dbg_log("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH,
-                                           EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                           EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_FLASH);
                }
@@ -2155,7 +2522,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
                        rData.denominator = avsys_exif_info.focal_len_denominator;
                        exif_set_rational(b, exif_data_get_byte_order(ed), rData);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FOCAL_LENGTH,
-                                                   EXIF_FORMAT_RATIONAL, 1, b);
+                                                   EXIF_FORMAT_RATIONAL, 1, (const char *)b);
                        free(b);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH);
@@ -2173,7 +2540,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_SENSING_MODE;
        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order (ed),value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SENSING_METHOD,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_SENSING_METHOD);
        }
@@ -2183,7 +2550,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_FILE_SOURCE;
        exif_set_long(&elong[cntl], exif_data_get_byte_order(ed),value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FILE_SOURCE,
-                                   EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&elong[cntl++]);
+                                   EXIF_FORMAT_UNDEFINED, 4, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_FILE_SOURCE);
        }
@@ -2194,7 +2561,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_SCENE_TYPE;
        exif_set_long(&elong[cntl], exif_data_get_byte_order(ed),value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SCENE_TYPE,
-                                   EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&elong[cntl++]);
+                                   EXIF_FORMAT_UNDEFINED, 4, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_SCENE_TYPE);
        }
@@ -2205,7 +2572,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_EXPOSURE_MODE;
        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed),value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_MODE,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_MODE);
        }
@@ -2216,7 +2583,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        if (ret == MM_ERROR_NONE) {
                int set_value = 0;
                _mmcam_dbg_log("WHITE BALANCE [%d]", value);
-       
+
                if (value == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC) {
                        set_value = 0;
                } else {
@@ -2225,7 +2592,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), set_value);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_WHITE_BALANCE,
-                                           EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                           EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_WHITE_BALANCE);
                }
@@ -2241,7 +2608,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                exif_set_long(&elong[cntl], exif_data_get_byte_order(ed), value);
                ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO,
-                                           EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+                                           EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
                if (ret != MM_ERROR_NONE) {
                        EXIF_SET_ERR(ret, EXIF_TAG_DIGITAL_ZOOM_RATIO);
                }
@@ -2256,7 +2623,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_FOCAL_LENGTH_35MMFILM;
        exif_set_short(&eshort[cnts], exif_data_get_byte_order(ed),value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM);
        }
@@ -2284,7 +2651,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), scene_capture_type);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SCENE_CAPTURE_TYPE,
-                                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_SCENE_CAPTURE_TYPE);
                        }
@@ -2299,7 +2666,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        value = MM_GAIN_CONTROL;
        exif_set_long(&elong[cntl], exif_data_get_byte_order(ed), value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_GAIN_CONTROL,
-                                   EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+                                   EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_GAIN_CONTROL);
        }
@@ -2330,7 +2697,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_CONTRAST,
-                                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_CONTRAST);
                        }
@@ -2363,7 +2730,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SATURATION,
-                                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_SATURATION);
                        }
@@ -2396,7 +2763,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
 
                        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
                        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SHARPNESS,
-                                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
                        if (ret != MM_ERROR_NONE) {
                                EXIF_SET_ERR(ret, EXIF_TAG_SHARPNESS);
                        }
@@ -2411,301 +2778,13 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int
        _mmcam_dbg_log("DISTANCE_RANGE [%d]", value);
        exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value);
        ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE_RANGE,
-                                   EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+                                   EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
        if (ret != MM_ERROR_NONE) {
                EXIF_SET_ERR(ret, EXIF_TAG_SUBJECT_DISTANCE_RANGE);
        }
 
        /* GPS information */
-       ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_GPS_ENABLE, &gps_enable, NULL);
-       if (ret == MM_ERROR_NONE && gps_enable) {
-               ExifByte GpsVersion[4]={2,2,0,0};
-
-               _mmcam_dbg_log("Tag for GPS is ENABLED.");
-
-               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_VERSION_ID,
-                                           EXIF_FORMAT_BYTE, 4, (unsigned char *)&GpsVersion);
-               if (ret != MM_ERROR_NONE) {
-                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_VERSION_ID);
-               }
-
-               /*41. Latitude*/
-               ret = mm_camcorder_get_attributes(handle, &err_name,
-                                                 MMCAM_TAG_LATITUDE, &f_latitude,
-                                                 MMCAM_TAG_LONGITUDE, &f_longitude,
-                                                 MMCAM_TAG_ALTITUDE, &f_altitude, NULL);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("failed to get gps info [%x][%s]", ret, err_name);
-                       SAFE_FREE(err_name);
-                       goto exit;
-               }
-
-               _mmcam_dbg_log("f_latitude [%f]", f_latitude);
-               if (f_latitude != INVALID_GPS_VALUE) {
-                       unsigned char *b = NULL;
-                       unsigned int deg;
-                       unsigned int min;
-                       unsigned int sec;
-                       ExifRational rData;
-
-                       if (f_latitude < 0) {
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
-                                                           EXIF_FORMAT_ASCII, 2, (unsigned char *)"S");
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
-                               }
-                               f_latitude = -f_latitude;
-                       } else if (f_latitude > 0) {
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
-                                                           EXIF_FORMAT_ASCII, 2, (unsigned char *)"N");
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
-                               }
-                       }
-
-                       deg = (unsigned int)(f_latitude);
-                       min = (unsigned int)((f_latitude-deg)*60);
-                       sec = (unsigned int)(((f_latitude-deg)*3600)-min*60);
-
-                       _mmcam_dbg_log("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec);
-                       b = malloc(3 * sizeof(ExifRational));
-                       if (b) {
-                               rData.numerator = deg;
-                               rData.denominator = 1;
-                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
-                               rData.numerator = min;
-                               exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
-                               rData.numerator = sec;
-                               exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
-
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE,
-                                                           EXIF_FORMAT_RATIONAL, 3, (unsigned char *)b);
-                               free(b);
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE);
-                               }
-                       } else {
-                               _mmcam_dbg_warn("malloc failed");
-                       }
-               }
-
-               /*42. Longitude*/
-               _mmcam_dbg_log("f_longitude [%f]", f_longitude);
-               if (f_longitude != INVALID_GPS_VALUE) {
-                       unsigned char *b = NULL;
-                       unsigned int deg;
-                       unsigned int min;
-                       unsigned int sec;
-                       ExifRational rData;
-
-                       if (f_longitude < 0) {
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
-                                                           EXIF_FORMAT_ASCII, 2, (unsigned char *)"W");
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
-                               }
-                               f_longitude = -f_longitude;
-                       } else if (f_longitude > 0) {
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
-                                                           EXIF_FORMAT_ASCII, 2, (unsigned char *)"E");
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
-                               }
-                       }
-
-                       deg = (unsigned int)(f_longitude);
-                       min = (unsigned int)((f_longitude-deg)*60);
-                       sec = (unsigned int)(((f_longitude-deg)*3600)-min*60);
-
-                       _mmcam_dbg_log("f_longitude deg[%d], min[%d], sec[%d]", deg, min, sec);
-                       b = malloc(3 * sizeof(ExifRational));
-                       if (b) {
-                               rData.numerator = deg;
-                               rData.denominator = 1;
-                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
-                               rData.numerator = min;
-                               exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
-                               rData.numerator = sec;
-                               exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE,
-                                                           EXIF_FORMAT_RATIONAL, 3, (unsigned char *)b);
-                               free(b);
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE);
-                               }
-                       } else {
-                               _mmcam_dbg_warn("malloc failed");
-                       }
-               }
-
-               /*43. Altitude*/
-               _mmcam_dbg_log("f_altitude [%f]", f_altitude);
-               if (f_altitude != INVALID_GPS_VALUE) {
-                       ExifByte alt_ref = 0;
-                       unsigned char *b = NULL;
-                       ExifRational rData;
-                       b = malloc(sizeof(ExifRational));
-                       if (b) {
-                               if (f_altitude < 0) {
-                                       alt_ref = 1;
-                                       f_altitude = -f_altitude;
-                               }
-
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE_REF,
-                                                           EXIF_FORMAT_BYTE, 1, (unsigned char *)&alt_ref);
-                               if (ret != MM_ERROR_NONE) {
-                                       _mmcam_dbg_err("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF);
-                                       if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
-                                               free(b);
-                                               b = NULL;
-                                               goto exit;
-                                       }
-                               }
-
-                               rData.numerator = (unsigned int)(f_altitude + 0.5)*100;
-                               rData.denominator = 100;
-                               exif_set_rational(b, exif_data_get_byte_order(ed), rData);
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE,
-                                                           EXIF_FORMAT_RATIONAL, 1, (unsigned char *)b);
-                               free(b);
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE);
-                               }
-                       } else {
-                               _mmcam_dbg_warn("malloc failed");
-                       }
-               }
-
-               /*44. EXIF_TAG_GPS_TIME_STAMP*/
-               {
-                       double gps_timestamp = INVALID_GPS_VALUE;
-                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-time-stamp", &gps_timestamp, NULL);
-                       _mmcam_dbg_log("Gps timestamp [%f]", gps_timestamp);
-                       if (gps_timestamp > 0.0) {
-                               unsigned char *b = NULL;
-                               unsigned int hour;
-                               unsigned int min;
-                               unsigned int microsec;
-                               ExifRational rData;
-
-                               hour = (unsigned int)(gps_timestamp / 3600);
-                               min = (unsigned int)((gps_timestamp - 3600 * hour) / 60);
-                               microsec = (unsigned int)(((double)((double)gps_timestamp -(double)(3600 * hour)) -(double)(60 * min)) * 1000000);
-
-                               _mmcam_dbg_log("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec);
-                               b = malloc(3 * sizeof(ExifRational));
-                               if (b) {
-                                       rData.numerator = hour;
-                                       rData.denominator = 1;
-                                       exif_set_rational(b, exif_data_get_byte_order(ed), rData);
-
-                                       rData.numerator = min;
-                                       rData.denominator = 1;
-                                       exif_set_rational(b + 8, exif_data_get_byte_order(ed), rData);
-
-                                       rData.numerator = microsec;
-                                       rData.denominator = 1000000;
-                                       exif_set_rational(b + 16, exif_data_get_byte_order(ed), rData);
-
-                                       ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_TIME_STAMP,
-                                                                   EXIF_FORMAT_RATIONAL, 3, b);
-                                       free(b);
-                                       if (ret != MM_ERROR_NONE) {
-                                               EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP);
-                                       }
-                               } else {
-                                       _mmcam_dbg_warn( "malloc failed." );
-                               }
-                       }
-               }
-
-               /*45. EXIF_TAG_GPS_DATE_STAMP*/
-               {
-                       unsigned char *date_stamp = NULL;
-                       int date_stamp_len = 0;
-
-                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-date-stamp", &date_stamp, &date_stamp_len, NULL);
-
-                       if (date_stamp) {
-                               _mmcam_dbg_log("Date stamp [%s]", date_stamp);
-
-                               /* cause it should include NULL char */
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP,
-                                                           EXIF_FORMAT_ASCII, date_stamp_len + 1, date_stamp);
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_DATE_STAMP);
-                               }
-                       }
-               }
-
-               /*46. EXIF_TAG_GPS_PROCESSING_METHOD */
-               {
-                       unsigned char *processing_method = NULL;
-                       int processing_method_len = 0;
-
-                       mm_camcorder_get_attributes(handle, NULL, "tag-gps-processing-method", &processing_method, &processing_method_len, NULL);
-
-                       if (processing_method) {
-                               _mmcam_dbg_log("Processing method [%s]", processing_method);
-
-                               ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_PROCESSING_METHOD,
-                                                           EXIF_FORMAT_UNDEFINED, processing_method_len, processing_method);
-                               if (ret != MM_ERROR_NONE) {
-                                       EXIF_SET_ERR(ret, EXIF_TAG_GPS_PROCESSING_METHOD);
-                               }
-                       }
-               }
-       } else {
-               _mmcam_dbg_log( "Tag for GPS is DISABLED." );
-       }
-
-
-       /*47. EXIF_TAG_MAKER_NOTE*/
-       ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_MAKER_NOTE,
-                                   EXIF_FORMAT_UNDEFINED, 8, (unsigned char *)"SAMSUNG");
-       if (ret != MM_ERROR_NONE) {
-               EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
-       }
-
-       /* create and link samsung maker note */
-       ret = mm_exif_mnote_create(ed);
-       if (ret != MM_ERROR_NONE){
-               EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
-       } else {
-               _mmcam_dbg_log("Samsung makernote created");
-
-               /* add samsung maker note entries (param : data, tag, index, subtag index1, subtag index2) */
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_MNOTE_VERSION, 0, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
-               }
-       /*
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_DEVICE_ID, 2, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
-               }
-
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_SERIAL_NUM, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
-               }
-
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_COLOR_SPACE, 1, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
-               }
-       */
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_FACE_DETECTION, 0, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! ret=%x", ret);
-               }
-       /*
-               ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_MODEL_ID, _MNOTE_VALUE_NONE, 3, 2);
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
-               }
-       */
-       }
+       __mmcamcorder_update_exif_gps(handle, ed);
 
        _mmcam_dbg_log("");
 
@@ -2736,9 +2815,7 @@ static void __sound_status_changed_cb(keynode_t* node, void *data)
 
        info = hcamcorder->sub_context->info_image;
 
-       __ta__("        GET_IN_CB:VCONFKEY_SETAPPL_SOUND_STATUS_BOOL",
        vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
-       );
 
        _mmcam_dbg_log("DONE : sound status %d", info->sound_status);
 
@@ -2757,9 +2834,7 @@ static void __volume_level_changed_cb(void *data)
 
        info = hcamcorder->sub_context->info_image;
 
-       __ta__("        GET_IN_CB:mm_sound_volume_get_value",
-       mm_sound_volume_get_value(VOLUME_TYPE_MEDIA, &info->volume_level);
-       );
+       mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &info->volume_level);
 
        _mmcam_dbg_log("DONE : volume level %d", info->volume_level);
 
index a8916e2..e7decac 100644 (file)
 =======================================================================================*/
 #include <stdio.h>
 #include <stdarg.h>
-#include <sys/stat.h>
-#include <camsrcjpegenc.h>
 #include <sys/vfs.h> /* struct statfs */
+#include <sys/stat.h>
 #include <gst/video/video-info.h>
 
 #include "mm_camcorder_internal.h"
 #include "mm_camcorder_util.h"
+#include "mm_camcorder_sound.h"
 #include <mm_util_imgp.h>
 
 /*-----------------------------------------------------------------------
@@ -64,7 +64,7 @@
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
 /* STATIC INTERNAL FUNCTION */
-       
+
 //static gint          skip_mdat(FILE *f);
 static guint16           get_language_code(const char *str);
 static gchar*            str_to_utf8(const gchar *str);
@@ -174,86 +174,116 @@ gboolean _mmcamcorder_write_loci(FILE *f, _MMCamcorderLocationInfo info)
        
        if(!write_tag(f, "loci"))       // type
                return FALSE;
-       
+
        FPUTC_CHECK(0, f);              // version
 
        if(!write_to_24(f, 0))  // flags
                return FALSE;
-       
+
        if(!write_to_16(f, get_language_code("eng"))) // language
                return FALSE;
-       
+
        str = str_to_utf8("location_name");
-       
+
        FPUTS_CHECK(str, f); // name
        SAFE_FREE(str);
-       
+
        FPUTC_CHECK('\0', f);
        FPUTC_CHECK(0, f);              //role
-       
+
        if(!write_to_32(f, info.longitude))     // Longitude
                return FALSE;
-       
+
        if(!write_to_32(f, info.latitude)) // Latitude
                return FALSE;
-       
+
        if(! write_to_32(f, info.altitude))     // Altitude
                return FALSE;
-       
+
        str = str_to_utf8("Astronomical_body");
        FPUTS_CHECK(str, f);//Astronomical_body
        SAFE_FREE(str);
-       
+
        FPUTC_CHECK('\0', f);
-       
+
        str = str_to_utf8("Additional_notes");
        FPUTS_CHECK(str, f); // Additional_notes
        SAFE_FREE(str);
-       
+
        FPUTC_CHECK('\0', f);
-       
+
        if((current_pos = ftell(f))<0)
        {
-               _mmcam_dbg_err("ftell() returns negative value");       
+               _mmcam_dbg_err("ftell() returns negative value");
                return FALSE;
        }
-       
+
        if(! _mmcamcorder_update_size(f, pos, current_pos))
                return FALSE;
 
        return TRUE;
 }
 
+void _mmcamcorder_write_Latitude(FILE *f,int degreex10000)
+{
+       bool isNegative = (degreex10000 < 0);
+       char sign = isNegative? '-': '+';
+
+       // Handle the whole part
+       char str[9];
+       int wholePart = 0;
+       int fractionalPart = 0;
+
+       wholePart = degreex10000 / 10000;
+       if (wholePart == 0) {
+               snprintf(str, 5, "%c%.2d.", sign, wholePart);
+       } else {
+               snprintf(str, 5, "%+.2d.", wholePart);
+       }
+
+       // Handle the fractional part
+       fractionalPart = degreex10000 - (wholePart * 10000);
+       if (fractionalPart < 0) {
+               fractionalPart = -fractionalPart;
+       }
+       snprintf(&str[4], 5, "%.4d", fractionalPart);
+
+       // Do not write the null terminator
+       write_tag(f, str);
+
+       return;
+}
+
+
 gboolean _mmcamcorder_write_udta(FILE *f, _MMCamcorderLocationInfo info)
 {
        gint64 current_pos, pos;
 
        _mmcam_dbg_log("");
+
        if((pos = ftell(f))<0)
        {
-               _mmcam_dbg_err("ftell() returns negative value");       
+               _mmcam_dbg_err("ftell() returns negative value");
                return FALSE;
        }
-       
-       if(!write_to_32(f, 0))  //size 
+
+       if(!write_to_32(f, 0))  //size
                return FALSE;
-       
-       if(!write_tag(f, "udta"))       // type 
+
+       if(!write_tag(f, "udta"))       // type
                return FALSE;
-       
+
        if(! _mmcamcorder_write_loci(f, info))
                return FALSE;
-       
+
        if((current_pos = ftell(f))<0)
        {
                _mmcam_dbg_err("ftell() returns negative value");
                return FALSE;
        }
+
        if(! _mmcamcorder_update_size(f, pos, current_pos))
                return FALSE;
 
        return TRUE;
 }
@@ -346,6 +376,28 @@ int _mmcamcorder_get_freespace(const gchar *path, guint64 *free_space)
 }
 
 
+int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type)
+{
+       struct statfs fs;
+
+       g_assert(path);
+
+       if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+               _mmcam_dbg_log("File(%s) doesn't exist.", path);
+               return -2;
+       }
+
+       if (-1 == statfs(path, &fs)) {
+               _mmcam_dbg_log("statfs failed.(%s)", path);
+               return -1;
+       }
+
+       *file_system_type = (int)fs.f_type;
+
+       return 0;
+}
+
+
 int _mmcamcorder_get_file_size(const char *filename, guint64 *size)
 {
        struct stat buf;
@@ -365,57 +417,52 @@ void _mmcamcorder_remove_buffer_probe(MMHandleType handle, _MMCamcorderHandlerCa
 
        mmf_return_if_fail(hcamcorder);
 
-       if(!hcamcorder->buffer_probes)
-       {
-               _mmcam_dbg_err("Fail to remove buffer probe, list for buffer probe is NULL");
+       if (!hcamcorder->buffer_probes) {
+               _mmcam_dbg_warn("list for buffer probe is NULL");
+               return;
        }
 
-       list = hcamcorder->buffer_probes;
+       _mmcam_dbg_log("start - category : 0x%x", category);
 
-       while(list)
-       {       
+       list = hcamcorder->buffer_probes;
+       while (list) {
                item = list->data;
-
-               if(!item)
-               {
+               if (!item) {
                        _mmcam_dbg_err("Remove buffer probe faild, the item is NULL");
-                       list =  g_list_next(list);
-                       continue;                       
+                       list = g_list_next(list);
+                       continue;
                }
 
-               if(item->category & category)
-               {
-               
-                       if(item->object && GST_IS_PAD(item->object))
-                       {
-                               _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]", 
-                                               GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
-                gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
-                       }
-                       else
-                       {
+               if (item->category & category) {
+                       if (item->object && GST_IS_PAD(item->object)) {
+                               _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]",
+                                              GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
+                               gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+                       } else {
                                _mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it");
-                       }                       
-                       
-                       list =  g_list_next(list);
+                       }
+
+                       list = g_list_next(list);
                        hcamcorder->buffer_probes = g_list_remove(hcamcorder->buffer_probes, item);
                        SAFE_FREE(item);
-               }
-               else
-               {
+               } else {
                        _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
-                       list =  g_list_next(list);
+                       list = g_list_next(list);
                }
        }
 
-       if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
-       {
+       if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
                g_list_free(hcamcorder->buffer_probes);
                hcamcorder->buffer_probes = NULL;
        }
+
+       _mmcam_dbg_log("done");
+
+       return;
 }
 
-void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
+
+void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object)
 {
        mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
        GList *list = NULL;
@@ -423,57 +470,49 @@ void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCat
 
        mmf_return_if_fail(hcamcorder);
 
-       if(!hcamcorder->event_probes)
-       {
-               _mmcam_dbg_err("Fail to remove event probe, list for event probe is NULL");
+       if (!hcamcorder->buffer_probes) {
+               _mmcam_dbg_warn("list for buffer probe is NULL");
+               return;
        }
 
-       list = hcamcorder->event_probes;
+       _mmcam_dbg_log("start - object : %p", object);
 
-       while(list)
-       {       
+       list = hcamcorder->buffer_probes;
+       while (list) {
                item = list->data;
-
-               if(!item)
-               {
-                       _mmcam_dbg_err("Remove event probe faild, the item is NULL");
-                       list =  g_list_next(list);
-                       continue;                       
+               if (!item) {
+                       _mmcam_dbg_err("Remove buffer probe faild, the item is NULL");
+                       list = g_list_next(list);
+                       continue;
                }
 
-               if(item->category & category)
-               {
-               
-                       if(item->object && GST_IS_PAD(item->object))
-                       {
-                               _mmcam_dbg_log("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]", 
-                                               GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
-                gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+               if (item->object && item->object == object) {
+                       if (GST_IS_PAD(item->object)) {
+                               _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]",
+                                              GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
+                               gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+                       } else {
+                               _mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it");
                        }
-                       else
-                       {
-                               _mmcam_dbg_warn("Remove event probe faild, the pad is null or not pad, just remove item from list and free it");
-                       }                       
-                       
-                       list =  g_list_next(list);
-                       hcamcorder->event_probes = g_list_remove(hcamcorder->event_probes, item);
+
+                       list = g_list_next(list);
+                       hcamcorder->buffer_probes = g_list_remove(hcamcorder->buffer_probes, item);
                        SAFE_FREE(item);
-               }
-               else
-               {
+
+                       break;
+               } else {
                        _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
-                       list =  g_list_next(list);
+                       list = g_list_next(list);
                }
        }
 
-       if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
-       {
-               g_list_free(hcamcorder->event_probes);
-               hcamcorder->event_probes = NULL;
-       }       
+       _mmcam_dbg_log("done");
+
+       return;
 }
 
-void _mmcamcorder_remove_data_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
+
+void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
 {
        mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
        GList *list = NULL;
@@ -481,56 +520,51 @@ void _mmcamcorder_remove_data_probe(MMHandleType handle, _MMCamcorderHandlerCate
 
        mmf_return_if_fail(hcamcorder);
 
-       if(!hcamcorder->data_probes)
-       {
-               _mmcam_dbg_err("Fail to remove data probe, list for data probe is NULL");
+       if (!hcamcorder->event_probes) {
+               _mmcam_dbg_warn("list for event probe is NULL");
+               return;
        }
 
-       list = hcamcorder->data_probes;
+       _mmcam_dbg_log("start - category : 0x%x", category);
 
-       while(list)
-       {       
+       list = hcamcorder->event_probes;
+       while (list) {
                item = list->data;
-
-               if(!item)
-               {
-                       _mmcam_dbg_err("Remove data probe faild, the item is NULL");
-                       list =  g_list_next(list);
-                       continue;                       
+               if (!item) {
+                       _mmcam_dbg_err("Remove event probe faild, the item is NULL");
+                       list = g_list_next(list);
+                       continue;
                }
 
-               if(item->category & category)
-               {
-               
-                       if(item->object && GST_IS_PAD(item->object))
-                       {
-                               _mmcam_dbg_log("Remove data probe on [%s:%s] - [ID : %lu], [Category : %x]", 
-                                               GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
-                gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+               if (item->category & category) {
+                       if (item->object && GST_IS_PAD(item->object)) {
+                               _mmcam_dbg_log("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]",
+                                              GST_DEBUG_PAD_NAME(item->object), item->handler_id,  item->category);
+                               gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+                       } else {
+                               _mmcam_dbg_warn("Remove event probe faild, the pad is null or not pad, just remove item from list and free it");
                        }
-                       else
-                       {
-                               _mmcam_dbg_warn("Remove data probe faild, the pad is null or not pad, just remove item from list and free it");
-                       }                       
-                       
-                       list =  g_list_next(list);
-                       hcamcorder->data_probes = g_list_remove(hcamcorder->data_probes, item);
+
+                       list = g_list_next(list);
+                       hcamcorder->event_probes = g_list_remove(hcamcorder->event_probes, item);
                        SAFE_FREE(item);
-               }
-               else
-               {
+               } else {
                        _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
-                       list =  g_list_next(list);
+                       list = g_list_next(list);
                }
        }
 
-       if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
-       {
-               g_list_free(hcamcorder->data_probes);
-               hcamcorder->data_probes = NULL;
-       }               
+       if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
+               g_list_free(hcamcorder->event_probes);
+               hcamcorder->event_probes = NULL;
+       }
+
+       _mmcam_dbg_log("done");
+
+       return;
 }
 
+
 void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCategory category)
 {
        mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
@@ -539,77 +573,66 @@ void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCate
 
        mmf_return_if_fail(hcamcorder);
 
-       if(!hcamcorder->signals)
-       {
-               _mmcam_dbg_err("Fail to disconnect signals, list for signal is NULL");
+       if (!hcamcorder->signals) {
+               _mmcam_dbg_warn("list for signal is NULL");
+               return;
        }
 
-       list = hcamcorder->signals;
+       _mmcam_dbg_log("start - category : 0x%x", category);
 
-       while(list)
-       {       
+       list = hcamcorder->signals;
+       while (list) {
                item = list->data;
-
-               if(!item)
-               {
+               if (!item) {
                        _mmcam_dbg_err("Fail to Disconnecting signal, the item is NULL");
-                       list =  g_list_next(list);
-                       continue;                       
+                       list = g_list_next(list);
+                       continue;
                }
 
-               if(item->category & category)
-               {
-               
-                       if(item->object && GST_IS_ELEMENT(item->object))
-                       {
-                               if ( g_signal_handler_is_connected ( item->object, item->handler_id ) )
-                               {
-                                       _mmcam_dbg_log("Disconnect signal from [%s] : [ID : %lu], [Category : %x]", 
-                                                                       GST_OBJECT_NAME(item->object), item->handler_id,  item->category);                      
-                                       g_signal_handler_disconnect ( item->object, item->handler_id );
-                               }
-                               else
-                               {
-                                       _mmcam_dbg_warn("Signal was not connected, cannot disconnect it :  [%s]  [ID : %lu], [Category : %x]", 
-                                                                               GST_OBJECT_NAME(item->object), item->handler_id,  item->category);
+               if (item->category & category) {
+                       if (item->object && GST_IS_ELEMENT(item->object)) {
+                               if (g_signal_handler_is_connected(item->object, item->handler_id)) {
+                                       _mmcam_dbg_log("Disconnect signal from [%s] : [ID : %lu], [Category : %x]",
+                                                      GST_OBJECT_NAME(item->object), item->handler_id,  item->category);
+                                       g_signal_handler_disconnect(item->object, item->handler_id);
+                               } else {
+                                       _mmcam_dbg_warn("Signal was not connected, cannot disconnect it :  [%s]  [ID : %lu], [Category : %x]",
+                                                       GST_OBJECT_NAME(item->object), item->handler_id,  item->category);
                                }
-
-                       }
-                       else
-                       {
+                       } else {
                                _mmcam_dbg_err("Fail to Disconnecting signal, the element is null or not element, just remove item from list and free it");
-                       }                       
-                       
-                       list =  g_list_next(list);
+                       }
+
+                       list = g_list_next(list);
                        hcamcorder->signals = g_list_remove(hcamcorder->signals, item);
                        SAFE_FREE(item);
-               }
-               else
-               {
+               } else {
                        _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
-                       list =  g_list_next(list);
+                       list = g_list_next(list);
                }
        }
 
-       if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
-       {
+       if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
                g_list_free(hcamcorder->signals);
                hcamcorder->signals = NULL;
-       }               
+       }
+
+       _mmcam_dbg_log("done");
+
+       return;
 }
 
+
 void _mmcamcorder_remove_all_handlers(MMHandleType handle,  _MMCamcorderHandlerCategory category)
 {
        mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
 
-       _mmcam_dbg_log("ENTER");        
+       _mmcam_dbg_log("ENTER");
 
        if(hcamcorder->signals)
                _mmcamcorder_disconnect_signal((MMHandleType)hcamcorder, category);
-       if(hcamcorder->data_probes)
-               _mmcamcorder_remove_data_probe((MMHandleType)hcamcorder, category);
        if(hcamcorder->event_probes)
-               _mmcamcorder_remove_event_probe((MMHandleType)hcamcorder, category);    
+               _mmcamcorder_remove_event_probe((MMHandleType)hcamcorder, category);
        if(hcamcorder->buffer_probes)
                _mmcamcorder_remove_buffer_probe((MMHandleType)hcamcorder, category);
 
@@ -620,18 +643,36 @@ void _mmcamcorder_remove_all_handlers(MMHandleType handle,  _MMCamcorderHandlerC
 void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_was)
 {
        int i=0;
-       _MMCamcorderSubContext *sc = (_MMCamcorderSubContext *)data;    
+       _MMCamcorderSubContext *sc = (_MMCamcorderSubContext *)data;
+
        mmf_return_if_fail(sc);
        mmf_return_if_fail(sc->element);
 
-       for (i = 0 ; i < _MMCamcorder_PIPELINE_ELEMENT_NUM ; i++) {
+       for (i = 0 ; i < _MMCAMCORDER_PIPELINE_ELEMENT_NUM ; i++) {
                if (sc->element[i].gst && (G_OBJECT(sc->element[i].gst) == where_the_object_was)) {
-                       _mmcam_dbg_log("The element[%d][%p] is finalized", sc->element[i].id, sc->element[i].gst);
+                       _mmcam_dbg_warn("The element[%d][%p] is finalized",
+                                       sc->element[i].id, sc->element[i].gst);
                        sc->element[i].gst = NULL;
                        sc->element[i].id = _MMCAMCORDER_NONE;
-                       break;
+                       return;
+               }
+       }
+
+       mmf_return_if_fail(sc->encode_element);
+
+       for (i = 0 ; i < _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM ; i++) {
+               if (sc->encode_element[i].gst && (G_OBJECT(sc->encode_element[i].gst) == where_the_object_was)) {
+                       _mmcam_dbg_warn("The encode element[%d][%p] is finalized",
+                                       sc->encode_element[i].id, sc->encode_element[i].gst);
+                       sc->encode_element[i].gst = NULL;
+                       sc->encode_element[i].id = _MMCAMCORDER_ENCODE_NONE;
+                       return;
                }
        }
+
+       _mmcam_dbg_warn("there is no matching element %p", where_the_object_was);
+
+       return;
 }
 
 
@@ -642,30 +683,37 @@ _mmcamcroder_msg_callback(void *data)
        mmf_camcorder_t *hcamcorder = NULL;
        mmf_return_val_if_fail(item, FALSE);
 
+       pthread_mutex_lock(&(item->lock));
+
        hcamcorder = MMF_CAMCORDER(item->handle);
-       mmf_return_val_if_fail(hcamcorder, FALSE);
+       if (hcamcorder == NULL) {
+               _mmcam_dbg_warn("msg id:%x, item:%p, handle is NULL", item->id, item);
+               goto MSG_CALLBACK_DONE;
+       }
+
 
        /*_mmcam_dbg_log("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item);*/
 
-       _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder);
+       _MMCAMCORDER_LOCK((MMHandleType)hcamcorder);
 
-       /* check delay of CAPTURED message */
-       if (item->id == MM_MESSAGE_CAMCORDER_CAPTURED) {
-               MMTA_ACUM_ITEM_END("                CAPTURED MESSAGE DELAY", FALSE);
+       /* remove item from msg data */
+       if (hcamcorder->msg_data) {
+               hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
+       } else {
+               _mmcam_dbg_warn("msg_data is NULL but item[%p] will be removed", item);
        }
 
+       _MMCAMCORDER_UNLOCK((MMHandleType)hcamcorder);
+
+       _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder);
+
        if ((hcamcorder) && (hcamcorder->msg_cb)) {
                hcamcorder->msg_cb(item->id, (MMMessageParamType*)(&(item->param)), hcamcorder->msg_cb_param);
        }
 
        _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(hcamcorder);
 
-       _MMCAMCORDER_LOCK((MMHandleType)hcamcorder);
-
-       if (hcamcorder->msg_data) {
-               hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
-       }
-
+MSG_CALLBACK_DONE:
        /* release allocated memory */
        if (item->id == MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO) {
                MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)item->param.data;
@@ -679,11 +727,12 @@ _mmcamcroder_msg_callback(void *data)
                item->param.size = 0;
        }
 
+       pthread_mutex_unlock(&(item->lock));
+       pthread_mutex_destroy(&(item->lock));
+
        free(item);
        item = NULL;
 
-       _MMCAMCORDER_UNLOCK((MMHandleType)hcamcorder);
-
        /* For not being called again */
        return FALSE;
 }
@@ -730,6 +779,7 @@ _mmcamcroder_send_message(MMHandleType handle, _MMCamcorderMsgItem *data)
        item = g_malloc(sizeof(_MMCamcorderMsgItem));
        memcpy(item, data, sizeof(_MMCamcorderMsgItem));
        item->handle = handle;
+       pthread_mutex_init(&(item->lock), NULL);
 
        _MMCAMCORDER_LOCK(handle);
        hcamcorder->msg_data = g_list_append(hcamcorder->msg_data, item);
@@ -756,31 +806,50 @@ _mmcamcroder_remove_message_all(MMHandleType handle)
 
        _MMCAMCORDER_LOCK(handle);
 
-       if(!hcamcorder->msg_data)
-       {
+       if (!hcamcorder->msg_data) {
                _mmcam_dbg_log("No message data is remained.");
-       }
-       else
-       {
+       } else {
                list = hcamcorder->msg_data;
 
-               while(list)
-               {
+               while (list) {
                        item = list->data;
-                       list =  g_list_next(list);
+                       list = g_list_next(list);
 
-                       if(!item)
-                       {
+                       if (!item) {
                                _mmcam_dbg_err("Fail to remove message. The item is NULL");
-                       }
-                       else
-                       {
-                               ret = g_idle_remove_by_data (item);
-                               _mmcam_dbg_log("Remove item[%p]. ret[%d]", item, ret);
-
-                               hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
-
-                               SAFE_FREE(item);
+                       } else {
+                               if (pthread_mutex_trylock(&(item->lock))) {
+                                       ret = g_idle_remove_by_data (item);
+                                       _mmcam_dbg_log("Remove item[%p]. ret[%d]", item, ret);
+
+                                       hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
+
+                                       if (ret ) {
+                                               /* release allocated memory */
+                                               if (item->id == MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO) {
+                                                       MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)item->param.data;
+                                                       if (cam_fd_info) {
+                                                               SAFE_FREE(cam_fd_info->face_info);
+                                                               free(cam_fd_info);
+                                                               cam_fd_info = NULL;
+                                                       }
+
+                                                       item->param.data = NULL;
+                                                       item->param.size = 0;
+                                               }
+
+                                               pthread_mutex_unlock(&(item->lock));
+                                               pthread_mutex_destroy(&(item->lock));
+                                               SAFE_FREE(item);
+                                       } else {
+                                               item->handle = 0;
+                                               _mmcam_dbg_warn("Fail to remove item[%p]", item);
+
+                                               pthread_mutex_unlock(&item->lock);
+                                       }
+                               } else {
+                                       _mmcam_dbg_warn("item lock failed. it's being called...");
+                               }
                        }
                }
 
@@ -800,40 +869,6 @@ _mmcamcroder_remove_message_all(MMHandleType handle)
 }
 
 
-void
-_mmcamcorder_err_trace_write( char *str_filename, char *func_name, int line_num, char *fmt, ... )
-{
-       FILE *f    = NULL;
-       va_list ap = {0};
-       char time_string[TIME_STRING_MAX_LEN] = {'\0',};
-
-       time_t current_time;
-       struct tm new_time;
-
-       mmf_return_if_fail( str_filename );
-
-       current_time = time( NULL );
-       localtime_r( &current_time, &new_time );
-
-       f = fopen( str_filename, "a" );
-       if( f == NULL )
-       {
-               _mmcam_dbg_warn( "Failed to open file.[%s]", str_filename );
-               return;
-       }
-
-       asctime_r(&new_time, time_string);
-       fprintf( f, "[%.19s][%05d][%s]", time_string, line_num, func_name );
-
-       va_start( ap, fmt );
-       vfprintf( f, fmt, ap );
-       va_end( ap );
-
-       fprintf( f, "\n" );
-
-       fclose( f );
-}
-
 int _mmcamcorder_get_pixel_format(GstCaps *caps)
 {
        const GstStructure *structure;
@@ -841,32 +876,34 @@ int _mmcamcorder_get_pixel_format(GstCaps *caps)
        GstVideoInfo media_info;
        MMPixelFormatType type = 0;
        unsigned int fourcc = 0;
-       
-    mmf_return_val_if_fail( caps != NULL, MM_PIXEL_FORMAT_INVALID );
+
+       mmf_return_val_if_fail( caps != NULL, MM_PIXEL_FORMAT_INVALID );
 
        structure = gst_caps_get_structure (caps, 0);
        media_type = gst_structure_get_name (structure);
 
-       if (!strcmp (media_type, "image/jpeg") )
-       {
+       if (!strcmp (media_type, "image/jpeg") ) {
                _mmcam_dbg_log("It is jpeg.");
                type = MM_PIXEL_FORMAT_ENCODED;
-       }
-       else if (!strcmp (media_type, "video/x-raw")
-               && gst_video_info_from_caps(&media_info, caps)
-               && GST_VIDEO_INFO_IS_YUV(&media_info))
-       {
+       } else if (!strcmp (media_type, "video/x-raw") &&
+                  gst_video_info_from_caps(&media_info, caps) &&
+                  GST_VIDEO_INFO_IS_YUV(&media_info)) {
                _mmcam_dbg_log("It is yuv.");
                fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info));
                type = _mmcamcorder_get_pixtype(fourcc);
-       }
-       else
-       {
+       } else if (!strcmp (media_type, "video/x-raw") &&
+                  GST_VIDEO_INFO_IS_RGB(&media_info)) {
+               _mmcam_dbg_log("It is rgb.");
+               type = MM_PIXEL_FORMAT_RGB888;
+       } else if (!strcmp (media_type, "video/x-h264")) {
+               _mmcam_dbg_log("It is H264");
+               type = MM_PIXEL_FORMAT_ENCODED_H264;
+       } else {
                _mmcam_dbg_err("Not supported format");
                type = MM_PIXEL_FORMAT_INVALID;
        }
-       
-       _mmcam_dbg_log( "Type [%d]", type );
+
+       /*_mmcam_dbg_log( "Type [%d]", type );*/
 
        return type;
 }
@@ -885,6 +922,13 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co
                        fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
                }
                break;
+       case MM_PIXEL_FORMAT_NV21:
+               if (use_zero_copy_format) {
+                       fourcc = GST_MAKE_FOURCC ('S', 'N', '2', '1');
+               } else {
+                       fourcc = GST_MAKE_FOURCC ('N', 'V', '2', '1');
+               }
+               break;
        case MM_PIXEL_FORMAT_YUYV:
                if (use_zero_copy_format) {
                        fourcc = GST_MAKE_FOURCC ('S', 'U', 'Y', 'V');
@@ -916,7 +960,7 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co
                fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', 'P');
                break;
        case MM_PIXEL_FORMAT_RGB888:
-               fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', '3');
+               fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
                break;
        case MM_PIXEL_FORMAT_ENCODED:
                if (codectype == MM_IMAGE_CODEC_JPEG) {
@@ -935,6 +979,9 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co
        case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
                fourcc = GST_MAKE_FOURCC('I','T','L','V');
                break;
+       case MM_PIXEL_FORMAT_ENCODED_H264:
+               fourcc = GST_MAKE_FOURCC('H','2','6','4');
+               break;
        default:
                _mmcam_dbg_log("Not proper pixel type[%d]. Set default - I420", pixtype);
                if (use_zero_copy_format) {
@@ -960,6 +1007,10 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc)
        case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
                pixtype = MM_PIXEL_FORMAT_NV12;
                break;
+       case GST_MAKE_FOURCC ('S', 'N', '2', '1'):
+       case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
+               pixtype = MM_PIXEL_FORMAT_NV21;
+               break;
        case GST_MAKE_FOURCC ('S', 'U', 'Y', 'V'):
        case GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'):
        case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
@@ -991,6 +1042,7 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc)
                break;
        case GST_MAKE_FOURCC ('B', 'G', 'R', 'A'):
        case GST_MAKE_FOURCC ('B', 'G', 'R', 'x'):
+       case GST_MAKE_FOURCC ('S', 'R', '3', '2'):
                pixtype = MM_PIXEL_FORMAT_RGBA;
                break;
        case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'):
@@ -1001,8 +1053,12 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc)
        case GST_MAKE_FOURCC ('I', 'T', 'L', 'V'):
                pixtype = MM_PIXEL_FORMAT_ITLV_JPEG_UYVY;
                break;
+       case GST_MAKE_FOURCC ('H', '2', '6', '4'):
+               pixtype = MM_PIXEL_FORMAT_ENCODED_H264;
+               break;
        default:
-               _mmcam_dbg_log("Not supported fourcc type(%x)", fourcc);
+               _mmcam_dbg_log("Not supported fourcc type(%c%c%c%c)",
+                              fourcc, fourcc>>8, fourcc>>16, fourcc>>24);
                pixtype = MM_PIXEL_FORMAT_INVALID;
                break;
        }
@@ -1011,68 +1067,55 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc)
 }
 
 
-gboolean
-_mmcamcorder_add_elements_to_bin( GstBin *bin, GList *element_list )
+gboolean _mmcamcorder_add_elements_to_bin(GstBin *bin, GList *element_list)
 {
        GList *local_list = element_list;
        _MMCamcorderGstElement *element = NULL;
 
-       mmf_return_val_if_fail( bin && local_list, FALSE );
+       mmf_return_val_if_fail(bin && local_list, FALSE);
 
-       while( local_list )
-       {
+       while (local_list) {
                element = (_MMCamcorderGstElement*)local_list->data;
-               if( element && element->gst )
-               {
-                       if( !gst_bin_add( bin, GST_ELEMENT(element->gst) ) )
-                       {
+               if (element && element->gst) {
+                       if (!gst_bin_add(bin, GST_ELEMENT(element->gst))) {
                                _mmcam_dbg_err( "Add element [%s] to bin [%s] FAILED",
                                                GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
                                                GST_ELEMENT_NAME(GST_ELEMENT(bin)) );
                                return FALSE;
-                       }
-                       else
-                       {
-                               _mmcam_dbg_log( "Add element [%s] to bin [%s] OK",
-                                               GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
-                                               GST_ELEMENT_NAME(GST_ELEMENT(bin)) );
+                       } else {
+                               _mmcam_dbg_log("Add element [%s] to bin [%s] OK",
+                                              GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
+                                              GST_ELEMENT_NAME(GST_ELEMENT(bin)));
                        }
                }
-
                local_list = local_list->next;
        }
 
        return TRUE;
 }
 
-gboolean
-_mmcamcorder_link_elements( GList *element_list )
+gboolean _mmcamcorder_link_elements(GList *element_list)
 {
        GList                  *local_list  = element_list;
        _MMCamcorderGstElement *element     = NULL;
        _MMCamcorderGstElement *pre_element = NULL;
 
-       mmf_return_val_if_fail( local_list, FALSE );
+       mmf_return_val_if_fail(local_list, FALSE);
 
        pre_element = (_MMCamcorderGstElement*)local_list->data;
        local_list = local_list->next;
 
-       while( local_list )
-       {
+       while (local_list) {
                element = (_MMCamcorderGstElement*)local_list->data;
-               if( element && element->gst )
-               {
-                       if( _MM_GST_ELEMENT_LINK( GST_ELEMENT(pre_element->gst), GST_ELEMENT(element->gst) ) )
-                       {
-                               _mmcam_dbg_log( "Link [%s] to [%s] OK",
-                                               GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
-                                               GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
-                       }
-                       else
-                       {
-                               _mmcam_dbg_err( "Link [%s] to [%s] FAILED",
-                                               GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
-                                               GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
+               if (element && element->gst) {
+                       if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(pre_element->gst), GST_ELEMENT(element->gst))) {
+                               _mmcam_dbg_log("Link [%s] to [%s] OK",
+                                              GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
+                                              GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
+                       } else {
+                               _mmcam_dbg_err("Link [%s] to [%s] FAILED",
+                                              GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
+                                              GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
                                return FALSE;
                        }
                }
@@ -1085,8 +1128,8 @@ _mmcamcorder_link_elements( GList *element_list )
 }
 
 
-gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int src_height, int src_length, int src_format,
-                                   unsigned char **dst_data, int *dst_width, int *dst_height, int *dst_length)
+gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_width, unsigned int src_height, unsigned int src_length, int src_format,
+                                   unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length)
 {
        int ret = TRUE;
        int mm_ret = MM_ERROR_NONE;
@@ -1116,6 +1159,9 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int s
        case MM_PIXEL_FORMAT_UYVY:
                input_format = MM_UTIL_IMG_FMT_UYVY;
                break;
+       case MM_PIXEL_FORMAT_RGB888:
+               input_format = MM_UTIL_IMG_FMT_RGB888;
+               break;
        default:
                _mmcam_dbg_err("NOT supported format", src_format);
                return FALSE;
@@ -1125,9 +1171,7 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int s
                        src_width, src_height, *dst_width, *dst_height);
 
        /* get length of resized image */
-       __ta__("        mm_util_get_image_size 2",
-    mm_ret = mm_util_get_image_size(input_format, *dst_width, *dst_height, (unsigned int*)dst_length);
-       );
+       mm_ret = mm_util_get_image_size(input_format, *dst_width, *dst_height, dst_length);
        if (mm_ret != MM_ERROR_NONE) {
                GST_ERROR("mm_util_get_image_size failed 0x%x", ret);
                return FALSE;
@@ -1141,10 +1185,8 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int s
                return FALSE;
        }
 
-       __ta__("        mm_util_resize_image",
        mm_ret = mm_util_resize_image(src_data, src_width, src_height, input_format,
-                                  dst_tmp_data, (unsigned int*)dst_width, (unsigned int*)dst_height);
-       );
+                                     dst_tmp_data, dst_width, dst_height);
        if (mm_ret != MM_ERROR_NONE) {
                GST_ERROR("mm_util_resize_image failed 0x%x", ret);
                free(dst_tmp_data);
@@ -1161,28 +1203,23 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int s
 
 gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsigned int src_height,
                                  int src_format, unsigned int src_length, unsigned int jpeg_quality,
-                                 void **result_data, unsigned int *result_length)
+                                 void **result_data, unsigned int *result_length, int enc_type)
 {
        int ret = 0;
        int i = 0;
-       int enc_type = JPEG_ENCODER_SOFTWARE;
        guint32 src_fourcc = 0;
        gboolean do_encode = FALSE;
        jpegenc_parameter enc_param;
-       static jpegenc_info enc_info = {-1,};
+       jpegenc_info enc_info;
 
-       _mmcam_dbg_log("START");
+       _mmcam_dbg_log("START - enc_type [%d]", enc_type);
 
        mmf_return_val_if_fail(src_data && result_data && result_length, FALSE);
 
        CLEAR(enc_param);
+       CLEAR(enc_info);
 
-       if (enc_info.sw_support == -1) {
-               CLEAR(enc_info);
-               __ta__("camsrcjpegenc_get_info",
-               camsrcjpegenc_get_info(&enc_info);
-               );
-       }
+       camsrcjpegenc_get_info(&enc_info);
 
        src_fourcc = _mmcamcorder_get_fourcc(src_format, 0, FALSE);
        camsrcjpegenc_get_src_fmt(src_fourcc, &(enc_param.src_fmt));
@@ -1193,7 +1230,7 @@ gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsign
        }
 
        /* check H/W encoder */
-       if (enc_info.hw_support) {
+       if (enc_info.hw_support && enc_type == JPEG_ENCODER_HARDWARE) {
                _mmcam_dbg_log("check H/W encoder supported format list");
                /* Check supported format */
                for (i = 0 ; i < enc_info.hw_enc.input_fmt_num ; i++) {
@@ -1236,9 +1273,7 @@ gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsign
                               src_width, src_height, src_length,
                               jpeg_quality, enc_type);
 
-               __ta__("                    camsrcjpegenc_encode",
                ret = camsrcjpegenc_encode(&enc_info, enc_type, &enc_param );
-               );
                if (ret == CAMSRC_JPEGENC_ERROR_NONE) {
                        *result_data = enc_param.result_data;
                        *result_length = enc_param.result_len;
@@ -1258,6 +1293,74 @@ gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsign
 }
 
 
+/* make UYVY smaller as multiple size. ex: 640x480 -> 320x240 or 160x120 ... */
+gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_width, unsigned int src_height,
+                                           unsigned char **dst, unsigned int dst_width, unsigned int dst_height)
+{
+       unsigned int i = 0;
+       int j = 0;
+       int k = 0;
+       int src_index = 0;
+       int ratio_width = 0;
+       int ratio_height = 0;
+       int line_base = 0;
+       int line_width = 0;
+       int jump_width = 0;
+       unsigned char *result = NULL;
+
+       if (src == NULL || dst == NULL) {
+               _mmcam_dbg_err("src[%p] or dst[%p] is NULL", src, dst);
+               return FALSE;
+       }
+
+       result = (unsigned char *)malloc((dst_width * dst_height)<<1);
+       if (!result) {
+               _mmcam_dbg_err("failed to alloc dst data");
+               return FALSE;
+       }
+
+       ratio_width = src_width / dst_width;
+       ratio_height = src_height / dst_height;
+       line_width = src_width << 1;
+       jump_width = ratio_width << 1;
+
+       _mmcam_dbg_warn("[src %dx%d] [dst %dx%d] [line width %d] [ratio width %d, height %d]",
+                       src_width, src_height, dst_width, dst_height,
+                       line_width, ratio_width, ratio_height);
+
+       for (i = 0 ; i < src_height ; i += ratio_height) {
+               line_base = i * line_width;
+               for (j = 0 ; j < line_width ; j += jump_width) {
+                       src_index = line_base + j;
+                       result[k++] = src[src_index];
+                       result[k++] = src[src_index+1];
+
+                       j += jump_width;
+                       src_index = line_base + j;
+                       if (src_index % 4 == 0) {
+                               result[k++] = src[src_index+2];
+                       } else {
+                               result[k++] = src[src_index];
+                       }
+                       result[k++] = src[src_index+1];
+               }
+       }
+
+       *dst = result;
+
+       _mmcam_dbg_warn("converting done - result %p", result);
+
+       return TRUE;
+}
+
+gboolean _mmcamcorder_check_file_path(const gchar *path)
+{
+       if(strstr(path, "/opt/usr") != NULL) {
+               return TRUE;
+       }
+       return FALSE;
+}
+
 static guint16 get_language_code(const char *str)
 {
     return (guint16) (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F);
@@ -1273,7 +1376,7 @@ static inline gboolean write_tag(FILE *f, const gchar *tag)
        while(*tag)
                FPUTC_CHECK(*tag++, f);
 
-       return TRUE;    
+       return TRUE;
 }
 
 static inline gboolean write_to_32(FILE *f, guint val)
@@ -1289,12 +1392,60 @@ static inline gboolean write_to_16(FILE *f, guint val)
 {
        FPUTC_CHECK(val >> 8, f);
        FPUTC_CHECK(val, f);
-       return TRUE;    
+       return TRUE;
 }
 
 static inline gboolean write_to_24(FILE *f, guint val)
 {
        write_to_16(f, val >> 8);
        FPUTC_CHECK(val, f);
-       return TRUE;    
+       return TRUE;
+}
+
+void *_mmcamcorder_util_task_thread_func(void *data)
+{
+       int ret = MM_ERROR_NONE;
+       mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)data;
+
+       if (!hcamcorder) {
+               _mmcam_dbg_err("handle is NULL");
+               return NULL;
+       }
+
+       _mmcam_dbg_warn("start thread");
+
+       pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+
+       while (hcamcorder->task_thread_state != _MMCAMCORDER_TASK_THREAD_STATE_EXIT) {
+               switch (hcamcorder->task_thread_state) {
+               case _MMCAMCORDER_TASK_THREAD_STATE_NONE:
+                       _mmcam_dbg_warn("wait for task signal");
+                       pthread_cond_wait(&(hcamcorder->task_thread_cond), &(hcamcorder->task_thread_lock));
+                       _mmcam_dbg_warn("task signal received : state %d", hcamcorder->task_thread_state);
+                       break;
+               case _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START:
+                       _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE, FALSE);
+                       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
+                       break;
+               case _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE:
+                       ret = _mmcamcorder_video_prepare_record((MMHandleType)hcamcorder);
+
+                       /* Play record start sound */
+                       _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_REC_START_SND, FALSE);
+
+                       _mmcam_dbg_log("_mmcamcorder_video_prepare_record return 0x%x", ret);
+                       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
+                       break;
+               default:
+                       _mmcam_dbg_warn("invalid task thread state %d", hcamcorder->task_thread_state);
+                       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT;
+                       break;
+               }
+       }
+
+       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+       _mmcam_dbg_warn("exit thread");
+
+       return NULL;
 }
index 88a4c52..c360f05 100644 (file)
@@ -23,6 +23,7 @@
 |  INCLUDE FILES                                                                       |
 =======================================================================================*/
 #include <gst/video/cameracontrol.h>
+#include <gst/app/gstappsrc.h>
 #include "mm_camcorder_internal.h"
 #include "mm_camcorder_videorec.h"
 
 /*---------------------------------------------------------------------------------------
 |    LOCAL VARIABLE DEFINITIONS for internal                                           |
 ---------------------------------------------------------------------------------------*/
-#define _MMCAMCORDER_MINIMUM_FRAME              3
+#define _MMCAMCORDER_MINIMUM_FRAME              5
 #define _MMCAMCORDER_RETRIAL_COUNT              10
 #define _MMCAMCORDER_FRAME_WAIT_TIME            200000 /* ms */
-#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL  5
 #define _OFFSET_COMPOSITION_MATRIX              40L
+#define _GOP_GEN_INTERVAL                       1000000000  /*nano seconds*/
 
 /*---------------------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                |
 ---------------------------------------------------------------------------------------*/
 /* STATIC INTERNAL FUNCTION */
+static void __mmcamcorder_video_stream_cb(GstElement *element, GstSample *sample, gpointer u_data);
 static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
 static GstPadProbeReturn __mmcamcorder_video_dataprobe_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
 static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
@@ -60,12 +62,85 @@ static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadPro
 /*---------------------------------------------------------------------------------------
 |    GLOBAL FUNCTION DEFINITIONS:                                                      |
 ---------------------------------------------------------------------------------------*/
-int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
+static void __mmcamcorder_video_stream_cb(GstElement *element, GstSample *sample, gpointer u_data)
 {
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
+       _MMCamcorderSubContext *sc = NULL;
+
+       GstBuffer *buffer = gst_sample_get_buffer(sample);
+       mmf_return_if_fail(buffer);
+       mmf_return_if_fail(gst_buffer_n_memory(buffer));
+       mmf_return_if_fail(hcamcorder);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+       mmf_return_if_fail(sc);
+
+       /*
+       _mmcam_dbg_log("ENTER - push_encoding_buffer %d, buffer %p, MALLOCDATA %p, size %d",
+                      sc->info_video->push_encoding_buffer, buffer, GST_BUFFER_MALLOCDATA(buffer), GST_BUFFER_SIZE(buffer));
+       */
+
+       /* push buffer in appsrc to encode */
+       if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_RUN &&
+           sc->info_video->record_dual_stream &&
+           sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst) {
+               GstFlowReturn ret = 0;
+               GstClock *pipe_clock = NULL;
+               GstPad *capsfilter_pad = NULL;
+
+               if(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+                       if(sc->info_video->is_firstframe) {
+                               sc->info_video->is_firstframe = FALSE;
+                               pipe_clock = GST_ELEMENT_CLOCK(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
+                               if (pipe_clock) {
+                                       gst_object_ref(pipe_clock);
+                                       sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer) - (gst_clock_get_time(pipe_clock) - GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst)->base_time);
+                                       gst_object_unref(pipe_clock);
+                               }
+                       }
+               } else {
+                       if(sc->info_video->is_firstframe) {
+                               sc->info_video->is_firstframe = FALSE;
+                               sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer);
+                       }
+               }
+
+               GST_BUFFER_PTS(buffer) = GST_BUFFER_PTS (buffer) - sc->info_video->base_video_ts;
+
+               capsfilter_pad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+//             gst_buffer_set_caps(buffer, gst_pad_get_current_caps(capsfilter_pad));
+               gst_object_unref(capsfilter_pad);
+               capsfilter_pad = NULL;
+
+               ret = gst_app_src_push_buffer((GstAppSrc *)sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, buffer);
+               if (ret != GST_FLOW_OK &&
+                   ret != GST_FLOW_FLUSHING) {
+                       _mmcam_dbg_err("gst_app_src_push_buffer failed [0x%x]", ret);
+                       gst_buffer_unref(buffer);
+                       buffer = NULL;
+               }
+
+               /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/
+       } else {
+               _mmcam_dbg_warn("unref video buffer immediately - push encoding buffer %d",
+                               sc->info_video->push_encoding_buffer);
+
+               gst_buffer_unref(buffer);
+               buffer = NULL;
+       }
+
+       return;
+}
+
+
+int _mmcamcorder_create_recorder_pipeline(MMHandleType handle)
+{
+       int i = 0;
        int err = MM_ERROR_NONE;
        int audio_disable = FALSE;
-       char* gst_element_rsink_name = NULL;
+       const char* gst_element_rsink_name = NULL;
 
+       GstBus *bus = NULL;
        GstPad *srcpad = NULL;
        GstPad *sinkpad = NULL;
 
@@ -79,22 +154,23 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
        mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-       
-       _mmcam_dbg_log("");
 
-       err = _mmcamcorder_check_videocodec_fileformat_compatibility( handle );
-       if( err != MM_ERROR_NONE )
-       {
+       _mmcam_dbg_warn("start");
+
+       err = _mmcamcorder_check_videocodec_fileformat_compatibility(handle);
+       if (err != MM_ERROR_NONE) {
                return err;
        }
 
-       /* Create gstreamer element */
-       /* Check main pipeline */
-       if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
-               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-               goto pipeline_creation_error;
+       /* Main pipeline */
+       if(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+               _mmcam_dbg_log("pipeline is exist so need to remove pipeline _MMCAMCORDER_ENCODE_MAIN_PIPE = %p",
+                              sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+               _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
        }
 
+       _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
+
        /* get audio disable */
        mm_camcorder_get_attributes(handle, NULL,
                                    MMCAM_AUDIO_DISABLE, &audio_disable,
@@ -109,40 +185,46 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
                       sc->audio_disable, sc->is_modified_rate, audio_disable);
 
        if (sc->audio_disable == FALSE) {
-               /* Sub pipeline */
-               __ta__("        __mmcamcorder_create_audiosrc_bin",
+               /* create audiosrc bin */
                err = _mmcamcorder_create_audiosrc_bin((MMHandleType)hcamcorder);
-               );
                if (err != MM_ERROR_NONE) {
                        return err;
                }
-
-               gst_bin_add(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                           sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
        }
 
-       __ta__("        _mmcamcorder_create_encodesink_bin",
        err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_VIDEO);
-       );
        if (err != MM_ERROR_NONE) {
                return err;
        }
 
-       gst_bin_add(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                   sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+       if (sc->audio_disable == FALSE) {
+               gst_bin_add(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                           sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+       }
+
+       /* add element and encodesink bin to encode main pipeline */
+       gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst,
+                        sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
+                        NULL);
 
-       /* Link each element */
-       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
-       sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
+       /* Link each element : appsrc - capsfilter - encodesink bin */
+       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "src");
+       sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "sink");
+       _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+
+       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+       sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
        _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
 
        if (sc->audio_disable == FALSE) {
-               srcpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
-               sinkpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+               srcpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+               sinkpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
                _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
        }
 
-       _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
                                      CONFIGURE_CATEGORY_MAIN_RECORD,
                                      "RecordsinkElement",
                                      &RecordsinkElement);
@@ -155,21 +237,21 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
        /* set data probe function for audio */
 
        if (sc->audio_disable == FALSE) {
-               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "sink");
+               sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "sink");
                MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                             __mmcamcorder_audioque_dataprobe, hcamcorder);
                gst_object_unref(sinkpad);
                sinkpad = NULL;
-               
+
                /* for voice mute */
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
                MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                             __mmcamcorder_audio_dataprobe_audio_mute, hcamcorder);
                gst_object_unref(srcpad);
                srcpad = NULL;
 
-               if (sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
-                       srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "src");
+               if (sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
+                       srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "src");
                        MMCAMCORDER_ADD_EVENT_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                                    __mmcamcorder_eventprobe_monitor, hcamcorder);
                        gst_object_unref(srcpad);
@@ -177,8 +259,8 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
                }
        }
 
-       if (sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "src");
+       if (sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "src");
                MMCAMCORDER_ADD_EVENT_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                            __mmcamcorder_eventprobe_monitor, hcamcorder);
                gst_object_unref(srcpad);
@@ -186,7 +268,7 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
        }
 
        if (sc->audio_disable) {
-               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "sink");
+               sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "sink");
                MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                             __mmcamcorder_video_dataprobe_audio_disable, hcamcorder);
                gst_object_unref(sinkpad);
@@ -194,29 +276,40 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
        }
 
        if (!strcmp(gst_element_rsink_name, "filesink")) {
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
                MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                             __mmcamcorder_video_dataprobe_record, hcamcorder);
                gst_object_unref(srcpad);
                srcpad = NULL;
 
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
                MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
                                             __mmcamcorder_audio_dataprobe_check, hcamcorder);
                gst_object_unref(srcpad);
                srcpad = NULL;
        }
 
+       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
+       /* register pipeline message callback */
+       hcamcorder->encode_pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder);
+
+       gst_object_unref(bus);
+       bus = NULL;
+
        return MM_ERROR_NONE;
 
 pipeline_creation_error:
+       for (i = _MMCAMCORDER_AUDIOSRC_BIN ; i <= _MMCAMCORDER_ENCSINK_SINK ; i++) {
+               _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, i);
+       }
+       _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE);
        return err;
 }
 
 
 int _mmcamcorder_remove_audio_pipeline(MMHandleType handle)
 {
-       int ret = MM_ERROR_NONE;
        GstPad *srcpad = NULL;
        GstPad *sinkpad = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
@@ -230,21 +323,14 @@ int _mmcamcorder_remove_audio_pipeline(MMHandleType handle)
 
        _mmcam_dbg_log("");
 
-       if (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst != NULL) {
-               __ta__( "        AudiosrcBin Set NULL",
-               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, GST_STATE_NULL);
-               );
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("Faile to change audio source state[%d]", ret);
-                       return ret;
-               }
-
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
-               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+       if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst != NULL) {
+               srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+               sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
                _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
 
-               gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                              sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+               /* release audiosrc bin */
+               gst_bin_remove(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+                              sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
 
                /*
                        To avoid conflicting between old elements and newly created elements,
@@ -254,7 +340,7 @@ int _mmcamcorder_remove_audio_pipeline(MMHandleType handle)
                        It's because the pipeline of audio recording destroys at the same time,
                        and '_mmcamcorder_element_release_noti' will perfom removing handle.
                */
-               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_AUDIOSRC_BIN, _MMCAMCORDER_AUDIOSRC_NS);
+               _mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN, _MMCAMCORDER_AUDIOSRC_VOL);
 
                _mmcam_dbg_log("Audio pipeline removed");
        }
@@ -263,15 +349,12 @@ int _mmcamcorder_remove_audio_pipeline(MMHandleType handle)
 }
 
 
-int _mmcamcorder_remove_encoder_pipeline(MMHandleType handle)
+int _mmcamcorder_remove_encode_pipeline(MMHandleType handle)
 {
-       int ret = MM_ERROR_NONE;
-       GstPad *srcpad = NULL;
-       GstPad *sinkpad = NULL;
        GstPad *reqpad = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
-       
+
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
@@ -280,36 +363,24 @@ int _mmcamcorder_remove_encoder_pipeline(MMHandleType handle)
 
        _mmcam_dbg_log("");
 
-       if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst != NULL) {
-               __ta__( "        EncodeBin Set NULL",
-               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
-               );
-               if (ret != MM_ERROR_NONE) {
-                       _mmcam_dbg_err("Faile to change encode bin state[%d]", ret);
-                       return ret;
-               }
-
-               srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
-               sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
-               _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
-
+       if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst != NULL) {
                /* release request pad */
-               reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+               reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
                if (reqpad) {
-                       gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+                       gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
                        gst_object_unref(reqpad);
                        reqpad = NULL;
                }
 
-               reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
+               reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
                if (reqpad) {
-                       gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+                       gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
                        gst_object_unref(reqpad);
                        reqpad = NULL;
                }
 
-               gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
-                              sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+               /* release encode main pipeline */
+               gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
 
                /*
                        To avoid conflicting between old elements and newly created elements,
@@ -319,8 +390,7 @@ int _mmcamcorder_remove_encoder_pipeline(MMHandleType handle)
                        It's because the pipeline of audio recording destroys at the same time,
                        and '_mmcamcorder_element_release_noti' will perfom removing handle.
                */
-               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_AUDIOSRC_QUE, _MMCAMCORDER_AUDIOSRC_ENC); /* Encode bin has audio encoder too. */
-               _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
+               //_mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, _MMCAMCORDER_ENCSINK_SINK);
 
                _mmcam_dbg_log("Encoder pipeline removed");
        }
@@ -335,19 +405,29 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle)
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
 
+       GstBus *bus = NULL;
+
        mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
 
-       _mmcam_dbg_log("");
+       _mmcam_dbg_log("start");
 
-       if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
+       if (!sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
                _mmcam_dbg_warn("pipeline is not existed.");
                return MM_ERROR_NONE;
        }
 
        _mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_VIDEOREC);
 
+       ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
+       if (ret != MM_ERROR_NONE) {
+               _mmcam_dbg_err("Faile to change encode main pipeline [0x%x]", ret);
+               return ret;
+       }
+
+       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
        /* remove audio pipeline first */
        ret = _mmcamcorder_remove_audio_pipeline(handle);
        if (ret != MM_ERROR_NONE) {
@@ -355,48 +435,33 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle)
                return ret;
        }
 
-       ret = _mmcamcorder_remove_encoder_pipeline(handle);
+       ret = _mmcamcorder_remove_encode_pipeline(handle);
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_err("Fail to remove encoder pipeline");
                return ret;
        }
 
-       return ret;
-}
-
-
-void _mmcamcorder_destroy_video_pipeline(MMHandleType handle)
-{
-       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-       _MMCamcorderSubContext *sc = NULL;
-       GstPad *reqpad1 = NULL;
-       GstPad *reqpad2 = NULL;
-       
-       mmf_return_if_fail(hcamcorder);
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-
-       mmf_return_if_fail(sc);
-       mmf_return_if_fail(sc->element);
-       
-       _mmcam_dbg_log("");
-
-       if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-               _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
+       /* Remove pipeline message callback */
+       if (hcamcorder->encode_pipeline_cb_event_id != 0) {
+               g_source_remove(hcamcorder->encode_pipeline_cb_event_id);
+               hcamcorder->encode_pipeline_cb_event_id = 0;
+       }
 
-               _mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
+       /* Remove remained message */
+       if (bus) {
+               GstMessage *gst_msg = NULL;
+               while ((gst_msg = gst_bus_pop(bus)) != NULL) {
+                       _mmcamcorder_pipeline_cb_message(bus, gst_msg, (gpointer)hcamcorder);
+                       gst_message_unref(gst_msg);
+                       gst_msg = NULL;
+               }
+               gst_object_unref(bus);
+               bus = NULL;
+       }
 
-               reqpad1 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src0");
-               reqpad2 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src1");
-               gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad1);
-               gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad2);
-               gst_object_unref(reqpad1);
-               gst_object_unref(reqpad2);
+       _mmcam_dbg_log("done");
 
-               /* object disposing problem happen. */
-               _mmcam_dbg_log("Reference count of pipeline(%d)", GST_OBJECT_REFCOUNT_VALUE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
-               gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
-       }
+       return ret;
 }
 
 
@@ -406,12 +471,15 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
        int fileformat = 0;
        int ret = MM_ERROR_NONE;
        double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
-       char *temp_filename = NULL;
        char *err_name = NULL;
+       char *temp_filename = NULL;
+       GstCameraControl *CameraControl = NULL;
+       GstCameraControlChannel *CameraControlChannel = NULL;
+       const GList *controls = NULL;
+       const GList *item = NULL;
 
        gint fps = 0;
        GstElement *pipeline = NULL;
-       GstPad *pad = NULL;
 
        _MMCamcorderVideoInfo *info = NULL;
        _MMCamcorderSubContext *sc = NULL;
@@ -434,54 +502,34 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
        case _MMCamcorder_CMD_RECORD:
        {
                if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED) {
+                       /**
+                        * start recording
+                        */
                        guint imax_size = 0;
                        guint imax_time = 0;
                        int ret_free_space = 0;
                        char *dir_name = NULL;
                        guint64 free_space = 0;
+                       int file_system_type = 0;
 
                        /* Recording */
-                       _mmcam_dbg_log("Record Start");
+                       _mmcam_dbg_log("Record Start - dual stream %d", info->support_dual_stream);
 
-                       /* set hybrid mode when ITLV format */
-                       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-                               _mmcam_dbg_log("flush cache TRUE");
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", TRUE);
-                       }
-
-                       /* flush queue */
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-                       if (ret != MM_ERROR_NONE) {
-                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
-                       }
-
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
-
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                                       CONFIGURE_CATEGORY_MAIN_RECORD,
-                                                       "DropVideoFrame",
-                                                       &(sc->drop_vframe));
-
-                       _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
-                                                       CONFIGURE_CATEGORY_MAIN_RECORD,
-                                                       "PassFirstVideoFrame",
-                                                       &(sc->pass_first_vframe));
-
-                       _mmcam_dbg_log("Drop video frame count[%d], Pass fisrt video frame count[%d]",
-                                      sc->drop_vframe, sc->pass_first_vframe);
+                       /* init record_dual_stream */
+                       info->record_dual_stream = FALSE;
 
                        ret = mm_camcorder_get_attributes(handle, &err_name,
                                                          MMCAM_CAMERA_FPS, &fps,
-                                                         MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
+                                                         MMCAM_CAMERA_WIDTH, &(info->preview_width),
+                                                         MMCAM_CAMERA_HEIGHT, &(info->preview_height),
+                                                         MMCAM_VIDEO_WIDTH, &(info->video_width),
+                                                         MMCAM_VIDEO_HEIGHT, &(info->video_height),
                                                          MMCAM_FILE_FORMAT, &fileformat,
                                                          MMCAM_TARGET_FILENAME, &temp_filename, &size,
                                                          MMCAM_TARGET_MAX_SIZE, &imax_size,
                                                          MMCAM_TARGET_TIME_LIMIT, &imax_time,
                                                          MMCAM_FILE_FORMAT, &(info->fileformat),
+                                                         MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
                                                          NULL);
                        if (ret != MM_ERROR_NONE) {
                                _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret);
@@ -489,12 +537,46 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                goto _ERR_CAMCORDER_VIDEO_COMMAND;
                        }
 
+                       if (temp_filename == NULL) {
+                               _mmcam_dbg_err("filename is not set");
+                               ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                       }
+
+                       /* set max size */
+                       if (imax_size <= 0) {
+                               info->max_size = 0; /* do not check */
+                       } else {
+                               info->max_size = ((guint64)imax_size) << 10; /* to byte */
+                       }
+
+                       /* set max time */
+                       if (imax_time <= 0) {
+                               info->max_time = 0; /* do not check */
+                       } else {
+                               info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+                       }
+
                        dir_name = g_path_get_dirname(temp_filename);
                        if (dir_name) {
                                ret_free_space = _mmcamcorder_get_freespace(dir_name, &free_space);
 
-                               _mmcam_dbg_warn("current space for recording - %s : [%" G_GUINT64_FORMAT "]",
-                                               dir_name, free_space);
+                               _mmcam_dbg_warn("current space - %s [%" G_GUINT64_FORMAT "]", dir_name, free_space);
+
+                               if (_mmcamcorder_get_file_system_type(dir_name, &file_system_type) == 0) {
+                                       /* MSDOS_SUPER_MAGIC : 0x4d44 */
+                                       if (file_system_type == MSDOS_SUPER_MAGIC &&
+                                           (info->max_size == 0 || info->max_size > FAT32_FILE_SYSTEM_MAX_SIZE)) {
+                                               _mmcam_dbg_warn("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %"G_GUINT64_FORMAT,
+                                                               info->max_size, FAT32_FILE_SYSTEM_MAX_SIZE);
+                                               info->max_size = FAT32_FILE_SYSTEM_MAX_SIZE;
+                                       } else {
+                                               _mmcam_dbg_warn("file system 0x%x, max size %"G_GUINT64_FORMAT,
+                                                               file_system_type, info->max_size);
+                                       }
+                               } else {
+                                       _mmcam_dbg_warn("_mmcamcorder_get_file_system_type failed");
+                               }
 
                                g_free(dir_name);
                                dir_name = NULL;
@@ -509,74 +591,146 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                return MM_ERROR_OUT_OF_STORAGE;
                        }
 
-                       /* Play record start sound */
-                       _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_START_SND, TRUE);
+                       pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+                       if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst == NULL &&
+                           hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_NONE) {
+                               /* Play record start sound */
+                               _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_START_SND, FALSE);
+                       }
+                       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
 
-                       /* set max size */
-                       if (imax_size <= 0) {
-                               info->max_size = 0; /* do not check */
+                       _mmcam_dbg_warn("video size [%dx%d]", info->video_width, info->video_height);
+
+                       if (info->video_width == 0 || info->video_height == 0) {
+                               _mmcam_dbg_warn("video size is invalid [%dx%d] use preview size [%dx%d]",
+                                               info->video_width, info->video_height, info->preview_width, info->preview_height);
+                               info->video_width = info->preview_width;
+                               info->video_height = info->preview_height;
+                       }
+
+                       if (info->support_dual_stream) {
+                               _mmcam_dbg_warn("DUAL STREAM MODE");
+
+                               info->record_dual_stream = TRUE;
+
+                               /* No need to restart preview */
+                               info->restart_preview = FALSE;
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "video-width", info->video_width);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "video-height", info->video_height);
+                       } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+                                  info->preview_width == info->video_width &&
+                                  info->preview_height == info->video_height) {
+                               _mmcam_dbg_log("H264 preview mode and same resolution");
+
+                               /* No need to restart preview */
+                               info->restart_preview = FALSE;
                        } else {
-                               info->max_size = ((guint64)imax_size) << 10; /* to byte */
+                               /* always need to restart preview  */
+                               info->restart_preview = TRUE;
                        }
 
-                       /* set max time */
-                       if (imax_time <= 0) {
-                               info->max_time = 0; /* do not check */
+                       if (info->restart_preview) {
+                               /* stop preview and set new size */
+                               _mmcam_dbg_log("restart preview");
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
+                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+                               if (ret != MM_ERROR_NONE) {
+                                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                               }
+
+                               if (!_mmcamcorder_set_camera_resolution(handle, info->video_width, info->video_height)) {
+                                       ret = MM_ERROR_CAMCORDER_INTERNAL;
+                                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                               }
+
+                               /* Start preview again with new setting */
+                               ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+                               if (ret != MM_ERROR_NONE) {
+                                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                               }
+
+                               if (motion_rate < 1.0) {
+                                       _mmcam_dbg_warn("wait for stabilization of frame");
+                                       usleep(300000);
+                               }
                        } else {
-                               info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+                               _mmcam_dbg_log("no need to restart preview");
                        }
 
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_RECORD,
+                                                       "DropVideoFrame",
+                                                       &(sc->drop_vframe));
+
+                       _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_RECORD,
+                                                       "PassFirstVideoFrame",
+                                                       &(sc->pass_first_vframe));
+
+                       _mmcam_dbg_log("Drop video frame count[%d], Pass fisrt video frame count[%d]",
+                                      sc->drop_vframe, sc->pass_first_vframe);
+
+                       info->record_drop_count = (guint)motion_rate;
+                       info->record_motion_rate = motion_rate;
                        if (sc->is_modified_rate) {
                                info->record_timestamp_ratio = (_MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE/motion_rate);
-                               _mmcam_dbg_log("high speed recording fps:%d, slow_rate:%f, timestamp_ratio:%f",
-                                              fps, motion_rate, info->record_timestamp_ratio);
                        } else {
                                info->record_timestamp_ratio = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
-                               _mmcam_dbg_log("normal recording");
                        }
 
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", TRUE);
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "req-negotiation", TRUE);
+                       _mmcam_dbg_warn("recording fps %d, motion rate %f, timestamp_ratio %f",
+                                      fps, info->record_motion_rate, info->record_timestamp_ratio);
 
-                       ret =_mmcamcorder_add_recorder_pipeline((MMHandleType)hcamcorder);
-                       if (ret != MM_ERROR_NONE) {
-                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
-                       }
+                       /* set push buffer flag */
+                       info->push_encoding_buffer = PUSH_ENCODING_BUFFER_INIT;
+                       info->base_video_ts = 0;
 
-                       info->filename = strdup(temp_filename);
-                       if (!info->filename) {
-                               _mmcam_dbg_err("strdup was failed");
-                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                       /* connect video stream cb signal */
+                       /*130826 Connect video stream cb for handling fast record frame cb*/
+                       if (info->record_dual_stream) {
+                               if (_mmcamcorder_connect_video_stream_cb_signal((MMHandleType)hcamcorder) != MM_ERROR_NONE) {
+                                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                               }
                        }
 
-                       _mmcam_dbg_log("Record start : set file name using attribute - %s ",info->filename);
-
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", 0);
-
-                       /* Adjust display FPS */
-                       sc->display_interval = 0;
-                       sc->previous_slot_time = 0;
+                       /* start video stream */
+                       if (info->record_dual_stream) {
+                               GstCameraControl *control =  GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+                               if (control) {
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+                                       _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_START");
+                                       gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_START);
+#endif /* LATEST_CAMERA_CONTROL */
+                                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+                               } else {
+                                       _mmcam_dbg_err("could not get camera control");
+                               }
+                       }
 
-                       /* gst_element_set_base_time(GST_ELEMENT(pipeline), (GstClockTime)0);
-                          if you want to use audio clock, enable this block
-                          for change recorder_pipeline state to paused. */
-                       __ta__("        _MMCamcorder_CMD_RECORD:GST_STATE_PAUSED2",
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
-                       );
-                       if (ret != MM_ERROR_NONE) {
-                               /* Remove recorder pipeline and recording file which size maybe zero */
-                               __ta__("        record fail:remove_recorder_pipeline",
-                               _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
-                               );
-                               if (info->filename) {
-                                       _mmcam_dbg_log("file delete(%s)", info->filename);
-                                       unlink(info->filename);
-                                       g_free(info->filename);
-                                       info->filename = NULL;
+                       /* check pre-created encode pipeline */
+                       pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+                       if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst == NULL &&
+                           hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_NONE) {
+                               /* create encoding pipeline */
+                               ret =_mmcamcorder_video_prepare_record((MMHandleType)hcamcorder);
+                               if (ret != MM_ERROR_NONE) {
+                                       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+                                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
                                }
-                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
                        }
+                       pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+                       /* check recording start sound */
+                       _mmcamcorder_sound_solo_play_wait(handle);
 
                        /**< To fix video recording hanging
                                1. use gst_element_set_start_time() instead of gst_pipeline_set_new_stream_time()
@@ -584,8 +738,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                 basetime wouldn't change if you set (GstClockTime)0.
                                3. Move set start time position below PAUSED of pipeline.
                        */
-                       gst_element_set_start_time(GST_ELEMENT(pipeline), (GstClockTime)1);
+                       //gst_element_set_start_time(GST_ELEMENT(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), (GstClockTime)1);
+                       //gst_element_set_start_time(GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst), (GstClockTime)1);
+
                        info->video_frame_count = 0;
+                       info->is_firstframe = TRUE;
                        info->audio_frame_count = 0;
                        info->filesize = 0;
                        sc->ferror_send = FALSE;
@@ -593,33 +750,81 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                        sc->error_occurs = FALSE;
                        sc->bget_eos = FALSE;
 
-                       __ta__("        _MMCamcorder_CMD_RECORD:GST_STATE_PLAYING2",
-                       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-                       );
+                       ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING);
                        if (ret != MM_ERROR_NONE) {
+                               /* stop video stream */
+                               if (info->record_dual_stream) {
+                                       GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+                                       if (control) {
+                                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+                                               _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+                                               gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+                                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+                                       } else {
+                                               _mmcam_dbg_err("failed to get camera control");
+                                       }
+                               }
+
                                /* Remove recorder pipeline and recording file which size maybe zero */
-                               __ta__("        record fail:remove_recorder_pipeline",
                                _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
-                               );
                                if (info->filename) {
                                        _mmcam_dbg_log("file delete(%s)", info->filename);
                                        unlink(info->filename);
-                                       g_free(info->filename);
-                                       info->filename = NULL;
                                }
                                goto _ERR_CAMCORDER_VIDEO_COMMAND;
                        }
+
+                       /*set the camera control to create the GOP so that video record will get a new key frame*/
+                       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+                           GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+                               CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+                               controls = gst_camera_control_list_channels(CameraControl);
+                               if (controls != NULL) {
+                                       for (item = controls ; item && item->data ; item = item->next) {
+                                               CameraControlChannel = item->data;
+                                               _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+                                               if (!strcmp(CameraControlChannel->label, "new-gop")) {
+                                                       //gst_camera_control_set_value(CameraControl, CameraControlChannel, 1);
+                                                       break;
+                                               }
+                                       }
+
+                                       if (item == NULL) {
+                                               _mmcam_dbg_warn("failed to find new-gop control channel");
+                                       }
+                               }
+                       } else {
+                               _mmcam_dbg_warn("Can't cast Video source into camera control or not H264 prevew format[%d]",
+                                               sc->info_image->preview_format);
+                       }
                } else {
                        /* Resume case */
-                       int video_enc = 0;
 
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", FALSE);
-
-                       mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &video_enc, NULL);
-                       if (video_enc == MM_VIDEO_CODEC_MPEG4) {
-                               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "force-intra", TRUE);
+                       if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+                           GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+                               /* generate and I-frame on resuming */
+                               CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+                               controls = gst_camera_control_list_channels(CameraControl);
+                               if (controls != NULL) {
+                                       for (item = controls ; item && item->data ; item = item->next) {
+                                               CameraControlChannel = item->data;
+                                               _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+                                               if (!strcmp(CameraControlChannel->label, "new-gop")) {
+                                                       //gst_camera_control_set_value(CameraControl, CameraControlChannel, 1);
+                                                       break;
+                                               }
+                                       }
+
+                                       if (item == NULL) {
+                                               _mmcam_dbg_warn("failed to find new-gop control channel");
+                                       }
+                               }
                        }
 
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", FALSE);
+
                        _mmcam_dbg_log("Object property settings done");
                }
        }
@@ -664,9 +869,9 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
                        }
                }
-               /* tee block */
-               MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", TRUE);
 
+               /* block encodebin */
+               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", TRUE);
                break;
        }
        case _MMCamcorder_CMD_CANCEL:
@@ -676,32 +881,60 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                        return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
                }
 
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE);
-
-               __ta__("        _MMCamcorder_CMD_CANCEL:GST_STATE_READY",
-               ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-               );
-
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+               /* block push buffer */
+               info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
 
+               ret = _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
                if (ret != MM_ERROR_NONE) {
                        goto _ERR_CAMCORDER_VIDEO_COMMAND;
                }
 
-               __ta__("        __mmcamcorder_remove_recorder_pipeline",
-               _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
-               );
+               /* stop video stream */
+               if (info->record_dual_stream) {
+                       GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+                       if (control) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+                               _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+                               gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+                       } else {
+                               _mmcam_dbg_err("failed to get camera control");
+                       }
+               }
+
+               if (info->restart_preview) {
+                       /* restart preview */
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+
+                       ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+                       if (ret != MM_ERROR_NONE) {
+                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                       }
+
+                       /* reset restart_preview for inset window layout */
+                       info->restart_preview = FALSE;
+
+                       ret = _mmcamcorder_set_camera_resolution(handle, info->preview_width, info->preview_height);
+                       if (ret != MM_ERROR_NONE) {
+                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                       }
+
+                       ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+                       if (ret != MM_ERROR_NONE) {
+                               goto _ERR_CAMCORDER_VIDEO_COMMAND;
+                       }
+               }
 
                /* remove target file */
                if (info->filename) {
                        _mmcam_dbg_log("file delete(%s)", info->filename);
                        unlink(info->filename);
-                       g_free(info->filename);
-                       info->filename = NULL;
                }
 
                sc->isMaxsizePausing = FALSE;
@@ -711,19 +944,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                sc->previous_slot_time = 0;
                info->video_frame_count = 0;
                info->audio_frame_count = 0;
-               info->filesize =0;
-
-               /* set flush cache as FALSE */
-               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
-               }
-
-               __ta__("        _MMCamcorder_CMD_CANCEL:GST_STATE_PLAYING",
-               ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-               );
-               if (ret != MM_ERROR_NONE) {
-                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
-               }
+               info->filesize = 0;
                break;
        }
        case _MMCamcorder_CMD_COMMIT:
@@ -736,6 +957,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                } else {
                        _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
                        info->b_commiting = TRUE;
+                       sc->bget_eos = FALSE;
                }
 
                for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
@@ -773,55 +995,18 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                        }
                }
 
-               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE);
-
-               if (sc->error_occurs) {
-                       GstPad *video= NULL;
-                       GstPad *audio = NULL;
-                       int ret = 0;
-
-                       _mmcam_dbg_err("Committing Error case");
-
-                       video = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink");
-                       ret = gst_pad_send_event (video, gst_event_new_eos());
-                       _mmcam_dbg_err("Sending EOS video sink  : %d", ret);
-                       gst_object_unref(video);
-
-                       video = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
-                       gst_pad_push_event (video, gst_event_new_flush_start());
-            gst_pad_push_event (video, gst_event_new_flush_stop(TRUE));
-                       ret = gst_pad_push_event (video, gst_event_new_eos());
-                       _mmcam_dbg_err("Sending EOS video encoder src pad  : %d", ret);
-                       gst_object_unref(video);
-
-                       if (sc->audio_disable == FALSE) {
-                               audio = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
-                               gst_pad_push_event (audio, gst_event_new_flush_start());
-                gst_pad_push_event (audio, gst_event_new_flush_stop(TRUE));
-                               ret = gst_element_send_event(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
-                               _mmcam_dbg_err("Sending EOS audio encoder src pad  : %d", ret);
-                               gst_object_unref(audio);
-                       }
-               } else {
-                       if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst != NULL) {
-                               ret = gst_element_send_event(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, gst_event_new_eos());
-                               _mmcam_dbg_warn("send eos to videosrc result : %d", ret);
-                       }
-
-                       if (sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst != NULL) {
-                               pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
-                               ret = gst_element_send_event(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
-                               gst_object_unref(pad);
-                               pad = NULL;
+               /* block push buffer */
+               info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
+               _mmcam_dbg_log("block push buffer to appsrc");
 
-                               _mmcam_dbg_warn("send eos to audiosrc result : %d", ret);
-                       }
+               if (sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst != NULL) {
+                       ret = gst_element_send_event(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, gst_event_new_eos());
+                       _mmcam_dbg_warn("send eos to appsrc result : %d", ret);
                }
 
-               if (hcamcorder->quick_device_close) {
-                       _mmcam_dbg_warn("quick_device_close");
-                       /* close device quickly */
-                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "quick-device-close",TRUE);
+               if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst != NULL) {
+                       ret = gst_element_send_event(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
+                       _mmcam_dbg_warn("send eos to audiosrc result : %d", ret);
                }
 
                /* sc */
@@ -831,12 +1016,6 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                /* Wait EOS */
                _mmcam_dbg_log("Start to wait EOS");
                ret =_mmcamcorder_get_eos_message(handle);
-
-               /* set flush cache as FALSE */
-               if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
-               }
-
                if (ret != MM_ERROR_NONE) {
                        info->b_commiting = FALSE;
                        goto _ERR_CAMCORDER_VIDEO_COMMAND;
@@ -851,10 +1030,8 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
        return MM_ERROR_NONE;
 
 _ERR_CAMCORDER_VIDEO_COMMAND:
-       if (ret != MM_ERROR_NONE && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst != NULL) {
-               int op_status = 0;
-               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "operation-status", &op_status);
-               _mmcam_dbg_err("Current Videosrc status[0x%x]", op_status);
+       if (command == _MMCamcorder_CMD_RECORD) {
+               _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
        }
 
        return ret;
@@ -867,9 +1044,6 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
        int enabletag = 0;
        guint64 file_size = 0;
 
-       GstPad *pad = NULL;
-       GstElement *pipeline = NULL;
-
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
        _MMCamcorderVideoInfo *info = NULL;
@@ -886,41 +1060,52 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
 
        _mmcam_dbg_err("");
 
-       MMTA_ACUM_ITEM_BEGIN("    _mmcamcorder_video_handle_eos", 0);
+       if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
+               /* Play record stop sound */
+               _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND, FALSE);
+       } else {
+               _mmcam_dbg_warn("Play stop sound through pulseaudio");
+
+#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
+               _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND);
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+               _mmcamcorder_sound_init(handle);
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
 
-       pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+               _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, TRUE);
+
+               _mmcamcorder_sound_finalize(handle);
+       }
 
        /* remove blocking part */
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
 
        mm_camcorder_get_attributes(handle, NULL,
                                    MMCAM_TAG_ENABLE, &enabletag,
                                    NULL);
 
-       _mmcam_dbg_log("Set state of pipeline as PAUSED");
-       __ta__("        _MMCamcorder_CMD_COMMIT:GST_STATE_PAUSED",
-       ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
-       );
-       if (ret != MM_ERROR_NONE) {
-               _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:GST_STATE_READY or PAUSED failed. error[%x]", ret);
-       }
-
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
-
-       __ta__("        _MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline",
        ret = _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
-       );
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline failed. error[%x]", ret);
        }
 
+       /* stop video stream */
+       if (info->record_dual_stream) {
+               GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+               if (control) {
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+                       _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+                       gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+               } else {
+                       _mmcam_dbg_err("failed to get camera control");
+               }
+       }
+
        if (enabletag && !(sc->ferror_send)) {
-               __ta__( "        _MMCamcorder_CMD_COMMIT:__mmcamcorder_add_locationinfo",
                ret = __mmcamcorder_add_locationinfo((MMHandleType)hcamcorder, info->fileformat);
-               );
                if (ret) {
                        _mmcam_dbg_log("Writing location information SUCCEEDED !!");
                } else {
@@ -943,40 +1128,41 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
                }
        }
 
-       /* Flush EOS event to avoid pending pipeline */
-       _mmcam_dbg_log("Flush EOS event");
-       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink");
-       gst_pad_push_event(pad, gst_event_new_flush_start());
-    gst_pad_push_event(pad, gst_event_new_flush_stop(TRUE));
-       gst_object_unref(pad);
-       pad = NULL;
-
-       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "src");
-       gst_pad_push_event(pad, gst_event_new_flush_start());
-    gst_pad_push_event(pad, gst_event_new_flush_stop(TRUE));
-       gst_object_unref(pad);
-       pad = NULL;
-
-       _mmcam_dbg_log("Set state as PLAYING");
-       __ta__("        _MMCamcorder_CMD_COMMIT:GST_STATE_PLAYING",
-       ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-       );
-       /* Do not return when error is occurred.
-          Recording file was created successfully, but starting pipeline failed */
-       if (ret != MM_ERROR_NONE) {
-               msg.id = MM_MESSAGE_CAMCORDER_ERROR;
-               msg.param.code = ret;
-               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-               _mmcam_dbg_err("Failed to set state PLAYING[%x]", ret);
-       }
+       if (info->restart_preview) {
+               /* block queue */
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
 
-       if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
-               /* Play record stop sound */
-               __ta__("        _MMCamcorder_CMD_COMMIT:_mmcamcorder_sound_solo_play",
-               _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND, TRUE);
-               );
+               _mmcam_dbg_log("Set state of pipeline as READY");
+               ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+               /* unblock queue */
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+               if (ret != MM_ERROR_NONE) {
+                       msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+                       msg.param.code = ret;
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+                       _mmcam_dbg_err("Failed to set state READY[%x]", ret);
+               }
+
+               /* reset restart_preview for inset window layout */
+               info->restart_preview = FALSE;
+
+               /* recover preview size */
+               _mmcamcorder_set_camera_resolution(handle, info->preview_width, info->preview_height);
+
+               ret =_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+               /* Do not return when error is occurred.
+                  Recording file was created successfully, but starting pipeline failed */
+               if (ret != MM_ERROR_NONE) {
+                       msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+                       msg.param.code = ret;
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+                       _mmcam_dbg_err("Failed to set state PLAYING[%x]", ret);
+               }
        } else {
-               _mmcam_dbg_log("Do NOT play recording stop sound because of ASM stop");
+               _mmcam_dbg_log("No need to restart preview");
        }
 
        /* Send recording report to application */
@@ -1001,12 +1187,12 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
        info->video_frame_count = 0;
        info->audio_frame_count = 0;
        info->filesize = 0;
-       g_free(info->filename);
-       info->filename = NULL;
        info->b_commiting = FALSE;
 
-       MMTA_ACUM_ITEM_END("    _mmcamcorder_video_handle_eos", 0);
-       MMTA_ACUM_ITEM_END("Real Commit Time", 0);
+       if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
+               /* check recording stop sound */
+               _mmcamcorder_sound_solo_play_wait(handle);
+       }
 
        _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end");
 
@@ -1026,9 +1212,8 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
  * @remarks
  * @see
  */
-static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
-{
-    GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info);
+static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo *info, gpointer u_data){
+       GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info);
        switch (GST_EVENT_TYPE(event)) {
        case GST_EVENT_UNKNOWN:
        /* upstream events */
@@ -1037,7 +1222,7 @@ static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadPro
        case GST_EVENT_NAVIGATION:
        case GST_EVENT_LATENCY:
        /* downstream serialized events */
-    case GST_EVENT_SEGMENT :
+       case GST_EVENT_SEGMENT :
        case GST_EVENT_TAG:
        case GST_EVENT_BUFFERSIZE:
                _mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event));
@@ -1055,53 +1240,97 @@ static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadPro
                break;
        }
 
-    return GST_PAD_PROBE_OK;
+       return GST_PAD_PROBE_OK;
 }
 
 
 static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
-    GstMapInfo mapinfo;
-    guint64 size;
-    gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
-    size = mapinfo.size;
-    gst_buffer_unmap(buffer, &mapinfo);
-
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstMapInfo mapinfo;
        _MMCamcorderSubContext *sc = NULL;
-    _MMCamcorderVideoInfo *videoinfo = NULL;
+       _MMCamcorderVideoInfo *videoinfo = NULL;
+       _MMCamcorderMsgItem msg;
+       guint64 buffer_size = 0;
+       guint64 trailer_size = 0;
 
-       mmf_return_val_if_fail(hcamcorder, TRUE);
-       mmf_return_val_if_fail(buffer, FALSE);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
        sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
 
-       mmf_return_val_if_fail(sc && sc->info_video, TRUE);
-    videoinfo = sc->info_video;
+       mmf_return_val_if_fail(sc && sc->info_video, GST_PAD_PROBE_OK);
+       videoinfo = sc->info_video;
+
+       /* get buffer size */
+       if (!gst_buffer_map(buffer, &mapinfo, GST_MAP_READ)) {
+               _mmcam_dbg_warn("map failed : buffer %p", buffer);
+               return GST_PAD_PROBE_OK;
+       }
 
-       /*_mmcam_dbg_err("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+       buffer_size = mapinfo.size;
+       gst_buffer_unmap(buffer, &mapinfo);
 
-    if (videoinfo->audio_frame_count == 0) {
-        videoinfo->filesize += size;
-        videoinfo->audio_frame_count++;
-        return GST_PAD_PROBE_OK;
+       /*_mmcam_dbg_err("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
+
+       pthread_mutex_lock(&(videoinfo->size_check_lock));
+
+       if (videoinfo->audio_frame_count == 0) {
+               videoinfo->filesize += buffer_size;
+               videoinfo->audio_frame_count++;
+               return GST_PAD_PROBE_OK;
        }
 
        if (sc->ferror_send || sc->isMaxsizePausing) {
                _mmcam_dbg_warn("Recording is paused, drop frames");
-        return GST_PAD_PROBE_DROP;
+               pthread_mutex_unlock(&(videoinfo->size_check_lock));
+               return GST_PAD_PROBE_DROP;
+       }
+
+       /* get trailer size */
+       if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+               MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+       } else {
+               trailer_size = 0;
+       }
+
+       /* check max size of recorded file */
+       if (videoinfo->max_size > 0 &&
+           videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+               GstState pipeline_state = GST_STATE_VOID_PENDING;
+               GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+               _mmcam_dbg_warn("Max size!!! Recording is paused.");
+               _mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \
+                               " buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]",
+                               videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
+
+               if (!sc->isMaxsizePausing) {
+                       sc->isMaxsizePausing = TRUE;
+                       gst_element_get_state(pipeline, &pipeline_state, NULL, -1) ;
+                       if (pipeline_state == GST_STATE_PLAYING) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+                       }
+
+                       msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+               }
+
+               pthread_mutex_unlock(&(videoinfo->size_check_lock));
+
+               return FALSE;
        }
 
-    videoinfo->filesize += size;
-    videoinfo->audio_frame_count++;
+       videoinfo->filesize += buffer_size;
+       videoinfo->audio_frame_count++;
+
+       pthread_mutex_unlock(&(videoinfo->size_check_lock));
 
-    return GST_PAD_PROBE_OK;
+       return GST_PAD_PROBE_OK;
 }
 
 
 static GstPadProbeReturn __mmcamcorder_video_dataprobe_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
-       static int count = 0;
        gint ret = 0;
        guint vq_size = 0;
        guint aq_size = 0;
@@ -1110,134 +1339,141 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_record(GstPad *pad, GstPa
        guint64 trailer_size = 0;
        guint64 queued_buffer = 0;
        char *filename = NULL;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
-    GstMapInfo mapinfo;
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstMapInfo mapinfo;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
        _MMCamcorderMsgItem msg;
        _MMCamcorderSubContext *sc = NULL;
-    _MMCamcorderVideoInfo *videoinfo = NULL;
+       _MMCamcorderVideoInfo *videoinfo = NULL;
 
-       mmf_return_val_if_fail(hcamcorder, TRUE);
-       mmf_return_val_if_fail(buffer, FALSE);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
-       mmf_return_val_if_fail(sc && sc->info_video, TRUE);
-    videoinfo = sc->info_video;
+       mmf_return_val_if_fail(sc && sc->info_video, GST_PAD_PROBE_OK);
+       videoinfo = sc->info_video;
 
-       /*_mmcam_dbg_log("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+       /*_mmcam_dbg_log("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
        if (sc->ferror_send) {
                _mmcam_dbg_warn("file write error, drop frames");
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
-    gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
-    buffer_size = mapinfo.size;
-    gst_buffer_unmap(buffer, &mapinfo);
-    videoinfo->video_frame_count++;
-    if (videoinfo->video_frame_count <= (guint64)_MMCAMCORDER_MINIMUM_FRAME) {
+       gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
+       buffer_size = mapinfo.size;
+       gst_buffer_unmap(buffer, &mapinfo);
+
+       videoinfo->video_frame_count++;
+       if (videoinfo->video_frame_count <= (guint64)_MMCAMCORDER_MINIMUM_FRAME) {
                /* _mmcam_dbg_log("Pass minimum frame: info->video_frame_count: %" G_GUINT64_FORMAT " ",
                                info->video_frame_count); */
-        videoinfo->filesize += buffer_size;
-        return GST_PAD_PROBE_OK;
+               pthread_mutex_lock(&(videoinfo->size_check_lock));
+               videoinfo->filesize += buffer_size;
+               pthread_mutex_unlock(&(videoinfo->size_check_lock));
+               return GST_PAD_PROBE_OK;
        }
 
        /* get trailer size */
-    if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
-               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+       if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+               MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
        } else {
                trailer_size = 0;
        }
 
-       /* to minimizing free space check overhead */
-       count = count % _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL;
-       if (count++ == 0) {
-        filename = videoinfo->filename;
-               ret = _mmcamcorder_get_freespace(filename, &free_space);
+       filename = videoinfo->filename;
+       ret = _mmcamcorder_get_freespace(filename, &free_space);
 
-               /*_mmcam_dbg_log("check free space for recording");*/
+       /*_mmcam_dbg_log("check free space for recording");*/
 
-               switch (ret) {
-               case -2: /* file not exist */
-               case -1: /* failed to get free space */
-                       _mmcam_dbg_err("Error occured. [%d]", ret);
-                       if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
-                               sc->ferror_send = TRUE;
-                               msg.id = MM_MESSAGE_CAMCORDER_ERROR;
-                               if (ret == -2) {
-                                       msg.param.code = MM_ERROR_FILE_NOT_FOUND;
-                               } else {
-                                       msg.param.code = MM_ERROR_FILE_READ;
-                               }
-                               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+       switch (ret) {
+       case -2: /* file not exist */
+       case -1: /* failed to get free space */
+               _mmcam_dbg_err("Error occured. [%d]", ret);
+               if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
+                       sc->ferror_send = TRUE;
+                       msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+                       if (ret == -2) {
+                               msg.param.code = MM_ERROR_FILE_NOT_FOUND;
                        } else {
-                               sc->ferror_count++;
-                       }
-
-            return GST_PAD_PROBE_REMOVE; /* skip this buffer */
-                       break;
-               default: /* succeeded to get free space */
-                       /* check free space for recording */
-                       /* get queued buffer size */
-                       if (sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
-                               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size);
-                       }
-                       if (sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
-                               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size);
+                               msg.param.code = MM_ERROR_FILE_READ;
                        }
+                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+               } else {
+                       sc->ferror_count++;
+               }
 
-                       queued_buffer = aq_size + vq_size;
+               return GST_PAD_PROBE_DROP; /* skip this buffer */
+               break;
+       default: /* succeeded to get free space */
+               /* check free space for recording */
+               /* get queued buffer size */
+               if (sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
+                       MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size);
+               }
+               if (sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
+                       MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size);
+               }
 
-                       /* check free space */
-                       if (free_space < (_MMCAMCORDER_MINIMUM_SPACE + buffer_size + trailer_size + queued_buffer)) {
-                               _mmcam_dbg_warn("No more space for recording!!! Recording is paused.");
-                               _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \
-                                               " buffer size : [%" G_GUINT64_FORMAT "], queued buffer size : [%" G_GUINT64_FORMAT "]", \
-                                               free_space, trailer_size, buffer_size, queued_buffer);
+               queued_buffer = aq_size + vq_size;
 
-                               if (!sc->isMaxsizePausing) {
-                                       MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
-                                       sc->isMaxsizePausing = TRUE;
+               /* check free space */
+               if (free_space < (_MMCAMCORDER_MINIMUM_SPACE + buffer_size + trailer_size + queued_buffer)) {
+                       _mmcam_dbg_warn("No more space for recording!!! Recording is paused.");
+                       _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \
+                                       " buffer size : [%" G_GUINT64_FORMAT "], queued buffer size : [%" G_GUINT64_FORMAT "]", \
+                                       free_space, trailer_size, buffer_size, queued_buffer);
 
-                                       msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
-                                       _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-                               }
+                       if (!sc->isMaxsizePausing) {
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+                               sc->isMaxsizePausing = TRUE;
 
-                return GST_PAD_PROBE_DROP;
+                               msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
+                               _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
                        }
-                       break;
+
+                       return GST_PAD_PROBE_DROP;
                }
+               break;
        }
 
+       pthread_mutex_lock(&(videoinfo->size_check_lock));
+
        /* check max size of recorded file */
-    if (videoinfo->max_size > 0 &&
-        videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+       if (videoinfo->max_size > 0 &&
+           videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
                GstState pipeline_state = GST_STATE_VOID_PENDING;
                GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
                _mmcam_dbg_warn("Max size!!! Recording is paused.");
                _mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \
                                " buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]",
-                        videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
+                                               videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
 
                if (!sc->isMaxsizePausing) {
+                       sc->isMaxsizePausing = TRUE;
                        gst_element_get_state(pipeline, &pipeline_state, NULL, -1) ;
                        if (pipeline_state == GST_STATE_PLAYING) {
-                               MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
-                               sc->isMaxsizePausing = TRUE;
+                               MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
                        }
 
                        msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
                        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
                }
 
-        return GST_PAD_PROBE_DROP;
+               pthread_mutex_unlock(&(videoinfo->size_check_lock));
+
+               return GST_PAD_PROBE_DROP;
        }
 
-    videoinfo->filesize += buffer_size;
+       videoinfo->filesize += (guint64)buffer_size;
+
+       /*
+       _mmcam_dbg_log("filesize %lld Byte, ", videoinfo->filesize);
+       */
 
-    _mmcam_dbg_log("filesize %lld Byte, ", videoinfo->filesize);
+       pthread_mutex_unlock(&(videoinfo->size_check_lock));
 
-    return GST_PAD_PROBE_OK;
+       return GST_PAD_PROBE_OK;
 }
 
 
@@ -1252,42 +1488,42 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
        _MMCamcorderMsgItem msg;
        _MMCamcorderSubContext *sc = NULL;
-    _MMCamcorderVideoInfo *videoinfo = NULL;
+       _MMCamcorderVideoInfo *videoinfo = NULL;
 
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
 
-       mmf_return_val_if_fail(buffer, FALSE);
-       mmf_return_val_if_fail(hcamcorder, TRUE);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
-       mmf_return_val_if_fail(sc, TRUE);
-       mmf_return_val_if_fail(sc->info_video, TRUE);
+       mmf_return_val_if_fail(sc, GST_PAD_PROBE_OK);
+       mmf_return_val_if_fail(sc->info_video, GST_PAD_PROBE_OK);
 
-    videoinfo = sc->info_video;
+       videoinfo = sc->info_video;
 
-       b_time = GST_BUFFER_TIMESTAMP(buffer);
+       b_time = GST_BUFFER_PTS(buffer);
 
        rec_pipe_time = GST_TIME_AS_MSECONDS(b_time);
 
-    if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
-               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+       if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+               MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
        } else {
                trailer_size = 0;
        }
 
        /* check max time */
-    if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
+       if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
                _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
-                        rec_pipe_time, videoinfo->max_time);
+                               rec_pipe_time, videoinfo->max_time);
 
                if (!sc->isMaxtimePausing) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
 
                        sc->isMaxtimePausing = TRUE;
 
                        msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
                        msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-            msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+                       msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
                        msg.param.recording_status.remained_time = 0;
                        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
@@ -1295,93 +1531,116 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad
                        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
                }
 
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        /* calculate remained time can be recorded */
-    if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
-        remained_time = videoinfo->max_time - rec_pipe_time;
-    } else if (videoinfo->max_size > 0) {
-        long double max_size = (long double)videoinfo->max_size;
-        long double current_size = (long double)(videoinfo->filesize + trailer_size);
+       if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
+               remained_time = videoinfo->max_time - rec_pipe_time;
+       } else if (videoinfo->max_size > 0) {
+               long double max_size = (long double)videoinfo->max_size;
+               long double current_size = (long double)(videoinfo->filesize + trailer_size);
 
                remained_time = (unsigned int)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
        }
 
        msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
        msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-    msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+       msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
        msg.param.recording_status.remained_time = remained_time;
        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
+       /*
        _mmcam_dbg_log("time [%" GST_TIME_FORMAT "], size [%d]",
                       GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize);
+       */
+
+       if (videoinfo->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+               guint record_motion_rate = (guint)videoinfo->record_motion_rate;
 
-    if (videoinfo->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
-        GST_BUFFER_TIMESTAMP(buffer) = b_time * (videoinfo->record_timestamp_ratio);
+               /*
+               _mmcam_dbg_log("record_motion_rate %d, videoinfo->record_drop_count %d",
+                              record_motion_rate, videoinfo->record_drop_count);
+               */
+
+               /* drop some frame if fast motion */
+               if (videoinfo->record_motion_rate > _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+                       if (record_motion_rate != (videoinfo->record_drop_count++)) {
+                               /*
+                               _mmcam_dbg_warn("drop frame");
+                               */
+                               return GST_PAD_PROBE_DROP;
+                       }
+
+                       videoinfo->record_drop_count = 1;
+                       /*
+                       _mmcam_dbg_warn("pass frame");
+                       */
+               }
+
+               GST_BUFFER_PTS(buffer) = b_time * (videoinfo->record_timestamp_ratio);
        }
 
-    return GST_PAD_PROBE_OK;
+       return GST_PAD_PROBE_OK;
 }
 
+
 static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
        _MMCamcorderMsgItem msg;
        guint64 trailer_size = 0;
        guint64 rec_pipe_time = 0;
        _MMCamcorderSubContext *sc = NULL;
-       GstElement *pipeline = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
-    _MMCamcorderVideoInfo *videoinfo = NULL;
+       _MMCamcorderVideoInfo *videoinfo = NULL;
        unsigned int remained_time = 0;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
 
-       mmf_return_val_if_fail(buffer, FALSE);
-       mmf_return_val_if_fail(hcamcorder, TRUE);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
        sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
 
-       mmf_return_val_if_fail(sc, TRUE);
-       mmf_return_val_if_fail(sc->info_video, TRUE);
-       mmf_return_val_if_fail(sc->element, TRUE);
+       mmf_return_val_if_fail(sc, GST_PAD_PROBE_OK);
+       mmf_return_val_if_fail(sc->info_video, GST_PAD_PROBE_OK);
+       mmf_return_val_if_fail(sc->element, GST_PAD_PROBE_OK);
 
-    videoinfo = sc->info_video;
-       pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+       videoinfo = sc->info_video;
 
-       if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(buffer))) {
+       if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) {
                _mmcam_dbg_err( "Buffer timestamp is invalid, check it");
-        return GST_PAD_PROBE_OK;
+               return GST_PAD_PROBE_OK;
        }
 
-       rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer));
+       rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer));
 
-    if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
-               MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+       if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+               MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
        } else {
                trailer_size = 0;
        }
 
        /* calculate remained time can be recorded */
-    if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
-        remained_time = videoinfo->max_time - rec_pipe_time;
-    } else if (videoinfo->max_size > 0) {
-        long double max_size = (long double)videoinfo->max_size;
-        long double current_size = (long double)(videoinfo->filesize + trailer_size);
+       if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
+               remained_time = videoinfo->max_time - rec_pipe_time;
+       } else if (videoinfo->max_size > 0) {
+               long double max_size = (long double)videoinfo->max_size;
+               long double current_size = (long double)(videoinfo->filesize + trailer_size);
 
                remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
        }
 
-    if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
+       if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
                _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
-                        rec_pipe_time, videoinfo->max_time);
+                               rec_pipe_time, videoinfo->max_time);
 
                if (!sc->isMaxtimePausing) {
-                       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+                       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
 
                        sc->isMaxtimePausing = TRUE;
 
                        msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
                        msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-            msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+                       msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
                        msg.param.recording_status.remained_time = 0;
                        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
@@ -1389,19 +1648,21 @@ static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadPro
                        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
                }
 
-        return GST_PAD_PROBE_DROP;
+               return GST_PAD_PROBE_DROP;
        }
 
        msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
        msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
-    msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+       msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
        msg.param.recording_status.remained_time = remained_time;
        _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
 
+       /*
        _mmcam_dbg_log("audio data probe :: time [%" GST_TIME_FORMAT "], size [%lld KB]",
                       GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize);
+       */
 
-    return GST_PAD_PROBE_OK;
+       return GST_PAD_PROBE_OK;
 }
 
 
@@ -1413,13 +1674,13 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G
        int channel = 0;
        int err = MM_ERROR_UNKNOWN;
        char *err_name = NULL;
-    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
-    GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+       GstMapInfo mapinfo = GST_MAP_INFO_INIT;
 
-       mmf_return_val_if_fail(buffer, FALSE);
-       mmf_return_val_if_fail(hcamcorder, FALSE);
+       mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+       mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
 
-       /*_mmcam_dbg_log("AUDIO SRC time stamp : [%" GST_TIME_FORMAT "] \n", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+       /*_mmcam_dbg_log("AUDIO SRC time stamp : [%" GST_TIME_FORMAT "] \n", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
        err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_name,
                                          MMCAM_AUDIO_VOLUME, &volume,
                                          MMCAM_AUDIO_FORMAT, &format,
@@ -1430,33 +1691,31 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G
                SAFE_FREE(err_name);
                return err;
        }
+       gst_buffer_map(buffer, &mapinfo, GST_MAP_READWRITE);
 
        /* Set audio stream NULL */
        if (volume == 0.0) {
-        gst_buffer_map(buffer, &mapinfo, GST_MAP_WRITE);
-        memset(mapinfo.data, 0, mapinfo.size);
-        gst_buffer_unmap(buffer, &mapinfo);
+               memset(mapinfo.data, 0, mapinfo.size);
        }
 
        /* CALL audio stream callback */
-    gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
-    if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) {
+       if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) {
                MMCamcorderAudioStreamDataType stream;
 
                if (_mmcamcorder_get_state((MMHandleType)hcamcorder) < MM_CAMCORDER_STATE_PREPARE) {
                        _mmcam_dbg_warn("Not ready for stream callback");
-            gst_buffer_unmap(buffer, &mapinfo);
-            return GST_PAD_PROBE_OK;
+                       gst_buffer_unmap(buffer, &mapinfo);
+                       return GST_PAD_PROBE_OK;
                }
 
                /*_mmcam_dbg_log("Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]",
                               GST_BUFFER_DATA(buffer), width, height, format);*/
 
-        stream.data = (void *)mapinfo.data;
+               stream.data = (void *)mapinfo.data;
                stream.format = format;
                stream.channel = channel;
-        stream.length = mapinfo.size;
-               stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); /* nano -> milli second */
+               stream.length = mapinfo.size;
+               stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano -> milli second */
 
                _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(hcamcorder);
 
@@ -1466,9 +1725,9 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G
 
                _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(hcamcorder);
        }
-    gst_buffer_unmap(buffer, &mapinfo);
 
-    return GST_PAD_PROBE_OK;
+       gst_buffer_unmap(buffer, &mapinfo);
+       return GST_PAD_PROBE_OK;
 }
 
 
@@ -1503,6 +1762,7 @@ static gboolean __mmcamcorder_add_locationinfo_mp4(MMHandleType handle)
        gdouble altitude = 0;
        int err = 0;
        int orientation = 0;
+       int gps_enable = 0;
        char *err_name = NULL;
        char err_msg[MAX_ERROR_MESSAGE_LEN] = {'\0',};
        _MMCamcorderLocationInfo location_info = {0,};
@@ -1533,6 +1793,7 @@ static gboolean __mmcamcorder_add_locationinfo_mp4(MMHandleType handle)
                                    MMCAM_TAG_LONGITUDE, &longitude,
                                    MMCAM_TAG_ALTITUDE, &altitude,
                                    MMCAM_TAG_VIDEO_ORIENTATION, &orientation,
+                                   MMCAM_TAG_GPS_ENABLE, &gps_enable,
                                    NULL);
        if (err_name) {
                _mmcam_dbg_warn("Get tag attrs fail. (%s:%x)", err_name, err);
@@ -1572,8 +1833,10 @@ static gboolean __mmcamcorder_add_locationinfo_mp4(MMHandleType handle)
                        goto fail;
                }
 
-               if (!_mmcamcorder_write_loci(f, location_info)) {
-                       goto fail;
+               if (gps_enable) {
+                       if (!_mmcamcorder_write_loci(f, location_info)) {
+                               goto fail;
+                       }
                }
 
                current_pos = ftell(f);
@@ -1653,3 +1916,99 @@ ftell_fail:
        fclose(f);
        return FALSE;
 }
+
+
+int _mmcamcorder_connect_video_stream_cb_signal(MMHandleType handle)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
+
+       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       /* check video source element */
+       if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+               _mmcam_dbg_warn("connect video stream cb signal to _MMCAMCORDER_VIDEOSRC_SRC");
+               MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
+                                          _MMCAMCORDER_HANDLER_VIDEOREC, "video-stream-cb",
+                                          G_CALLBACK(__mmcamcorder_video_stream_cb),
+                                          hcamcorder);
+               return MM_ERROR_NONE;
+       } else {
+               _mmcam_dbg_err("videosrc element is not created yet");
+               return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+       }
+}
+
+
+int _mmcamcorder_video_prepare_record(MMHandleType handle)
+{
+       int ret = MM_ERROR_NONE;
+
+       _MMCamcorderVideoInfo *info = NULL;
+       _MMCamcorderSubContext *sc = NULL;
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+       mmf_return_val_if_fail(sc->info_video, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+       info = sc->info_video;
+
+       _mmcam_dbg_warn("start");
+
+       /* create encoding pipeline */
+       ret =_mmcamcorder_create_recorder_pipeline((MMHandleType)hcamcorder);
+       if (ret != MM_ERROR_NONE) {
+               goto _ERR_PREPARE_RECORD;
+       }
+
+       if (info->filename == NULL) {
+               char *temp_filename = NULL;
+               int size = 0;
+
+               mm_camcorder_get_attributes(handle, NULL,
+                                           MMCAM_TARGET_FILENAME, &temp_filename, &size,
+                                           NULL);
+               if (temp_filename) {
+                       info->filename = strdup(temp_filename);
+               }
+
+               if (!info->filename) {
+                       _mmcam_dbg_err("strdup[src:%p] was failed", temp_filename);
+                       goto _ERR_PREPARE_RECORD;
+               }
+       }
+
+       _mmcam_dbg_log("Record file name [%s]", info->filename);
+
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
+       MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", 0);
+
+       /* Adjust display FPS */
+       sc->display_interval = 0;
+       sc->previous_slot_time = 0;
+
+       ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PAUSED);
+       if (ret != MM_ERROR_NONE) {
+               goto _ERR_PREPARE_RECORD;
+       }
+
+       _mmcam_dbg_warn("done");
+
+       return ret;
+
+_ERR_PREPARE_RECORD:
+       /* Remove recorder pipeline and recording file which size maybe zero */
+       _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
+       if (info && info->filename) {
+               _mmcam_dbg_log("file delete(%s)", info->filename);
+               unlink(info->filename);
+       }
+
+       return ret;
+}
diff --git a/symbols b/symbols
deleted file mode 100644 (file)
index 014b9df..0000000
--- a/symbols
+++ /dev/null
@@ -1,695 +0,0 @@
-ELF Header:
-  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
-  Class:                             ELF32
-  Data:                              2's complement, little endian
-  Version:                           1 (current)
-  OS/ABI:                            UNIX - System V
-  ABI Version:                       0
-  Type:                              DYN (Shared object file)
-  Machine:                           ARM
-  Version:                           0x1
-  Entry point address:               0x3bd0
-  Start of program headers:          52 (bytes into file)
-  Start of section headers:          55684 (bytes into file)
-  Flags:                             0x5000002, has entry point, Version5 EABI
-  Size of this header:               52 (bytes)
-  Size of program headers:           32 (bytes)
-  Number of program headers:         4
-  Size of section headers:           40 (bytes)
-  Number of section headers:         24
-  Section header string table index: 23
-
-Section Headers:
-  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
-  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
-  [ 1] .hash             HASH            000000b4 0000b4 000684 04   A  2   0  4
-  [ 2] .dynsym           DYNSYM          00000738 000738 000da0 10   A  3   2  4
-  [ 3] .dynstr           STRTAB          000014d8 0014d8 00170d 00   A  0   0  1
-  [ 4] .gnu.version      VERSYM          00002be6 002be6 0001b4 02   A  2   0  2
-  [ 5] .gnu.version_r    VERNEED         00002d9c 002d9c 000040 00   A  3   2  4
-  [ 6] .rel.dyn          REL             00002ddc 002ddc 000500 08   A  2   0  4
-  [ 7] .rel.plt          REL             000032dc 0032dc 000388 08   A  2   9  4
-  [ 8] .init             PROGBITS        00003664 003664 00000c 00  AX  0   0  4
-  [ 9] .plt              PROGBITS        00003670 003670 000560 04  AX  0   0  4
-  [10] .text             PROGBITS        00003bd0 003bd0 006fa4 00  AX  0   0  4
-  [11] .fini             PROGBITS        0000ab74 00ab74 000008 00  AX  0   0  4
-  [12] .rodata           PROGBITS        0000ab7c 00ab7c 0020e4 00   A  0   0  4
-  [13] .eh_frame         PROGBITS        0000cc60 00cc60 000004 00   A  0   0  4
-  [14] .init_array       INIT_ARRAY      00015000 00d000 000004 00  WA  0   0  4
-  [15] .fini_array       FINI_ARRAY      00015004 00d004 000004 00  WA  0   0  4
-  [16] .jcr              PROGBITS        00015008 00d008 000004 00  WA  0   0  4
-  [17] .data.rel.ro      PROGBITS        0001500c 00d00c 000540 00  WA  0   0  4
-  [18] .dynamic          DYNAMIC         0001554c 00d54c 000130 08  WA  3   0  4
-  [19] .got              PROGBITS        0001567c 00d67c 00020c 04  WA  0   0  4
-  [20] .data             PROGBITS        00015888 00d888 000004 00  WA  0   0  4
-  [21] .bss              NOBITS          0001588c 00d88c 0000bc 00  WA  0   0  4
-  [22] .ARM.attributes   ARM_ATTRIBUTES  00000000 00d88c 000031 00      0   0  1
-  [23] .shstrtab         STRTAB          00000000 00d8bd 0000c6 00      0   0  1
-Key to Flags:
-  W (write), A (alloc), X (execute), M (merge), S (strings)
-  I (info), L (link order), G (group), x (unknown)
-  O (extra OS processing required) o (OS specific), p (processor specific)
-
-There are no section groups in this file.
-
-Program Headers:
-  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
-  LOAD           0x000000 0x00000000 0x00000000 0x0cc64 0x0cc64 R E 0x8000
-  LOAD           0x00d000 0x00015000 0x00015000 0x0088c 0x00948 RW  0x8000
-  DYNAMIC        0x00d54c 0x0001554c 0x0001554c 0x00130 0x00130 RW  0x4
-  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
-
- Section to Segment mapping:
-  Segment Sections...
-   00     .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame 
-   01     .init_array .fini_array .jcr .data.rel.ro .dynamic .got .data .bss 
-   02     .dynamic 
-   03     
-
-Dynamic section at offset 0xd54c contains 34 entries:
-  Tag        Type                         Name/Value
- 0x00000001 (NEEDED)                     Shared library: [libgstreamer-0.10.so.0]
- 0x00000001 (NEEDED)                     Shared library: [libgobject-2.0.so.0]
- 0x00000001 (NEEDED)                     Shared library: [libgmodule-2.0.so.0]
- 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
- 0x00000001 (NEEDED)                     Shared library: [libgthread-2.0.so.0]
- 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
- 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
- 0x00000001 (NEEDED)                     Shared library: [libglib-2.0.so.0]
- 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
- 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
- 0x0000000e (SONAME)                     Library soname: [libgstinterfaces-0.10.so.0]
- 0x0000000c (INIT)                       0x3664
- 0x0000000d (FINI)                       0xab74
- 0x00000019 (INIT_ARRAY)                 0x15000
- 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
- 0x0000001a (FINI_ARRAY)                 0x15004
- 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
- 0x00000004 (HASH)                       0xb4
- 0x00000005 (STRTAB)                     0x14d8
- 0x00000006 (SYMTAB)                     0x738
- 0x0000000a (STRSZ)                      5901 (bytes)
- 0x0000000b (SYMENT)                     16 (bytes)
- 0x00000003 (PLTGOT)                     0x1567c
- 0x00000002 (PLTRELSZ)                   904 (bytes)
- 0x00000014 (PLTREL)                     REL
- 0x00000017 (JMPREL)                     0x32dc
- 0x00000011 (REL)                        0x2ddc
- 0x00000012 (RELSZ)                      1280 (bytes)
- 0x00000013 (RELENT)                     8 (bytes)
- 0x6ffffffe (VERNEED)                    0x2d9c
- 0x6fffffff (VERNEEDNUM)                 2
- 0x6ffffff0 (VERSYM)                     0x2be6
- 0x6ffffffa (RELCOUNT)                   145
- 0x00000000 (NULL)                       0x0
-
-Relocation section '.rel.dyn' at offset 0x2ddc contains 160 entries:
- Offset     Info    Type                Sym. Value  Symbol's Name
-00015000  00000017 R_ARM_RELATIVE        
-00015004  00000017 R_ARM_RELATIVE        
-00015010  00000017 R_ARM_RELATIVE        
-0001503c  00000017 R_ARM_RELATIVE        
-0001504c  00000017 R_ARM_RELATIVE        
-00015058  00000017 R_ARM_RELATIVE        
-00015084  00000017 R_ARM_RELATIVE        
-00015094  00000017 R_ARM_RELATIVE        
-000150a8  00000017 R_ARM_RELATIVE        
-000150b8  00000017 R_ARM_RELATIVE        
-000150c4  00000017 R_ARM_RELATIVE        
-000150e8  00000017 R_ARM_RELATIVE        
-00015114  00000017 R_ARM_RELATIVE        
-00015130  00000017 R_ARM_RELATIVE        
-0001515c  00000017 R_ARM_RELATIVE        
-0001516c  00000017 R_ARM_RELATIVE        
-00015180  00000017 R_ARM_RELATIVE        
-00015190  00000017 R_ARM_RELATIVE        
-0001519c  00000017 R_ARM_RELATIVE        
-000151c0  00000017 R_ARM_RELATIVE        
-000151e4  00000017 R_ARM_RELATIVE        
-000151e8  00000017 R_ARM_RELATIVE        
-000151f0  00000017 R_ARM_RELATIVE        
-000151f4  00000017 R_ARM_RELATIVE        
-00015208  00000017 R_ARM_RELATIVE        
-0001520c  00000017 R_ARM_RELATIVE        
-00015214  00000017 R_ARM_RELATIVE        
-00015218  00000017 R_ARM_RELATIVE        
-0001522c  00000017 R_ARM_RELATIVE        
-00015230  00000017 R_ARM_RELATIVE        
-00015238  00000017 R_ARM_RELATIVE        
-0001523c  00000017 R_ARM_RELATIVE        
-00015244  00000017 R_ARM_RELATIVE        
-00015248  00000017 R_ARM_RELATIVE        
-00015250  00000017 R_ARM_RELATIVE        
-00015254  00000017 R_ARM_RELATIVE        
-00015268  00000017 R_ARM_RELATIVE        
-0001526c  00000017 R_ARM_RELATIVE        
-00015274  00000017 R_ARM_RELATIVE        
-00015278  00000017 R_ARM_RELATIVE        
-00015280  00000017 R_ARM_RELATIVE        
-00015284  00000017 R_ARM_RELATIVE        
-00015298  00000017 R_ARM_RELATIVE        
-0001529c  00000017 R_ARM_RELATIVE        
-000152a4  00000017 R_ARM_RELATIVE        
-000152a8  00000017 R_ARM_RELATIVE        
-000152b0  00000017 R_ARM_RELATIVE        
-000152b4  00000017 R_ARM_RELATIVE        
-000152bc  00000017 R_ARM_RELATIVE        
-000152c0  00000017 R_ARM_RELATIVE        
-000152c8  00000017 R_ARM_RELATIVE        
-000152cc  00000017 R_ARM_RELATIVE        
-000152d4  00000017 R_ARM_RELATIVE        
-000152d8  00000017 R_ARM_RELATIVE        
-000152e0  00000017 R_ARM_RELATIVE        
-000152e4  00000017 R_ARM_RELATIVE        
-000152f8  00000017 R_ARM_RELATIVE        
-000152fc  00000017 R_ARM_RELATIVE        
-00015304  00000017 R_ARM_RELATIVE        
-00015308  00000017 R_ARM_RELATIVE        
-00015310  00000017 R_ARM_RELATIVE        
-00015314  00000017 R_ARM_RELATIVE        
-0001531c  00000017 R_ARM_RELATIVE        
-00015320  00000017 R_ARM_RELATIVE        
-00015334  00000017 R_ARM_RELATIVE        
-00015338  00000017 R_ARM_RELATIVE        
-00015340  00000017 R_ARM_RELATIVE        
-00015344  00000017 R_ARM_RELATIVE        
-0001534c  00000017 R_ARM_RELATIVE        
-00015350  00000017 R_ARM_RELATIVE        
-00015364  00000017 R_ARM_RELATIVE        
-00015368  00000017 R_ARM_RELATIVE        
-00015370  00000017 R_ARM_RELATIVE        
-00015374  00000017 R_ARM_RELATIVE        
-0001537c  00000017 R_ARM_RELATIVE        
-00015380  00000017 R_ARM_RELATIVE        
-00015388  00000017 R_ARM_RELATIVE        
-0001538c  00000017 R_ARM_RELATIVE        
-00015394  00000017 R_ARM_RELATIVE        
-00015398  00000017 R_ARM_RELATIVE        
-000153a0  00000017 R_ARM_RELATIVE        
-000153a4  00000017 R_ARM_RELATIVE        
-000153ac  00000017 R_ARM_RELATIVE        
-000153b0  00000017 R_ARM_RELATIVE        
-000153b8  00000017 R_ARM_RELATIVE        
-000153bc  00000017 R_ARM_RELATIVE        
-000153c4  00000017 R_ARM_RELATIVE        
-000153c8  00000017 R_ARM_RELATIVE        
-000153d0  00000017 R_ARM_RELATIVE        
-000153d4  00000017 R_ARM_RELATIVE        
-000153dc  00000017 R_ARM_RELATIVE        
-000153e0  00000017 R_ARM_RELATIVE        
-000153e8  00000017 R_ARM_RELATIVE        
-000153ec  00000017 R_ARM_RELATIVE        
-000153f4  00000017 R_ARM_RELATIVE        
-000153f8  00000017 R_ARM_RELATIVE        
-00015400  00000017 R_ARM_RELATIVE        
-00015404  00000017 R_ARM_RELATIVE        
-0001540c  00000017 R_ARM_RELATIVE        
-00015410  00000017 R_ARM_RELATIVE        
-00015424  00000017 R_ARM_RELATIVE        
-00015428  00000017 R_ARM_RELATIVE        
-00015430  00000017 R_ARM_RELATIVE        
-00015434  00000017 R_ARM_RELATIVE        
-0001543c  00000017 R_ARM_RELATIVE        
-00015440  00000017 R_ARM_RELATIVE        
-00015448  00000017 R_ARM_RELATIVE        
-0001544c  00000017 R_ARM_RELATIVE        
-00015454  00000017 R_ARM_RELATIVE        
-00015458  00000017 R_ARM_RELATIVE        
-00015460  00000017 R_ARM_RELATIVE        
-00015464  00000017 R_ARM_RELATIVE        
-0001546c  00000017 R_ARM_RELATIVE        
-00015470  00000017 R_ARM_RELATIVE        
-00015478  00000017 R_ARM_RELATIVE        
-0001547c  00000017 R_ARM_RELATIVE        
-00015484  00000017 R_ARM_RELATIVE        
-00015488  00000017 R_ARM_RELATIVE        
-00015490  00000017 R_ARM_RELATIVE        
-00015494  00000017 R_ARM_RELATIVE        
-0001549c  00000017 R_ARM_RELATIVE        
-000154a0  00000017 R_ARM_RELATIVE        
-000154b4  00000017 R_ARM_RELATIVE        
-000154b8  00000017 R_ARM_RELATIVE        
-000154c0  00000017 R_ARM_RELATIVE        
-000154c4  00000017 R_ARM_RELATIVE        
-000154cc  00000017 R_ARM_RELATIVE        
-000154d0  00000017 R_ARM_RELATIVE        
-000154d8  00000017 R_ARM_RELATIVE        
-000154dc  00000017 R_ARM_RELATIVE        
-000154f0  00000017 R_ARM_RELATIVE        
-000154f4  00000017 R_ARM_RELATIVE        
-000154fc  00000017 R_ARM_RELATIVE        
-00015500  00000017 R_ARM_RELATIVE        
-00015508  00000017 R_ARM_RELATIVE        
-0001550c  00000017 R_ARM_RELATIVE        
-00015514  00000017 R_ARM_RELATIVE        
-00015518  00000017 R_ARM_RELATIVE        
-00015520  00000017 R_ARM_RELATIVE        
-00015524  00000017 R_ARM_RELATIVE        
-0001552c  00000017 R_ARM_RELATIVE        
-00015530  00000017 R_ARM_RELATIVE        
-00015538  00000017 R_ARM_RELATIVE        
-0001553c  00000017 R_ARM_RELATIVE        
-00015888  00000017 R_ARM_RELATIVE        
-0001584c  00000215 R_ARM_GLOB_DAT         00000000   g_free
-00015850  00000915 R_ARM_GLOB_DAT         00009e60   gst_interfaces_marshal_VOID__OBJECT_ULONG
-00015854  00001315 R_ARM_GLOB_DAT         00000000   g_cclosure_marshal_VOID__INT
-00015858  00001815 R_ARM_GLOB_DAT         00000000   __gst_debug_min
-0001585c  00001915 R_ARM_GLOB_DAT         00009f90   gst_interfaces_marshal_VOID__OBJECT_POINTER
-00015860  00001c15 R_ARM_GLOB_DAT         00000000   __gmon_start__
-00015864  00001d15 R_ARM_GLOB_DAT         00000000   _Jv_RegisterClasses
-00015868  00003e15 R_ARM_GLOB_DAT         00009ef8   gst_interfaces_marshal_VOID__OBJECT_STRING
-0001586c  00005615 R_ARM_GLOB_DAT         00000000   GST_CAT_DEFAULT
-00015870  00008815 R_ARM_GLOB_DAT         00000000   g_cclosure_marshal_VOID__POINTER
-00015874  0000b215 R_ARM_GLOB_DAT         0000a028   gst_interfaces_marshal_VOID__OBJECT_BOOLEAN
-00015878  0000b415 R_ARM_GLOB_DAT         00000000   g_cclosure_marshal_VOID__OBJECT
-0001587c  0000cc15 R_ARM_GLOB_DAT         00000000   g_cclosure_marshal_VOID__ULONG
-00015880  0000d415 R_ARM_GLOB_DAT         00000000   __cxa_finalize
-00015884  0000d515 R_ARM_GLOB_DAT         00009dcc   gst_interfaces_marshal_VOID__OBJECT_INT
-
-Relocation section '.rel.plt' at offset 0x32dc contains 113 entries:
- Offset     Info    Type                Sym. Value  Symbol's Name
-00015688  00000216 R_ARM_JUMP_SLOT        00000000   g_free
-0001568c  00000316 R_ARM_JUMP_SLOT        00000000   g_type_interface_peek
-00015690  00000616 R_ARM_JUMP_SLOT        00000000   g_value_unset
-00015694  00000816 R_ARM_JUMP_SLOT        00000000   g_param_spec_string
-00015698  00000a16 R_ARM_JUMP_SLOT        00000000   gst_structure_has_name
-0001569c  00000c16 R_ARM_JUMP_SLOT        00000000   gst_value_array_get_value
-000156a0  00000d16 R_ARM_JUMP_SLOT        000072c4   gst_navigation_send_event
-000156a4  00001116 R_ARM_JUMP_SLOT        00006c10   gst_navigation_query_get_type
-000156a8  00001216 R_ARM_JUMP_SLOT        00000000   g_value_dup_string
-000156ac  00001416 R_ARM_JUMP_SLOT        00000000   g_flags_register_static
-000156b0  00001516 R_ARM_JUMP_SLOT        000076ec   gst_property_probe_needs_probe
-000156b4  00001716 R_ARM_JUMP_SLOT        00000000   g_object_get_data
-000156b8  00001a16 R_ARM_JUMP_SLOT        00000000   g_signal_emit
-000156bc  00001b16 R_ARM_JUMP_SLOT        000074b0   gst_property_probe_get_type
-000156c0  00001c16 R_ARM_JUMP_SLOT        00000000   __gmon_start__
-000156c4  00001e16 R_ARM_JUMP_SLOT        00000000   g_signal_emit_by_name
-000156c8  00002216 R_ARM_JUMP_SLOT        00000000   pow
-000156cc  00002416 R_ARM_JUMP_SLOT        00000000   g_value_get_enum
-000156d0  00002716 R_ARM_JUMP_SLOT        00000000   g_list_foreach
-000156d4  00002816 R_ARM_JUMP_SLOT        00000000   g_list_free
-000156d8  00002916 R_ARM_JUMP_SLOT        00000000   gst_message_new_custom
-000156dc  00002b16 R_ARM_JUMP_SLOT        00000000   g_value_set_int
-000156e0  00002d16 R_ARM_JUMP_SLOT        00000000   g_object_set_data_full
-000156e4  00003116 R_ARM_JUMP_SLOT        00007274   gst_navigation_get_type
-000156e8  00003216 R_ARM_JUMP_SLOT        00000000   gst_structure_get_int
-000156ec  00003316 R_ARM_JUMP_SLOT        00000000   g_value_get_uint
-000156f0  00003516 R_ARM_JUMP_SLOT        00000000   gst_fraction_get_type
-000156f4  00003616 R_ARM_JUMP_SLOT        00000000   g_object_class_install_property
-000156f8  00003716 R_ARM_JUMP_SLOT        00000000   gst_value_array_get_type
-000156fc  00003816 R_ARM_JUMP_SLOT        00000000   g_param_spec_uint
-00015700  00003916 R_ARM_JUMP_SLOT        00000000   g_enum_register_static
-00015704  00003a16 R_ARM_JUMP_SLOT        00000000   g_malloc
-00015708  00003d16 R_ARM_JUMP_SLOT        00009348   gst_tuner_norm_get_type
-0001570c  00003f16 R_ARM_JUMP_SLOT        00000000   g_value_peek_pointer
-00015710  00004016 R_ARM_JUMP_SLOT        00000000   gst_structure_set_value
-00015714  00004116 R_ARM_JUMP_SLOT        00000000   gst_structure_get_uint
-00015718  00004216 R_ARM_JUMP_SLOT        00000000   gst_structure_get_double
-0001571c  00004416 R_ARM_JUMP_SLOT        00000000   g_param_spec_int
-00015720  00004916 R_ARM_JUMP_SLOT        00000000   gst_structure_new
-00015724  00004e16 R_ARM_JUMP_SLOT        000040b0   gst_mixer_message_get_type
-00015728  00004f16 R_ARM_JUMP_SLOT        000098b8   gst_x_overlay_get_type
-0001572c  00005016 R_ARM_JUMP_SLOT        00009640   gst_video_orientation_get_type
-00015730  00005216 R_ARM_JUMP_SLOT        00007500   gst_property_probe_get_values
-00015734  00005716 R_ARM_JUMP_SLOT        00000000   gst_implements_interface_check
-00015738  00005816 R_ARM_JUMP_SLOT        00005560   gst_mixer_get_type
-0001573c  00005916 R_ARM_JUMP_SLOT        00000000   g_value_set_string
-00015740  00005a16 R_ARM_JUMP_SLOT        00005ca4   gst_mixer_options_get_type
-00015744  00005b16 R_ARM_JUMP_SLOT        0000a3fc   gst_navigation_command_get_type
-00015748  00005e16 R_ARM_JUMP_SLOT        000069f8   gst_navigation_message_get_type
-0001574c  00005f16 R_ARM_JUMP_SLOT        00000000   gst_value_list_get_size
-00015750  00006016 R_ARM_JUMP_SLOT        00000000   cbrt
-00015754  00006116 R_ARM_JUMP_SLOT        00000000   g_type_check_class_cast
-00015758  00006716 R_ARM_JUMP_SLOT        00000000   gst_debug_log
-0001575c  00006916 R_ARM_JUMP_SLOT        00000000   g_object_set_data
-00015760  00006a16 R_ARM_JUMP_SLOT        00000000   g_once_init_enter_impl
-00015764  00006b16 R_ARM_JUMP_SLOT        00000000   g_param_spec_boolean
-00015768  00006c16 R_ARM_JUMP_SLOT        00000000   gst_value_list_get_type
-0001576c  00006e16 R_ARM_JUMP_SLOT        00008dbc   gst_tuner_list_norms
-00015770  00007016 R_ARM_JUMP_SLOT        00000000   gst_message_get_type
-00015774  00007116 R_ARM_JUMP_SLOT        00000000   g_object_get
-00015778  00007216 R_ARM_JUMP_SLOT        00000000   gst_structure_get_string
-0001577c  00007316 R_ARM_JUMP_SLOT        000079d4   gst_property_probe_probe_and_get_values
-00015780  00007616 R_ARM_JUMP_SLOT        00000000   g_value_set_enum
-00015784  00007a16 R_ARM_JUMP_SLOT        00000000   g_return_if_fail_warning
-00015788  00007d16 R_ARM_JUMP_SLOT        00000000   g_type_register_static
-0001578c  00007f16 R_ARM_JUMP_SLOT        00000000   gst_event_get_structure
-00015790  00008016 R_ARM_JUMP_SLOT        00000000   g_object_set
-00015794  00008316 R_ARM_JUMP_SLOT        00000000   g_value_get_object
-00015798  00008916 R_ARM_JUMP_SLOT        00000000   g_signal_new
-0001579c  00008a16 R_ARM_JUMP_SLOT        00003cf4   gst_color_balance_get_type
-000157a0  00008b16 R_ARM_JUMP_SLOT        00000000   g_type_check_instance_is_a
-000157a4  00008d16 R_ARM_JUMP_SLOT        00000000   gst_message_new_element
-000157a8  00008e16 R_ARM_JUMP_SLOT        00000000   gst_structure_get_value
-000157ac  00008f16 R_ARM_JUMP_SLOT        00005e5c   gst_mixer_track_get_type
-000157b0  00009016 R_ARM_JUMP_SLOT        00000000   gst_query_new_application
-000157b4  00009116 R_ARM_JUMP_SLOT        00000000   g_param_spec_double
-000157b8  00009416 R_ARM_JUMP_SLOT        00000000   gst_value_array_get_size
-000157bc  00009516 R_ARM_JUMP_SLOT        00000000   gst_message_get_structure
-000157c0  00009616 R_ARM_JUMP_SLOT        00000000   g_type_name
-000157c4  00009716 R_ARM_JUMP_SLOT        00000000   log10
-000157c8  00009916 R_ARM_JUMP_SLOT        00009480   gst_tuner_channel_get_type
-000157cc  00009b16 R_ARM_JUMP_SLOT        00000000   gst_value_list_get_value
-000157d0  00009c16 R_ARM_JUMP_SLOT        00000000   g_type_interface_add_prerequisite
-000157d4  00009d16 R_ARM_JUMP_SLOT        00000000   gst_element_post_message
-000157d8  00009e16 R_ARM_JUMP_SLOT        00000000   gst_implements_interface_get_type
-000157dc  00009f16 R_ARM_JUMP_SLOT        00008538   gst_tuner_get_type
-000157e0  0000a116 R_ARM_JUMP_SLOT        00000000   g_type_check_instance_cast
-000157e4  0000a216 R_ARM_JUMP_SLOT        00000000   gst_element_get_type
-000157e8  0000a316 R_ARM_JUMP_SLOT        00007f94   gst_stream_volume_convert_volume
-000157ec  0000a416 R_ARM_JUMP_SLOT        00008260   gst_stream_volume_get_type
-000157f0  0000a516 R_ARM_JUMP_SLOT        00000000   g_object_interface_install_property
-000157f4  0000a916 R_ARM_JUMP_SLOT        00000000   g_object_class_find_property
-000157f8  0000aa16 R_ARM_JUMP_SLOT        00000000   gst_value_list_append_value
-000157fc  0000af16 R_ARM_JUMP_SLOT        00007cbc   gst_property_probe_get_properties
-00015800  0000b016 R_ARM_JUMP_SLOT        00000000   g_value_init
-00015804  0000b516 R_ARM_JUMP_SLOT        00000000   gst_structure_get_boolean
-00015808  0000b616 R_ARM_JUMP_SLOT        0000902c   gst_tuner_list_channels
-0001580c  0000b816 R_ARM_JUMP_SLOT        00000000   g_value_set_uint
-00015810  0000b916 R_ARM_JUMP_SLOT        00000000   gst_query_get_structure
-00015814  0000be16 R_ARM_JUMP_SLOT        00000000   g_type_check_value_holds
-00015818  0000c016 R_ARM_JUMP_SLOT        00000000   g_value_get_int
-0001581c  0000c216 R_ARM_JUMP_SLOT        00000000   g_once_init_leave
-00015820  0000c416 R_ARM_JUMP_SLOT        00000000   gst_value_array_append_value
-00015824  0000c516 R_ARM_JUMP_SLOT        000078e8   gst_property_probe_probe_property
-00015828  0000c616 R_ARM_JUMP_SLOT        00000000   gst_object_get_type
-0001582c  0000cd16 R_ARM_JUMP_SLOT        00000000   g_type_class_peek_parent
-00015830  0000ce16 R_ARM_JUMP_SLOT        0000642c   gst_navigation_event_get_type
-00015834  0000cf16 R_ARM_JUMP_SLOT        00000000   g_log
-00015838  0000d116 R_ARM_JUMP_SLOT        00000000   strcmp
-0001583c  0000d216 R_ARM_JUMP_SLOT        00000000   g_str_equal
-00015840  0000d416 R_ARM_JUMP_SLOT        00000000   __cxa_finalize
-00015844  0000d716 R_ARM_JUMP_SLOT        00000000   gst_structure_set
-00015848  0000d816 R_ARM_JUMP_SLOT        00003f08   gst_color_balance_channel_get_type
-
-There are no unwind sections in this file.
-
-Symbol table '.dynsym' contains 218 entries:
-   Num:    Value  Size Type    Bind   Vis      Ndx Name
-     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
-     1: 00003664     0 SECTION LOCAL  DEFAULT    8 
-     2: 00000000    88 FUNC    GLOBAL DEFAULT  UND g_free
-     3: 00000000   424 FUNC    GLOBAL DEFAULT  UND g_type_interface_peek
-     4: 00006560   168 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_parse_command
-     5: 00009bb4   368 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_got_xwindow_id
-     6: 00000000   148 FUNC    GLOBAL DEFAULT  UND g_value_unset
-     7: 00009924   160 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_handle_events
-     8: 00000000   116 FUNC    GLOBAL DEFAULT  UND g_param_spec_string
-     9: 00009e60   152 FUNC    GLOBAL DEFAULT   10 gst_interfaces_marshal_VOID__OBJECT_ULONG
-    10: 00000000   172 FUNC    GLOBAL DEFAULT  UND gst_structure_has_name
-    11: 00004304   340 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_parse_option_changed
-    12: 00000000   204 FUNC    GLOBAL DEFAULT  UND gst_value_array_get_value
-    13: 000072c4    60 FUNC    GLOBAL DEFAULT   10 gst_navigation_send_event
-    14: 00004814   376 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_parse_mute_toggled
-    15: 00008ba4   272 FUNC    GLOBAL DEFAULT   10 gst_tuner_set_frequency
-    16: 000097ac    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_get_vcenter
-    17: 00006c10   172 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_get_type
-    18: 00000000   116 FUNC    GLOBAL DEFAULT  UND g_value_dup_string
-    19: 00000000   176 FUNC    GLOBAL DEFAULT  UND g_cclosure_marshal_VOID__INT
-    20: 00000000   220 FUNC    GLOBAL DEFAULT  UND g_flags_register_static
-    21: 000076ec   252 FUNC    GLOBAL DEFAULT   10 gst_property_probe_needs_probe
-    22: 00008d38   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_set_norm
-    23: 00000000   188 FUNC    GLOBAL DEFAULT  UND g_object_get_data
-    24: 00000000     4 OBJECT  GLOBAL DEFAULT  UND __gst_debug_min
-    25: 00009f90   152 FUNC    GLOBAL DEFAULT   10 gst_interfaces_marshal_VOID__OBJECT_POINTER
-    26: 00000000    48 FUNC    GLOBAL DEFAULT  UND g_signal_emit
-    27: 000074b0    80 FUNC    GLOBAL DEFAULT   10 gst_property_probe_get_type
-    28: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
-    29: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
-    30: 00000000   496 FUNC    GLOBAL DEFAULT  UND g_signal_emit_by_name
-    31: 000057a8    68 FUNC    GLOBAL DEFAULT   10 gst_mixer_set_record
-    32: 0000a4ec   120 FUNC    GLOBAL DEFAULT   10 gst_mixer_flags_get_type
-    33: 0000a1a4   120 FUNC    GLOBAL DEFAULT   10 gst_tuner_channel_flags_get_type
-    34: 00000000   728 FUNC    GLOBAL DEFAULT  UND pow@GLIBC_2.4 (2)
-    35: 00009a64   336 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_prepare_xwindow_id
-    36: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_get_enum
-    37: 00005a5c   112 FUNC    GLOBAL DEFAULT   10 gst_mixer_list_tracks
-    38: 00007d7c   384 FUNC    GLOBAL DEFAULT   10 gst_property_probe_get_property
-    39: 00000000    52 FUNC    GLOBAL DEFAULT  UND g_list_foreach
-    40: 00000000    16 FUNC    GLOBAL DEFAULT  UND g_list_free
-    41: 00000000   276 FUNC    GLOBAL DEFAULT  UND gst_message_new_custom
-    42: 000096ac    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_set_vcenter
-    43: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_set_int
-    44: 000041dc   296 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_parse_options_list_changed
-    45: 00000000   196 FUNC    GLOBAL DEFAULT  UND g_object_set_data_full
-    46: 000066e8   268 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_parse_mouse_button_event
-    47: 00004b04   540 FUNC    GLOBAL DEFAULT   10 gst_mixer_options_list_changed
-    48: 00005890   252 FUNC    GLOBAL DEFAULT   10 gst_mixer_get_volume
-    49: 00007274    80 FUNC    GLOBAL DEFAULT   10 gst_navigation_get_type
-    50: 00000000   272 FUNC    GLOBAL DEFAULT  UND gst_structure_get_int
-    51: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_get_uint
-    52: 0000563c    32 FUNC    GLOBAL DEFAULT   10 gst_mixer_get_mixer_type
-    53: 00000000   120 FUNC    GLOBAL DEFAULT  UND gst_fraction_get_type
-    54: 00000000   564 FUNC    GLOBAL DEFAULT  UND g_object_class_install_property
-    55: 00000000   124 FUNC    GLOBAL DEFAULT  UND gst_value_array_get_type
-    56: 00000000   184 FUNC    GLOBAL DEFAULT  UND g_param_spec_uint
-    57: 00000000   220 FUNC    GLOBAL DEFAULT  UND g_enum_register_static
-    58: 00000000   160 FUNC    GLOBAL DEFAULT  UND g_malloc
-    59: 00006d9c   156 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_set_angles
-    60: 00003c8c   104 FUNC    GLOBAL DEFAULT   10 gst_color_balance_value_changed
-    61: 00009348    80 FUNC    GLOBAL DEFAULT   10 gst_tuner_norm_get_type
-    62: 00009ef8   152 FUNC    GLOBAL DEFAULT   10 gst_interfaces_marshal_VOID__OBJECT_STRING
-    63: 00000000   180 FUNC    GLOBAL DEFAULT  UND g_value_peek_pointer
-    64: 00000000   232 FUNC    GLOBAL DEFAULT  UND gst_structure_set_value
-    65: 00000000   272 FUNC    GLOBAL DEFAULT  UND gst_structure_get_uint
-    66: 00000000   272 FUNC    GLOBAL DEFAULT  UND gst_structure_get_double
-    67: 000057ec   164 FUNC    GLOBAL DEFAULT   10 gst_mixer_set_mute
-    68: 00000000   184 FUNC    GLOBAL DEFAULT  UND g_param_spec_int
-    69: 0000a564   120 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_type_get_type
-    70: 000067f4   136 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_parse_key_event
-    71: 0000972c    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_set_vflip
-    72: 00008a88   284 FUNC    GLOBAL DEFAULT   10 gst_tuner_get_frequency
-    73: 00000000   124 FUNC    GLOBAL DEFAULT  UND gst_structure_new
-    74: 00006e38    92 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_new_angles
-    75: 0000986c    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_get_hflip
-    76: 00008894   216 FUNC    GLOBAL DEFAULT   10 gst_tuner_channel_changed
-    77: 0000896c   284 FUNC    GLOBAL DEFAULT   10 gst_tuner_signal_strength
-    78: 000040b0   300 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_get_type
-    79: 000098b8   108 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_get_type
-    80: 00009640   108 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_get_type
-    81: 00008354   128 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_get_mute
-    82: 00007500   240 FUNC    GLOBAL DEFAULT   10 gst_property_probe_get_values
-    83: 000097ec    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_get_hcenter
-    84: 0000737c   192 FUNC    GLOBAL DEFAULT   10 gst_navigation_send_mouse_event
-    85: 00006ef0   152 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_parse_commands_length
-    86: 00000000     4 OBJECT  GLOBAL DEFAULT  UND GST_CAT_DEFAULT
-    87: 00000000   164 FUNC    GLOBAL DEFAULT  UND gst_implements_interface_check
-    88: 00005560   108 FUNC    GLOBAL DEFAULT   10 gst_mixer_get_type
-    89: 00000000   160 FUNC    GLOBAL DEFAULT  UND g_value_set_string
-    90: 00005ca4    88 FUNC    GLOBAL DEFAULT   10 gst_mixer_options_get_type
-    91: 0000a3fc   120 FUNC    GLOBAL DEFAULT   10 gst_navigation_command_get_type
-    92: 00003d5c    32 FUNC    GLOBAL DEFAULT   10 gst_color_balance_get_balance_type
-    93: 0000a21c   120 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_format_get_type
-    94: 000069f8   224 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_get_type
-    95: 00000000   128 FUNC    GLOBAL DEFAULT  UND gst_value_list_get_size
-    96: 00000000   656 FUNC    GLOBAL DEFAULT  UND cbrt@GLIBC_2.4 (2)
-    97: 00000000   360 FUNC    GLOBAL DEFAULT  UND g_type_check_class_cast
-    98: 00003d7c    68 FUNC    GLOBAL DEFAULT   10 gst_color_balance_get_value
-    99: 00007300   124 FUNC    GLOBAL DEFAULT   10 gst_navigation_send_command
-   100: 000052ec   628 FUNC    GLOBAL DEFAULT   10 gst_mixer_volume_changed
-   101: 000087bc   216 FUNC    GLOBAL DEFAULT   10 gst_tuner_norm_changed
-   102: 000085a4   264 FUNC    GLOBAL DEFAULT   10 gst_tuner_signal_changed
-   103: 00000000    56 FUNC    GLOBAL DEFAULT  UND gst_debug_log
-   104: 000050fc   496 FUNC    GLOBAL DEFAULT   10 gst_mixer_mute_toggled
-   105: 00000000   184 FUNC    GLOBAL DEFAULT  UND g_object_set_data
-   106: 00000000   272 FUNC    GLOBAL DEFAULT  UND g_once_init_enter_impl
-   107: 00000000   148 FUNC    GLOBAL DEFAULT  UND g_param_spec_boolean
-   108: 00000000   124 FUNC    GLOBAL DEFAULT  UND gst_value_list_get_type
-   109: 000077e8   256 FUNC    GLOBAL DEFAULT   10 gst_property_probe_needs_probe_name
-   110: 00008dbc   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_list_norms
-   111: 00003e04    56 FUNC    GLOBAL DEFAULT   10 gst_color_balance_list_channels
-   112: 00000000   220 FUNC    GLOBAL DEFAULT  UND gst_message_get_type
-   113: 00000000   164 FUNC    GLOBAL DEFAULT  UND g_object_get
-   114: 00000000   168 FUNC    GLOBAL DEFAULT  UND gst_structure_get_string
-   115: 000079d4   244 FUNC    GLOBAL DEFAULT   10 gst_property_probe_probe_and_get_values
-   116: 00004458   580 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_parse_volume_changed
-   117: 00006bb8    88 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_parse_mouse_over
-   118: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_set_enum
-   119: 00008f24   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_get_channel
-   120: 0000743c   116 FUNC    GLOBAL DEFAULT   10 gst_navigation_send_key_event
-   121: 00006608   224 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_parse_mouse_move_event
-   122: 00000000   100 FUNC    GLOBAL DEFAULT  UND g_return_if_fail_warning
-   123: 000096ec    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_set_hcenter
-   124: 00006f88   200 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_parse_commands_nth
-   125: 00000000  1288 FUNC    GLOBAL DEFAULT  UND g_type_register_static
-   126: 0000a474   120 FUNC    GLOBAL DEFAULT   10 gst_mixer_track_flags_get_type
-   127: 00000000   136 FUNC    GLOBAL DEFAULT  UND gst_event_get_structure
-   128: 00000000   168 FUNC    GLOBAL DEFAULT  UND g_object_set
-   129: 000099c4   160 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_expose
-   130: 00008fa8   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_set_channel
-   131: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_get_object
-   132: 0000565c   168 FUNC    GLOBAL DEFAULT   10 gst_mixer_get_option
-   133: 00003dc0    68 FUNC    GLOBAL DEFAULT   10 gst_color_balance_set_value
-   134: 00006cbc   224 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_parse_angles
-   135: 0000687c   152 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_new_angles_changed
-   136: 00000000   176 FUNC    GLOBAL DEFAULT  UND g_cclosure_marshal_VOID__POINTER
-   137: 00000000   544 FUNC    GLOBAL DEFAULT  UND g_signal_new
-   138: 00003cf4   104 FUNC    GLOBAL DEFAULT   10 gst_color_balance_get_type
-   139: 00000000   452 FUNC    GLOBAL DEFAULT  UND g_type_check_instance_is_a
-   140: 0000469c   376 FUNC    GLOBAL DEFAULT   10 gst_mixer_message_parse_record_toggled
-   141: 00000000    16 FUNC    GLOBAL DEFAULT  UND gst_message_new_element
-   142: 00000000   148 FUNC    GLOBAL DEFAULT  UND gst_structure_get_value
-   143: 00005e5c    80 FUNC    GLOBAL DEFAULT   10 gst_mixer_track_get_type
-   144: 00000000   132 FUNC    GLOBAL DEFAULT  UND gst_query_new_application
-   145: 00000000   236 FUNC    GLOBAL DEFAULT  UND g_param_spec_double
-   146: 00006e94    92 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_new_commands
-   147: 00005704   164 FUNC    GLOBAL DEFAULT   10 gst_mixer_set_option
-   148: 00000000   128 FUNC    GLOBAL DEFAULT  UND gst_value_array_get_size
-   149: 00000000   136 FUNC    GLOBAL DEFAULT  UND gst_message_get_structure
-   150: 00000000   156 FUNC    GLOBAL DEFAULT  UND g_type_name
-   151: 00000000   236 FUNC    GLOBAL DEFAULT  UND log10@GLIBC_2.4 (2)
-   152: 00007188   236 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_set_commands
-   153: 00009480    80 FUNC    GLOBAL DEFAULT   10 gst_tuner_channel_get_type
-   154: 00007bc4   248 FUNC    GLOBAL DEFAULT   10 gst_property_probe_probe_property_name
-   155: 00000000   204 FUNC    GLOBAL DEFAULT  UND gst_value_list_get_value
-   156: 00000000   984 FUNC    GLOBAL DEFAULT  UND g_type_interface_add_prerequisite
-   157: 00000000   492 FUNC    GLOBAL DEFAULT  UND gst_element_post_message
-   158: 00000000   136 FUNC    GLOBAL DEFAULT  UND gst_implements_interface_get_type
-   159: 00008538   108 FUNC    GLOBAL DEFAULT   10 gst_tuner_get_type
-   160: 00005cfc   144 FUNC    GLOBAL DEFAULT   10 gst_mixer_options_get_values
-   161: 00000000   616 FUNC    GLOBAL DEFAULT  UND g_type_check_instance_cast
-   162: 00000000   160 FUNC    GLOBAL DEFAULT  UND gst_element_get_type
-   163: 00007f94   512 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_convert_volume
-   164: 00008260   128 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_get_type
-   165: 00000000   316 FUNC    GLOBAL DEFAULT  UND g_object_interface_install_property
-   166: 000083d4   184 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_set_volume
-   167: 0000598c   208 FUNC    GLOBAL DEFAULT   10 gst_mixer_set_volume
-   168: 00008cb4   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_get_norm
-   169: 00000000   220 FUNC    GLOBAL DEFAULT  UND g_object_class_find_property
-   170: 00000000   192 FUNC    GLOBAL DEFAULT  UND gst_value_list_append_value
-   171: 00008e40   228 FUNC    GLOBAL DEFAULT   10 gst_tuner_find_norm_by_name
-   172: 000082e0   116 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_set_mute
-   173: 0000a0c0   108 FUNC    GLOBAL DEFAULT   10 gst_mixer_type_get_type
-   174: 00007ac8   252 FUNC    GLOBAL DEFAULT   10 gst_property_probe_probe_and_get_values_name
-   175: 00007cbc   192 FUNC    GLOBAL DEFAULT   10 gst_property_probe_get_properties
-   176: 00000000   348 FUNC    GLOBAL DEFAULT  UND g_value_init
-   177: 0000982c    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_get_vflip
-   178: 0000a028   152 FUNC    GLOBAL DEFAULT   10 gst_interfaces_marshal_VOID__OBJECT_BOOLEAN
-   179: 00004f0c   496 FUNC    GLOBAL DEFAULT   10 gst_mixer_record_toggled
-   180: 00000000   176 FUNC    GLOBAL DEFAULT  UND g_cclosure_marshal_VOID__OBJECT
-   181: 00000000   220 FUNC    GLOBAL DEFAULT  UND gst_structure_get_boolean
-   182: 0000902c   132 FUNC    GLOBAL DEFAULT   10 gst_tuner_list_channels
-   183: 00006914   100 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_new_commands_changed
-   184: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_set_uint
-   185: 00000000   136 FUNC    GLOBAL DEFAULT  UND gst_query_get_structure
-   186: 0000976c    64 FUNC    GLOBAL DEFAULT   10 gst_video_orientation_set_hflip
-   187: 000086ac   272 FUNC    GLOBAL DEFAULT   10 gst_tuner_frequency_changed
-   188: 0000a294   120 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_type_get_type
-   189: 00006ad8   224 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_parse_angles_changed
-   190: 00000000   504 FUNC    GLOBAL DEFAULT  UND g_type_check_value_holds
-   191: 000075f0   252 FUNC    GLOBAL DEFAULT   10 gst_property_probe_get_values_name
-   192: 00000000   112 FUNC    GLOBAL DEFAULT  UND g_value_get_int
-   193: 0000a30c   120 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_type_get_type
-   194: 00000000   284 FUNC    GLOBAL DEFAULT  UND g_once_init_leave
-   195: 0000a384   120 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_type_get_type
-   196: 00000000   192 FUNC    GLOBAL DEFAULT  UND gst_value_array_append_value
-   197: 000078e8   236 FUNC    GLOBAL DEFAULT   10 gst_property_probe_probe_property
-   198: 00000000   172 FUNC    GLOBAL DEFAULT  UND gst_object_get_type
-   199: 000070b8   208 FUNC    GLOBAL DEFAULT   10 gst_navigation_query_set_commandsv
-   200: 00004d20   492 FUNC    GLOBAL DEFAULT   10 gst_mixer_option_changed
-   201: 000055cc   112 FUNC    GLOBAL DEFAULT   10 gst_mixer_get_mixer_flags
-   202: 0000848c   172 FUNC    GLOBAL DEFAULT   10 gst_stream_volume_get_volume
-   203: 0000a12c   120 FUNC    GLOBAL DEFAULT   10 gst_color_balance_type_get_type
-   204: 00000000   176 FUNC    GLOBAL DEFAULT  UND g_cclosure_marshal_VOID__ULONG
-   205: 00000000   260 FUNC    GLOBAL DEFAULT  UND g_type_class_peek_parent
-   206: 0000642c   308 FUNC    GLOBAL DEFAULT   10 gst_navigation_event_get_type
-   207: 00000000    48 FUNC    GLOBAL DEFAULT  UND g_log
-   208: 000090b0   228 FUNC    GLOBAL DEFAULT   10 gst_tuner_find_channel_by_name
-   209: 00000000    52 FUNC    GLOBAL DEFAULT  UND strcmp@GLIBC_2.4 (3)
-   210: 00000000    20 FUNC    GLOBAL DEFAULT  UND g_str_equal
-   211: 00009d24   168 FUNC    GLOBAL DEFAULT   10 gst_x_overlay_set_xwindow_id
-   212: 00000000   332 FUNC    WEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.4 (3)
-   213: 00009dcc   148 FUNC    GLOBAL DEFAULT   10 gst_interfaces_marshal_VOID__OBJECT_INT
-   214: 0000498c   376 FUNC    GLOBAL DEFAULT   10 gst_mixer_mixer_changed
-   215: 00000000   116 FUNC    GLOBAL DEFAULT  UND gst_structure_set
-   216: 00003f08    80 FUNC    GLOBAL DEFAULT   10 gst_color_balance_channel_get_type
-   217: 00006978   128 FUNC    GLOBAL DEFAULT   10 gst_navigation_message_new_mouse_over
-
-Histogram for bucket list length (total of 197 buckets):
- Length  Number     % of total  Coverage
-      0  71         ( 36.0%)
-      1  69         ( 35.0%)     31.9%
-      2  37         ( 18.8%)     66.2%
-      3  12         (  6.1%)     82.9%
-      4  4          (  2.0%)     90.3%
-      5  3          (  1.5%)     97.2%
-      6  1          (  0.5%)    100.0%
-
-Version symbols section '.gnu.version' contains 218 entries:
- Addr: 0000000000002be6  Offset: 0x002be6  Link: 2 (.dynsym)
-  000:   0 (*local*)       0 (*local*)       0 (*local*)       0 (*local*)    
-  004:   1 (*global*)      1 (*global*)      0 (*local*)       1 (*global*)   
-  008:   0 (*local*)       1 (*global*)      0 (*local*)       1 (*global*)   
-  00c:   0 (*local*)       1 (*global*)      1 (*global*)      1 (*global*)   
-  010:   1 (*global*)      1 (*global*)      0 (*local*)       0 (*local*)    
-  014:   0 (*local*)       1 (*global*)      1 (*global*)      0 (*local*)    
-  018:   0 (*local*)       1 (*global*)      0 (*local*)       1 (*global*)   
-  01c:   0 (*local*)       0 (*local*)       0 (*local*)       1 (*global*)   
-  020:   1 (*global*)      1 (*global*)      2 (GLIBC_2.4)     1 (*global*)   
-  024:   0 (*local*)       1 (*global*)      1 (*global*)      0 (*local*)    
-  028:   0 (*local*)       0 (*local*)       1 (*global*)      0 (*local*)    
-  02c:   1 (*global*)      0 (*local*)       1 (*global*)      1 (*global*)   
-  030:   1 (*global*)      1 (*global*)      0 (*local*)       0 (*local*)    
-  034:   1 (*global*)      0 (*local*)       0 (*local*)       0 (*local*)    
-  038:   0 (*local*)       0 (*local*)       0 (*local*)       1 (*global*)   
-  03c:   1 (*global*)      1 (*global*)      1 (*global*)      0 (*local*)    
-  040:   0 (*local*)       0 (*local*)       0 (*local*)       1 (*global*)   
-  044:   0 (*local*)       1 (*global*)      1 (*global*)      1 (*global*)   
-  048:   1 (*global*)      0 (*local*)       1 (*global*)      1 (*global*)   
-  04c:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
-  050:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
-  054:   1 (*global*)      1 (*global*)      0 (*local*)       0 (*local*)    
-  058:   1 (*global*)      0 (*local*)       1 (*global*)      1 (*global*)   
-  05c:   1 (*global*)      1 (*global*)      1 (*global*)      0 (*local*)    
-  060:   2 (GLIBC_2.4)     0 (*local*)       1 (*global*)      1 (*global*)   
-  064:   1 (*global*)      1 (*global*)      1 (*global*)      0 (*local*)    
-  068:   1 (*global*)      0 (*local*)       0 (*local*)       0 (*local*)    
-  06c:   0 (*local*)       1 (*global*)      1 (*global*)      1 (*global*)   
-  070:   0 (*local*)       0 (*local*)       0 (*local*)       1 (*global*)   
-  074:   1 (*global*)      1 (*global*)      0 (*local*)       1 (*global*)   
-  078:   1 (*global*)      1 (*global*)      0 (*local*)       1 (*global*)   
-  07c:   1 (*global*)      0 (*local*)       1 (*global*)      0 (*local*)    
-  080:   0 (*local*)       1 (*global*)      1 (*global*)      0 (*local*)    
-  084:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
-  088:   0 (*local*)       0 (*local*)       1 (*global*)      0 (*local*)    
-  08c:   1 (*global*)      0 (*local*)       0 (*local*)       1 (*global*)   
-  090:   0 (*local*)       0 (*local*)       1 (*global*)      1 (*global*)   
-  094:   0 (*local*)       0 (*local*)       0 (*local*)       2 (GLIBC_2.4)  
-  098:   1 (*global*)      1 (*global*)      1 (*global*)      0 (*local*)    
-  09c:   0 (*local*)       0 (*local*)       0 (*local*)       1 (*global*)   
-  0a0:   1 (*global*)      0 (*local*)       0 (*local*)       1 (*global*)   
-  0a4:   1 (*global*)      0 (*local*)       1 (*global*)      1 (*global*)   
-  0a8:   1 (*global*)      0 (*local*)       0 (*local*)       1 (*global*)   
-  0ac:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
-  0b0:   0 (*local*)       1 (*global*)      1 (*global*)      1 (*global*)   
-  0b4:   0 (*local*)       0 (*local*)       1 (*global*)      1 (*global*)   
-  0b8:   0 (*local*)       0 (*local*)       1 (*global*)      1 (*global*)   
-  0bc:   1 (*global*)      1 (*global*)      0 (*local*)       1 (*global*)   
-  0c0:   0 (*local*)       1 (*global*)      0 (*local*)       1 (*global*)   
-  0c4:   0 (*local*)       1 (*global*)      0 (*local*)       1 (*global*)   
-  0c8:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
-  0cc:   0 (*local*)       0 (*local*)       1 (*global*)      0 (*local*)    
-  0d0:   1 (*global*)      3 (GLIBC_2.4)     0 (*local*)       1 (*global*)   
-  0d4:   3 (GLIBC_2.4)     1 (*global*)      1 (*global*)      0 (*local*)    
-  0d8:   1 (*global*)      1 (*global*)   
-
-Version needs section '.gnu.version_r' contains 2 entries:
- Addr: 0x0000000000002d9c  Offset: 0x002d9c  Link to section: 3 (.dynstr)
-  000000: Version: 1  File: libc.so.6  Cnt: 1
-  0x0010:   Name: GLIBC_2.4  Flags: none  Version: 3
-  0x0020: Version: 1  File: libm.so.6  Cnt: 1
-  0x0030:   Name: GLIBC_2.4  Flags: none  Version: 2
-Attribute Section: aeabi
-File Attributes
-  Tag_CPU_name: "ARM10TDMI"
-  Tag_CPU_arch: v5TE
-  Tag_ARM_ISA_use: Yes
-  Tag_THUMB_ISA_use: Thumb-1
-  Tag_ABI_PCS_wchar_t: 4
-  Tag_ABI_FP_denormal: Needed
-  Tag_ABI_FP_exceptions: Needed
-  Tag_ABI_FP_number_model: IEEE 754
-  Tag_ABI_align8_needed: Yes
-  Tag_ABI_align8_preserved: Yes, except leaf SP
-  Tag_ABI_enum_size: int
-  Tag_ABI_optimization_goals: Aggressive Speed
index c6859b0..16e3145 100644 (file)
@@ -6,7 +6,6 @@ mm_camcorder_testsuite_CFLAGS = -I$(srcdir)/../src/include \
                             $(GLIB_CFLAGS)\
                             $(GST_CFLAGS)\
                             $(MM_COMMON_CFLAGS)\
-                            $(MMTA_CFLAGS)\
                             $(MM_SOUND_CFLAGS)
 
 
@@ -14,12 +13,11 @@ mm_camcorder_testsuite_CFLAGS = -I$(srcdir)/../src/include \
 #mm_camcorder_testsuite_CFLAGS += -DAPPSRC_TEST
 ############################################
 
-mm_camcorder_testsuite_DEPENDENCIES = $(top_builddir)/src/libmmfcamcorder.la 
-                                               
+mm_camcorder_testsuite_DEPENDENCIES = $(top_builddir)/src/libmmfcamcorder.la
+
 mm_camcorder_testsuite_LDADD = $(top_builddir)/src/libmmfcamcorder.la \
                             $(GLIB_LIBS)\
                             $(GST_LIBS)\
                             $(MM_COMMON_LIBS)\
-                            $(MMTA_LIBS)\
                             $(MM_SOUND_LIBS)
 
index 3a873bd..1bfdca9 100644 (file)
@@ -29,6 +29,7 @@ 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
 */
 
 
@@ -44,7 +45,6 @@ when          who                                             what, where, why
 #include "../src/include/mm_camcorder_internal.h"
 #include "../src/include/mm_camcorder_util.h"
 #include <gst/video/colorbalance.h>
-#include <mm_ta.h>
 
 /*-----------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS:                                       |
@@ -102,41 +102,41 @@ 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    100   // mili seconds
@@ -149,14 +149,14 @@ static GTimer *timer = NULL;
 #define EXT_AMR                         "amr"
 #define EXT_MKV                         "mkv"
 
-#define STILL_CAPTURE_FILE_PATH_NAME    "/opt/media/StillshotCapture"
-#define MULTI_CAPTURE_FILE_PATH_NAME    "/opt/media/MultishotCapture"
-#define IMAGE_CAPTURE_THUMBNAIL_PATH    "/opt/media/thumbnail.jpg"
-#define IMAGE_CAPTURE_SCREENNAIL_PATH   "/opt/media/screennail.yuv"
-#define IMAGE_CAPTURE_EXIF_PATH         "/opt/media/exif.raw"
-#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.3gp"
+#define TARGET_FILENAME_AUDIO           TARGET_FILENAME_PATH"test_rec_audio.amr"
 #define CAPTURE_FILENAME_LEN            256
 
 #define AUDIO_SOURCE_SAMPLERATE_AAC     44100
@@ -197,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); \
@@ -227,7 +227,7 @@ GTimeVal result;
  * Enumerations for command
  */
 #define SENSOR_WHITEBALANCE_NUM                10
-#define SENSOR_COLOR_TONE_NUM          37
+#define SENSOR_COLOR_TONE_NUM          30
 #define SENSOR_FLIP_NUM                        3
 #define SENSOR_PROGRAM_MODE_NUM                15
 #define SENSOR_FOCUS_NUM               6
@@ -241,11 +241,11 @@ GTimeVal result;
 /*-----------------------------------------------------------------------
 |    LOCAL CONSTANT DEFINITIONS:                                        |
 -----------------------------------------------------------------------*/
-enum 
+enum
 {
        MODE_VIDEO_CAPTURE,     /* recording and image capture mode */
-       MODE_AUDIO,             /* audio recording*/ 
-       MODE_NUM,               
+       MODE_AUDIO,             /* audio recording*/
+       MODE_NUM,
 };
 
 enum
@@ -265,8 +265,8 @@ typedef struct _cam_handle
        bool isMultishot;               /* flag for multishot mode */
        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  */
+       const char *stillshot_filename;       /* stored filename of  stillshot  */
+       const char *multishot_filename;       /* stored filename of  multishot  */
        int menu_state;
        int fps;
        bool isMute;
@@ -275,8 +275,8 @@ typedef struct _cam_handle
 
 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;
@@ -286,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",
@@ -299,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",
@@ -332,13 +332,13 @@ char *ct[SENSOR_COLOR_TONE_NUM] = {
        "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",
@@ -356,7 +356,7 @@ char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
        "BACKLIGHT",
 };
 
-char *focus_mode[SENSOR_FOCUS_NUM] = {
+const char *focus_mode[SENSOR_FOCUS_NUM] = {
        "None",
        "Pan",
        "Auto",
@@ -365,21 +365,21 @@ char *focus_mode[SENSOR_FOCUS_NUM] = {
        "Continuous Auto",
 };
 
-char *camera_rotation[SENSOR_INPUT_ROTATION] = {
+const char *camera_rotation[SENSOR_INPUT_ROTATION] = {
        "None",
        "90",
        "180",
        "270",
 };
 
-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",
@@ -390,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",
@@ -414,18 +414,18 @@ char *image_fmt[SENSOR_IMAGE_FORMAT] = {
        "YV12",
 };
 
-char *face_zoom_mode[] = {
+const char *face_zoom_mode[] = {
        "Face Zoom OFF",
        "Face Zoom ON",
 };
 
-char *display_mode[] = {
+const char *display_mode[] = {
        "Default",
        "Primary Video ON and Secondary Video Full Screen",
        "Primary Video OFF and Secondary Video Full Screen",
 };
 
-char *output_mode[] = {
+const char *output_mode[] = {
        "Letter Box mode",
        "Original Size mode",
        "Full Screen mode",
@@ -433,14 +433,14 @@ char *output_mode[] = {
        "ROI mode",
 };
 
-char *rotate_mode[] = {
+const char *rotate_mode[] = {
        "0",
        "90",
        "180",
        "270",
 };
 
-char* strobe_mode[] = {
+const char* strobe_mode[] = {
        "Strobe OFF",
        "Strobe ON",
        "Strobe Auto",
@@ -451,38 +451,38 @@ 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 *hdr_mode[] = {
+const char *hdr_mode[] = {
        "HDR OFF",
        "HDR ON",
        "HDR ON and Original",
 };
 
-char *ahs_mode[] = {
+const char *ahs_mode[] = {
        "Anti-handshake OFF",
        "Anti-handshake ON",
        "Anti-handshake AUTO",
        "Anti-handshake MOVIE",
 };
 
-char *vs_mode[] = {
+const char *vs_mode[] = {
        "Video-stabilization OFF",
        "Video-stabilization ON",
 };
 
-char *visible_mode[] = {
+const char *visible_mode[] = {
        "Display OFF",
-       "Display ON", 
+       "Display ON",
 };
 
 
@@ -496,7 +496,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()
@@ -509,7 +509,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);
@@ -569,6 +569,32 @@ static void _file_write(char *path, void *data, int size)
        }
 }
 
+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)
@@ -599,7 +625,7 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
                void *dst = NULL;
 
                nret = _mmcamcorder_encode_jpeg(main->data, main->width, main->height, main->format,
-                                               main->length, 90, &dst, &dst_size);
+                                               main->length, 90, &dst, &dst_size, 0);
                if (nret) {
                        _file_write(m_filename, dst, dst_size);
                } else {
@@ -618,7 +644,7 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
 
                /* thumbnail */
                if (thumb != NULL) {
-                       _file_write(IMAGE_CAPTURE_THUMBNAIL_PATH, thumb->data, thumb->length);
+                       _file_write2(IMAGE_CAPTURE_THUMBNAIL_PATH, thumb->data, thumb->length);
                }
 
                /* screennail */
@@ -626,7 +652,7 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
                                            "captured-screennail", &scrnl, &scrnl_size,
                                            NULL);
                if (scrnl != NULL) {
-                       _file_write(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
+                       _file_write2(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
                } else {
                        printf( "Screennail buffer is NULL.\n" );
                }
@@ -636,7 +662,7 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt
                                            "captured-exif-raw-data", &exif_data, &exif_size,
                                            NULL);
                if (exif_data) {
-                       _file_write(IMAGE_CAPTURE_EXIF_PATH, exif_data, exif_size);
+                       _file_write2(IMAGE_CAPTURE_EXIF_PATH, exif_data, exif_size);
                }
        }
 
@@ -653,16 +679,14 @@ static gboolean test_idle_capture_start()
        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;
@@ -697,18 +721,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;
@@ -725,7 +746,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;
@@ -763,7 +784,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;
@@ -866,6 +887,7 @@ static void print_menu()
                        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");
@@ -904,6 +926,7 @@ static void print_menu()
                        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;
@@ -1134,7 +1157,7 @@ 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;
@@ -1154,6 +1177,36 @@ static void setting_menu(gchar buf)
        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);
@@ -1164,13 +1217,14 @@ static void setting_menu(gchar buf)
                                        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);
-                                       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 >= 2) {
-                                               g_print("\t WIDE ratio   : %dx%d\n\n",
-                                                       width_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE], height_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE]);
-                                       } else {
-                                               g_print("\t There is ONLY NORMAL resolution\n\n");
+                                       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]);
                                        }
                                }
 
@@ -1189,16 +1243,16 @@ static void setting_menu(gchar buf)
                                        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",&index);
+                                       err = scanf("%d",&idx);
                                        if (err == EOF) {
                                                printf("\nscanf error : errno %d\n", errno);
                                        } else {
-                                               if( index > 0 && index <= width_count ) {
+                                               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[index-1];
-                                                       input_pair.y = height_array[index-1];
+                                                       input_pair.x = width_array[idx-1];
+                                                       input_pair.y = height_array[idx-1];
                                                        bret = camcordertest_set_attr_xypair(input_pair);
                                                }
                                        }
@@ -1214,8 +1268,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Digital zoom level (%d ~ %d)\n", min, max);
-                                       err = 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;
 
@@ -1228,8 +1282,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Optical zoom level (%d ~ %d)\n", min, max);
-                                       err = 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;
 
@@ -1239,9 +1293,9 @@ static void setting_menu(gchar buf)
                                g_print("\t2. AF Stop !\n\n");
 
                                flush_stdin();
-                               err = scanf("%d", &index);
+                               err = scanf("%d", &idx);
 
-                               switch (index) {
+                               switch (idx) {
                                case 0:
                                {
                                        g_print("*Focus mode !\n");
@@ -1255,8 +1309,8 @@ static void setting_menu(gchar buf)
                                                for (i = 0 ; i < count ; i++) {
                                                        g_print("\t %d. %s\n", array[i], focus_mode[array[i]]);
                                                }
-                                               err = scanf("%d",&index);
-                                               bret = camcordertest_set_attr_int("camera-focus-mode", index);
+                                               err = scanf("%d",&idx);
+                                               bret = camcordertest_set_attr_int("camera-focus-mode", idx);
                                        }
                                }
                                        break;
@@ -1267,7 +1321,7 @@ static void setting_menu(gchar buf)
                                        mm_camcorder_stop_focusing(hcamcorder->camcorder);
                                        break;
                                default:
-                                       g_print("Wrong Input[%d] !! \n", index);
+                                       g_print("Wrong Input[%d] !! \n", idx);
                                        break;
                                }
                                break;
@@ -1284,8 +1338,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]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       camcordertest_set_attr_int("camera-af-scan-range", index);
+                                       err = scanf("%d",&idx);
+                                       camcordertest_set_attr_int("camera-af-scan-range", idx);
                                }
                                break;
 
@@ -1301,8 +1355,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]]);
                                        }
-                                       err = 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;
 
@@ -1315,8 +1369,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Exposure value(%d ~ %d)\n", min, max);
-                                       err = 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;
 
@@ -1336,10 +1390,10 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %d \n", i+1, array[i]);
                                        }
-                                       err = 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;
@@ -1356,8 +1410,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], iso_name[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-iso", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-iso", idx);
                                }
                                break;
 
@@ -1372,9 +1426,9 @@ static void setting_menu(gchar buf)
                                        for (i = min ; i <= max ; i++) {
                                                g_print("\t %d. %s\n", i, camera_rotation[i]);
                                        }
-                                       err = scanf("%d",&index);
+                                       err = scanf("%d",&idx);
                                        CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
-                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index);
+                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, idx);
                                        CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
                                }
                                break;
@@ -1387,12 +1441,12 @@ static void setting_menu(gchar buf)
                                g_print(" 2. Flip VERTICAL\n");
                                g_print(" 3. Flip BOTH\n");
 
-                               err = scanf("%d", &index);
+                               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, index);
+                               camcordertest_set_attr_int(MMCAM_CAMERA_FLIP, idx);
 
                                CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
                                CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
@@ -1407,8 +1461,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Jpeg quality (%d ~ %d)\n", min, max);
-                                       err = 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;
 
@@ -1424,8 +1478,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]]);
                                        }
-                                       err = 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));
@@ -1446,12 +1500,12 @@ static void setting_menu(gchar buf)
                                g_print("\t 8. LEFT_BOTTOM\n");
 
                                flush_stdin();
-                               err = scanf("%d", &index);
+                               err = scanf("%d", &idx);
 
-                               if (index < 1 || index > 8) {
-                                       g_print("Wrong INPUT[%d]!! \n", index);
+                               if (idx < 1 || idx > 8) {
+                                       g_print("Wrong INPUT[%d]!! \n", idx);
                                } else {
-                                       camcordertest_set_attr_int(MMCAM_TAG_ORIENTATION, index);
+                                       camcordertest_set_attr_int(MMCAM_TAG_ORIENTATION, idx);
                                }
 
                                break;
@@ -1486,8 +1540,8 @@ static void setting_menu(gchar buf)
                                        for (i = 0 ; i < count ; i++) {
                                                g_print("\t %d. %s\n", array[i], display_mode[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, idx);
                                }
                                break;
 
@@ -1503,8 +1557,8 @@ static void setting_menu(gchar buf)
                                        for( i = min ; i <= max ; i++ ) {
                                                g_print( "%d. %s\n", i, output_mode[i] );
                                        }
-                                       err = 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;
 
@@ -1517,8 +1571,8 @@ static void setting_menu(gchar buf)
                                        flush_stdin();
                                        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",&index);
-                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, idx);
                                }
                                break;
 
@@ -1526,8 +1580,8 @@ static void setting_menu(gchar buf)
                                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",&index);
-                               camcordertest_set_attr_int(MMCAM_DISPLAY_FLIP, index);
+                               err = scanf("%d",&idx);
+                               camcordertest_set_attr_int(MMCAM_DISPLAY_FLIP, idx);
                                break;
 
                        case 'g' : // Setting > Brightness
@@ -1539,8 +1593,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  brightness (%d ~ %d)\n", min, max);
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-brightness", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-brightness", idx);
                                }
                                break;
 
@@ -1553,8 +1607,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Contrast (%d ~ %d)\n", min, max);
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-contrast", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-contrast", idx);
                                }
                                break;
 
@@ -1567,8 +1621,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Saturation (%d ~ %d)\n", min, max);
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-saturation", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-saturation", idx);
                                }
                                break;
 
@@ -1581,8 +1635,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Hue (%d ~ %d)\n", min, max);
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-hue", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-hue", idx);
                                }
                                break;
 
@@ -1595,8 +1649,8 @@ static void setting_menu(gchar buf)
                                } else {
                                        flush_stdin();
                                        g_print("\n Select  Sharpness (%d ~ %d)\n", min, max);
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-sharpness", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-sharpness", idx);
                                }
                                break;
 
@@ -1612,8 +1666,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], wb[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("filter-wb", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("filter-wb", idx);
                                }
                                break;
 
@@ -1629,8 +1683,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], ct[array[i]]);
                                        }
-                                       err = 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;
 
@@ -1647,8 +1701,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]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("camera-wdr", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("camera-wdr", idx);
                                }
                                break;
 
@@ -1664,8 +1718,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], program_mode[array[i]]);
                                        }
-                                       err = 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;
 
@@ -1681,8 +1735,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], strobe_mode[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int("strobe-mode", index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int("strobe-mode", idx);
                                }
                                break;
 
@@ -1690,9 +1744,9 @@ static void setting_menu(gchar buf)
                                g_print("*Select Capture mode!\n");
                                flush_stdin();
                                g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n");
-                               err = scanf("%d",&index);
+                               err = scanf("%d",&idx);
 
-                               switch (index) {
+                               switch (idx) {
                                case 1:
                                        g_print("stillshot mode selected and capture callback is set!!!!\n");
                                        hcamcorder->isMultishot = FALSE;
@@ -1703,7 +1757,7 @@ static void setting_menu(gchar buf)
 
                                        camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0);
 
-                                       index = 0;
+                                       idx = 0;
                                        min = 0;
                                        max = 0;
 
@@ -1714,9 +1768,9 @@ 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);
-                                               err = 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);
@@ -1739,8 +1793,8 @@ static void setting_menu(gchar buf)
                                                for ( i = 0; i < count; i++) {
                                                        g_print("\t %d. %s\n", array[i], hdr_mode[array[i]]);
                                                }
-                                               err = scanf("%d",&index);
-                                               bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, index);
+                                               err = scanf("%d",&idx);
+                                               bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, idx);
                                        }
                                        break;
                                default:
@@ -1762,10 +1816,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]]);
                                        }
-                                       err = 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;
@@ -1785,8 +1839,8 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], ahs_mode[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
-                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ANTI_HANDSHAKE, index);
+                                       err = scanf("%d",&idx);
+                                       bret = camcordertest_set_attr_int(MMCAM_CAMERA_ANTI_HANDSHAKE, idx);
                                }
                                break;
 
@@ -1802,9 +1856,9 @@ static void setting_menu(gchar buf)
                                        for ( i = 0; i < count; i++) {
                                                g_print("\t %d. %s\n", array[i], vs_mode[array[i]]);
                                        }
-                                       err = scanf("%d",&index);
+                                       err = scanf("%d",&idx);
 
-                                       if (index == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
+                                       if (idx == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
                                                g_print("\n Restart preview with NV12 and 720p resolution\n");
 
                                                err = mm_camcorder_stop(hcamcorder->camcorder);
@@ -1818,7 +1872,7 @@ static void setting_menu(gchar buf)
                                                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, index);
+                                               camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
 
                                                if (err == MM_ERROR_NONE) {
                                                        err = mm_camcorder_realize(hcamcorder->camcorder);
@@ -1831,7 +1885,7 @@ static void setting_menu(gchar buf)
                                                        g_print("\n Restart FAILED! %x\n", err);
                                                }
                                        } else {
-                                               camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, index);
+                                               camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
                                        }
                                }
                                break;
@@ -1883,8 +1937,8 @@ static void setting_menu(gchar buf)
                                g_print("\t 1. Set Video Stream Callback \n");
                                g_print("\t 2. Unset Video Stream Callback \n");
                                flush_stdin();
-                               err = 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 ) {
@@ -1892,7 +1946,7 @@ static void setting_menu(gchar buf)
                                        } else {
                                                g_print("\n Setting Failure\n");
                                        }
-                               } else if(index == 2) {
+                               } else if(idx == 2) {
                                        mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, NULL, (void*)hcamcorder->camcorder);
                                        video_stream_cb_cnt = 0;
                                        audio_stream_cb_cnt = 0;
@@ -1902,6 +1956,28 @@ static void setting_menu(gchar buf)
                                }
                                break;
 
+                       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;
@@ -1914,6 +1990,13 @@ static void setting_menu(gchar buf)
                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);
 }
 
 
@@ -1928,28 +2011,43 @@ static void setting_menu(gchar buf)
  */
 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;
 }
 
@@ -1994,6 +2092,8 @@ 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;
@@ -2012,8 +2112,13 @@ static gboolean init(int type)
        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_VIDEO_CAPTURE,
@@ -2025,17 +2130,9 @@ 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_FLIP, MM_FLIP_HORIZONTAL,
                                                   MMCAM_DISPLAY_GEOMETRY_METHOD, MM_DISPLAY_METHOD_LETTER_BOX,
                                                   MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
-                                                  "capture-thumbnail", 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,
@@ -2053,9 +2150,7 @@ static gboolean init(int type)
                                                   //MMCAM_AUDIO_DISABLE, TRUE,
                                                   MMCAM_TARGET_FILENAME, TARGET_FILENAME_VIDEO, strlen(TARGET_FILENAME_VIDEO),
                                                   //MMCAM_TARGET_TIME_LIMIT, 360000,
-#ifndef _TIZEN_PUBLIC_
                                                   //MMCAM_TARGET_MAX_SIZE, 102400,
-#endif /* _TIZEN_PUBLIC_ */
                                                   NULL );
 
                if (err != MM_ERROR_NONE) {
@@ -2077,19 +2172,17 @@ 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_AAC,
                                                   MMCAM_TARGET_FILENAME, TARGET_FILENAME_AUDIO, size,
                                                   MMCAM_TARGET_TIME_LIMIT, 360000,
                                                   MMCAM_AUDIO_ENCODER_BITRATE, 12200,
-#ifndef _TIZEN_PUBLIC_
                                                   MMCAM_TARGET_MAX_SIZE, 300,
-#endif /* _TIZEN_PUBLIC_ */
                                                   NULL);
-       
+
                if (err < 0) {
                        warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
                        SAFE_FREE (err_attr_name);
@@ -2104,7 +2197,7 @@ static gboolean init(int type)
        debug_msg_t("Init DONE.");
 
        return TRUE;
-       
+
 ERROR:
        err_msg_t("init failed.");
        return FALSE;
@@ -2113,7 +2206,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
@@ -2124,7 +2217,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);
@@ -2138,7 +2231,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 :
@@ -2158,6 +2251,9 @@ 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;
 
@@ -2222,15 +2318,15 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                                             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;
@@ -2240,13 +2336,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;
@@ -2260,7 +2356,6 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                        break;
                case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO:
                {
-                       static int info_count = 0;
                        MMCamFaceDetectInfo *cam_fd_info = NULL;
 
                        cam_fd_info = (MMCamFaceDetectInfo *)(param->data);
@@ -2279,23 +2374,6 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param)
                                                cam_fd_info->face_info[i].rect.width,
                                                cam_fd_info->face_info[i].rect.height);
                                }
-
-                               if (info_count == 0) {
-                                       mm_camcorder_set_attributes(hcamcorder->camcorder, NULL,
-                                                                   MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_ON,
-                                                                   MMCAM_CAMERA_FACE_ZOOM_X, cam_fd_info->face_info[0].rect.x + (cam_fd_info->face_info[0].rect.width>>1),
-                                                                   MMCAM_CAMERA_FACE_ZOOM_Y, cam_fd_info->face_info[0].rect.y + (cam_fd_info->face_info[0].rect.height>>1),
-                                                                   MMCAM_CAMERA_FACE_ZOOM_LEVEL, 0,
-                                                                   NULL);
-                                       info_count = 1;
-                                       g_print("\n\t##### START FACE ZOOM [%d,%d] #####\n", cam_fd_info->face_info[0].rect.x, cam_fd_info->face_info[0].rect.y);
-                               } else if (info_count++ == 90) {
-                                       mm_camcorder_set_attributes(hcamcorder->camcorder, NULL,
-                                                                   MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_OFF,
-                                                                   NULL);
-                                       g_print("\n\t##### STOP FACE ZOOM #####\n");
-                                       info_count = -60;
-                               }
                        }
                }
                        break;
@@ -2313,8 +2391,8 @@ static gboolean init_handle()
        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_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->elapsed_time = 0;
@@ -2354,7 +2432,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;
@@ -2365,7 +2443,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;
@@ -2378,24 +2456,24 @@ 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) {
@@ -2408,10 +2486,10 @@ static gboolean mode_change()
                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");
 
                err = scanf("%c", &media_type);
-               
+
                switch (media_type) {
                case '1':
                        hcamcorder->mode= MODE_VIDEO_CAPTURE;
@@ -2495,7 +2573,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);
 
@@ -2506,7 +2584,7 @@ static gboolean mode_change()
 /**
  * This function is the example main function for mmcamcorder API.
  *
- * @param      
+ * @param
  *
  * @return     This function returns 0.
  * @remark
@@ -2516,9 +2594,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);