Support new extra preview mode
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_internal.h
index d944dac..cbca186 100644 (file)
 
 #include <mm_types.h>
 #include <mm_attrs.h>
-#include <mm_attrs_private.h>
 #include <mm_message.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
-#include <mm_sound_focus.h>
 #include <vconf.h>
 #include <gst/video/video-format.h>
 #include <ttrace.h>
 #include <errno.h>
 #include <restriction.h> /* device policy manager */
+#include <dlog.h>
 
 #include "mm_camcorder.h"
-#include "mm_debug.h"
 
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
-#include "mm_camcorder_resource.h"
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+#ifdef _MMCAMCORDER_MM_RM_SUPPORT
+#include <mm_resource_manager.h>
+#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
 
 /* camcorder sub module */
 #include "mm_camcorder_attribute.h"
 #include <rm_api.h>
 #endif /* _MMCAMCORDER_RM_SUPPORT */
 
+#ifdef _MMCAMCORDER_CAMERA_CONF_MGR_SUPPORT
+#include "camera_conf_mgr.h"
+#endif /*_MMCAMCORDER_CAMERA_CONF_MGR_SUPPORT */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "MM_CAMCORDER"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -74,18 +79,12 @@ extern "C" {
 /*=======================================================================================
 | MACRO DEFINITIONS                                                                    |
 ========================================================================================*/
-#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
  */
 #define mmf_return_if_fail(expr) \
        if (!(expr)) { \
-               _mmcam_dbg_err("failed [%s]", #expr); \
+               MMCAM_LOG_ERROR("failed [%s]", #expr); \
                return; \
        }
 
@@ -94,7 +93,7 @@ extern "C" {
  */
 #define mmf_return_val_if_fail(expr, val) \
        if (!(expr)) { \
-               _mmcam_dbg_err("failed [%s]", #expr); \
+               MMCAM_LOG_ERROR("failed [%s]", #expr); \
                return (val); \
        }
 
@@ -108,119 +107,133 @@ extern "C" {
 
 /* gstreamer element creation macro */
 #define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(element[eid].gst); \
        } \
        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); \
+               MMCAM_LOG_ERROR("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(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
-       }
+       } \
+} while (0)
 
 #define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(element[eid].gst); \
        } \
        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); \
+               MMCAM_LOG_ERROR("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(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
-       }
+       } \
+} while (0)
 
 #define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(element[eid].gst); \
        } \
        traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:ELEMENT_MAKE:%s", name); \
        element[eid].gst = gst_element_factory_make(name, nickname); \
        traceEnd(TTRACE_TAG_CAMERA); \
        if (element[eid].gst == NULL) { \
-               _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("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); \
+               MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \
                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, &(element[eid]));
+       elist = g_list_append(elist, &(element[eid])); \
+} while (0)
 
 #define _MMCAMCORDER_ELEMENT_MAKE2(sub_context, element, eid, name /*char* */, nickname /*char* */, err) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(element[eid].gst); \
        } \
        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); \
+               MMCAM_LOG_ERROR("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
        } else { \
-               _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \
                element[eid].id = eid; \
                g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
                err = MM_ERROR_NONE; \
        } \
+} while (0)
 
 #define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(element[eid].gst); \
        } \
        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); \
+               MMCAM_LOG_ERROR("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); \
+               MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \
                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])); \
-       }
+       } \
+} while (0)
 
 #define _MMCAMCORDER_ELEMENT_ADD(sub_context, element, eid, gst_element, elist, err) \
+do { \
        if (element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element is existed. element_id=[%d]", eid); \
+               MMCAM_LOG_ERROR("The element is existed. element_id=[%d]", eid); \
                gst_object_unref(element[eid].gst); \
        } \
        element[eid].gst = gst_element; \
        if (element[eid].gst == NULL) { \
-               _mmcam_dbg_err("Element is NULL. element_id=[%d]", eid); \
+               MMCAM_LOG_ERROR("Element is NULL. element_id=[%d]", eid); \
                err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
                goto pipeline_creation_error; \
        } else { \
-               _mmcam_dbg_log("Adding Element is done. element_id=[%d] %p", eid, gst_element); \
+               MMCAM_LOG_INFO("Adding Element is done. element_id=[%d] %p", eid, gst_element); \
                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, &(element[eid]));
+       elist = g_list_append(elist, &(element[eid])); \
+} while (0)
 
 #define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
+do { \
        if (sub_context->encode_element[eid].gst != NULL) { \
-               _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
+               MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \
                gst_object_unref(sub_context->encode_element[eid].gst); \
        } \
        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); \
+               MMCAM_LOG_ERROR("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->encode_element[eid].gst); \
                g_object_weak_ref(G_OBJECT(sub_context->encode_element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
-       }
+       } \
+} while (0)
 
 /* GStreamer element remove macro */
 #define _MMCAMCORDER_ELEMENT_REMOVE(element, eid) \
@@ -235,17 +248,17 @@ extern "C" {
 #define _MM_GST_PAD_LINK                gst_pad_link
 
 #define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto) \
-{ \
+do { \
        GstPadLinkReturn ret = GST_PAD_LINK_OK; \
        if (srcpad == NULL || sinkpad == NULL) { \
                if (srcpad == NULL) { \
-                       _mmcam_dbg_err("srcpad is NULL"); \
+                       MMCAM_LOG_ERROR("srcpad is NULL"); \
                } else { \
                        gst_object_unref(srcpad);\
                        srcpad = NULL; \
                } \
                if (sinkpad == NULL) { \
-                       _mmcam_dbg_err("sinkpad is NULL"); \
+                       MMCAM_LOG_ERROR("sinkpad is NULL"); \
                } else { \
                        gst_object_unref(sinkpad); \
                        sinkpad = NULL;\
@@ -261,7 +274,7 @@ extern "C" {
                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); \
+               MMCAM_LOG_ERROR("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) { \
@@ -277,23 +290,25 @@ extern "C" {
        } \
        gst_object_unref(srcpad); srcpad = NULL; \
        gst_object_unref(sinkpad); sinkpad = NULL; \
-}
+} while (0)
 
 #define _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad) \
+do { \
        if (srcpad && sinkpad) { \
                gst_pad_unlink(srcpad, sinkpad); \
        } else { \
-               _mmcam_dbg_warn("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \
+               MMCAM_LOG_WARNING("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \
        } \
        if (srcpad) { \
                gst_object_unref(srcpad); srcpad = NULL; \
        } \
        if (sinkpad) { \
                gst_object_unref(sinkpad); sinkpad = NULL; \
-       }
+       } \
+} while (0)
 
 #define        _MMCAMCORDER_STATE_SET_COUNT            3               /* checking interval */
-#define        _MMCAMCORDER_STATE_CHECK_TOTALTIME      5000000L        /* total wating time for state change */
+#define        _MMCAMCORDER_STATE_CHECK_TOTALTIME      5000000L        /* total waiting time for state change */
 #define        _MMCAMCORDER_STATE_CHECK_INTERVAL       (50*1000)       /* checking interval - 50ms*/
 
 /**
@@ -374,11 +389,11 @@ extern "C" {
 #define _MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle), end_time)
 #define _MMCAMCORDER_CMD_SIGNAL(handle)               g_cond_signal(&_MMCAMCORDER_GET_CMD_COND(handle));
 
-/* for ASM */
-#define _MMCAMCORDER_GET_ASM_LOCK(handle)           (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
-#define _MMCAMCORDER_LOCK_ASM(handle)               _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_ASM(handle)            _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_ASM(handle)             _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
+/* for interruption */
+#define _MMCAMCORDER_GET_INTERRUPT_LOCK(handle)           (_MMCAMCORDER_CAST_MTSAFE(handle).interrupt_lock)
+#define _MMCAMCORDER_LOCK_INTERRUPT(handle)               _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_INTERRUPT(handle)            _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_INTERRUPT(handle)             _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle))
 
 /* for state change */
 #define _MMCAMCORDER_GET_STATE_LOCK(handle)         (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
@@ -423,17 +438,17 @@ extern "C" {
 #define _MMCAMCORDER_TRYLOCK_MSTREAM_CALLBACK(handle)       _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle))
 #define _MMCAMCORDER_UNLOCK_MSTREAM_CALLBACK(handle)        _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle))
 
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+#define _MMCAMCORDER_GET_VEDECISION_CALLBACK_LOCK(handle)   (_MMCAMCORDER_CAST_MTSAFE(handle).vedecision_cb_lock)
+#define _MMCAMCORDER_LOCK_VEDECISION_CALLBACK(handle)       _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_VEDECISION_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VEDECISION_CALLBACK(handle)    _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_VEDECISION_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VEDECISION_CALLBACK(handle)     _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_VEDECISION_CALLBACK_LOCK(handle))
+
+#ifdef _MMCAMCORDER_MM_RM_SUPPORT
 /* for resource conflict */
 #define _MMCAMCORDER_GET_RESOURCE_LOCK(handle)              (_MMCAMCORDER_CAST_MTSAFE(handle).resource_lock)
-#define _MMCAMCORDER_GET_RESOURCE_COND(handle)              (_MMCAMCORDER_CAST_MTSAFE(handle).resource_cond)
 #define _MMCAMCORDER_LOCK_RESOURCE(handle)                  _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_RESOURCE(handle)               _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
 #define _MMCAMCORDER_UNLOCK_RESOURCE(handle)                _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
-#define _MMCAMCORDER_RESOURCE_WAIT(handle)                  g_cond_wait(&_MMCAMCORDER_GET_RESOURCE_COND(handle), &_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
-#define _MMCAMCORDER_RESOURCE_WAIT_UNTIL(handle, end_time)  g_cond_wait_until(&_MMCAMCORDER_GET_RESOURCE_COND(handle), &_MMCAMCORDER_GET_RESOURCE_LOCK(handle), end_time)
-#define _MMCAMCORDER_RESOURCE_SIGNAL(handle)                g_cond_signal(&_MMCAMCORDER_GET_RESOURCE_COND(handle));
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
 
 /**
  * Caster of main handle (camcorder)
@@ -460,7 +475,7 @@ extern "C" {
 #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_FLIP_NUM                  4       /**< Number of Flip 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 */
@@ -470,6 +485,7 @@ extern "C" {
 #define MM_CAMCORDER_STROBE_MODE_NUM           8       /**< Number of strobe mode type */
 #define MM_CAMCORDER_STROBE_CONTROL_NUM                3       /**< Number of strobe control type */
 #define MM_CAMCORDER_DETECT_MODE_NUM           2       /**< Number of detect mode type */
+#define MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM  10      /**< Number of extra preview stream */
 
 /*=======================================================================================
 | ENUM DEFINITIONS                                                                     |
@@ -523,12 +539,17 @@ typedef enum {
        /* Pipeline element of Video input */
        _MMCAMCORDER_VIDEOSRC_SRC,
        _MMCAMCORDER_VIDEOSRC_FILT,
-       _MMCAMCORDER_VIDEOSRC_CLS_QUE,
-       _MMCAMCORDER_VIDEOSRC_CLS,
-       _MMCAMCORDER_VIDEOSRC_CLS_FILT,
        _MMCAMCORDER_VIDEOSRC_QUE,
        _MMCAMCORDER_VIDEOSRC_DECODE,
 
+       /* Pipeline element of image capture */
+       _MMCAMCORDER_VIDEOSRC_CAP_FILT,
+       _MMCAMCORDER_VIDEOSRC_CAP_SINK,
+
+       /* Pipeline element of extra preview */
+       _MMCAMCORDER_VIDEOSRC_EXT_FILT,
+       _MMCAMCORDER_VIDEOSRC_EXT_SINK,
+
        /* Pipeline element of Video output */
        _MMCAMCORDER_VIDEOSINK_QUE,
        _MMCAMCORDER_VIDEOSINK_CLS,
@@ -554,6 +575,7 @@ typedef enum {
        _MMCAMCORDER_AUDIOSRC_QUE,
        _MMCAMCORDER_AUDIOSRC_CONV,
        _MMCAMCORDER_AUDIOSRC_VOL,
+       _MMCAMCORDER_AUDIOSRC_RGA,      /* for replay gain analysis element */
 
        /* Pipeline element of Encodebin */
        _MMCAMCORDER_ENCSINK_BIN,
@@ -565,6 +587,8 @@ typedef enum {
        _MMCAMCORDER_ENCSINK_AENC,
        _MMCAMCORDER_ENCSINK_AENC_QUE,
        _MMCAMCORDER_ENCSINK_VQUE,
+       _MMCAMCORDER_ENCSINK_VSCALE,
+       _MMCAMCORDER_ENCSINK_VSCALE_FILT,
        _MMCAMCORDER_ENCSINK_VCONV,
        _MMCAMCORDER_ENCSINK_VENC,
        _MMCAMCORDER_ENCSINK_VENC_QUE,
@@ -594,7 +618,6 @@ typedef enum {
  */
 typedef enum {
        _MMCAMCORDER_STATE_CHANGE_NORMAL = 0,
-       _MMCAMCORDER_STATE_CHANGE_BY_FOCUS,
        _MMCAMCORDER_STATE_CHANGE_BY_RM,
        _MMCAMCORDER_STATE_CHANGE_BY_DPM,
        _MMCAMCORDER_STATE_CHANGE_BY_STORAGE
@@ -608,7 +631,7 @@ typedef enum {
  * MMCamcorder Gstreamer Element
  */
 typedef struct {
-       unsigned int id;                /**< Gstreamer piplinem element name */
+       unsigned int id;                /**< Gstreamer pipeline element id */
        GstElement *gst;                /**< Gstreamer element */
 } _MMCamcorderGstElement;
 
@@ -632,7 +655,7 @@ typedef struct {
        GCond cond;                     /**< Condition (for general use) */
        GMutex cmd_lock;                /**< Mutex (for command) */
        GCond cmd_cond;                 /**< Condition (for command) */
-       GMutex asm_lock;                /**< Mutex (for ASM) */
+       GMutex interrupt_lock;          /**< Mutex (for interruption) */
        GMutex state_lock;              /**< Mutex (for state change) */
        GMutex gst_state_lock;          /**< Mutex (for gst pipeline state change) */
        GMutex gst_encode_state_lock;   /**< Mutex (for gst encode pipeline state change) */
@@ -641,13 +664,47 @@ typedef struct {
        GMutex vstream_cb_lock;         /**< Mutex (for video stream callback) */
        GMutex astream_cb_lock;         /**< Mutex (for audio stream callback) */
        GMutex mstream_cb_lock;         /**< Mutex (for muxed stream callback) */
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
-       GCond resource_cond;            /**< Condition (for resource check) */
+       GMutex vedecision_cb_lock;      /**< Mutex (for video encode decision callback) */
+#ifdef _MMCAMCORDER_MM_RM_SUPPORT
        GMutex resource_lock;           /**< Mutex (for resource check) */
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
 } _MMCamcorderMTSafe;
 
 /**
+ * MMCamcorder Replay gain value
+ */
+typedef struct {
+       gdouble track_peak;
+       gdouble track_gain;
+       gdouble album_peak;
+       gdouble album_gain;
+} _MMCamcorderReplayGain;
+
+/**
+ * MMCamcorder Extra preview format
+ */
+typedef struct {
+       int pixel_format;
+       int width;
+       int height;
+       int fps;
+       int bitrate;
+       int gop_interval;
+       gboolean need_to_set_format;
+       gboolean need_to_set_bitrate;
+       gboolean need_to_set_gop_interval;
+} _MMCamcorderExtraPreviewFormat;
+
+/**
+ * MMCamcorder Extra preview
+ */
+typedef struct {
+       gboolean is_supported;
+       MMCamcorderExtraPreviewMode mode;
+       _MMCamcorderExtraPreviewFormat format[MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM];
+} _MMCamcorderExtraPreview;
+
+/**
  * MMCamcorder Sub Context
  */
 typedef struct {
@@ -655,7 +712,7 @@ typedef struct {
        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 */
+       int frame_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.*/
        GstClockTime stillshot_time;            /**< pipeline time of capturing moment*/
@@ -665,7 +722,6 @@ typedef struct {
        GstClockTime previous_slot_time;
        int display_interval;                   /**< This value is set as 'GST_SECOND / display FPS' */
        gboolean bget_eos;                      /**< Whether getting EOS */
-       gboolean bencbin_capture;               /**< Use Encodebin for capturing */
        gboolean audio_disable;                 /**< whether audio is disabled or not when record */
        int videosrc_rotate;                    /**< rotate of videosrc */
        unsigned long long muxed_stream_offset; /**< current offset for muxed stream data */
@@ -674,6 +730,9 @@ typedef struct {
        int drop_vframe;                        /**< When this value is bigger than zero and pass_first_vframe is zero, MSL will drop video frame though cam_stability count is bigger then zero. */
        int pass_first_vframe;                  /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */
 
+       /* Replay gain */
+       _MMCamcorderReplayGain replay_gain;     /**< Replay gain for audio recording */
+
        /* INI information */
        unsigned int fourcc;                    /**< Get fourcc value of camera INI file */
        _MMCamcorderImageInfo *info_image;      /**< extra information for image capture */
@@ -686,7 +745,7 @@ typedef struct {
 
        type_element *VideosinkElement;         /**< configure data of videosink element */
        type_element *VideoconvertElement;      /**< configure data of videoconvert element */
-       type_element *VideodecoderElementH264;  /**< configure data of video decoder element for H.264 format */
+       type_element *VideodecoderElement;      /**< configure data of video decoder element */
        gboolean SensorEncodedCapture;          /**< whether camera sensor support encoded image capture */
        gboolean internal_encode;               /**< whether use internal encoding function */
 } _MMCamcorderSubContext;
@@ -714,11 +773,9 @@ typedef struct mmf_camcorder {
        camera_conf *conf_main;                /**< Camera configure Main structure */
        camera_conf *conf_ctrl;                /**< Camera configure Control structure */
 #ifdef _MMCAMCORDER_RM_SUPPORT
-       int rm_handle;                        /**< Resource manager handle */
+       int rm_handle;                         /**< Resource manager handle */
+       rm_consumer_info rci;                  /**< Resource consumer info */
 #endif /* _MMCAMCORDER_RM_SUPPORT */
-       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 */
 
        /* callback handlers */
@@ -732,6 +789,8 @@ typedef struct mmf_camcorder {
        void *mstream_cb_param;                                 /**< Muxed stream callback parameter */
        mm_camcorder_video_capture_callback vcapture_cb;        /**< Video capture callback */
        void *vcapture_cb_param;                                /**< Video capture callback parameter */
+       mm_camcorder_video_encode_decision_callback vedecision_cb; /**< Video encode decision callback */
+       void *vedecision_cb_param;                                 /**< Video encode decision callback parameter */
        int (*command)(MMHandleType, int);                      /**< camcorder's command */
 
        /* etc */
@@ -746,6 +805,8 @@ typedef struct mmf_camcorder {
        int use_zero_copy_format;                               /**< Whether use zero copy format for camera input */
        int use_videoconvert;                                   /**< Whether use videoconvert element for display */
        int support_media_packet_preview_cb;                    /**< Whether support zero copy format for camera input */
+       int support_user_buffer;                                /**< Whether support user allocated buffer for zero copy */
+       int capture_mode;                                       /**< Capture mode */
        int shutter_sound_policy;                               /**< shutter sound policy */
        int brightness_default;                                 /**< default value of brightness */
        int brightness_step_denominator;                        /**< denominator of brightness bias step */
@@ -755,15 +816,11 @@ typedef struct mmf_camcorder {
        int capture_sound_count;                                /**< count for capture sound */
        char *root_directory;                                   /**< Root directory for device */
        int resolution_changed;                                 /**< Flag for preview resolution change */
-       int sound_focus_register;                               /**< Use sound focus internally */
-       int sound_focus_id;                                     /**< id for sound focus */
-       int sound_focus_watch_id;                               /**< id for sound focus watch */
-       unsigned int sound_focus_subscribe_id;                  /**< subscribe id for sound focus signal */
        int interrupt_code;                                     /**< Interrupt code */
-       int acquired_focus;                                     /**< Current acquired focus */
-       int session_type;                                       /**< Session type */
-       int session_flags;                                      /**< Session flags */
        int recreate_decoder;                                   /**< Flag of decoder element recreation for encoded preview format */
+       gboolean is_network;                                    /**< Flag for network camera */
+       const char *network_hal_name;                           /**< Name of network camera HAL library */
+       int default_encoded_preview_bitrate;                    /**< Default bitrate for encoded preview */
 
        _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 */
@@ -779,16 +836,19 @@ typedef struct mmf_camcorder {
        GCond task_thread_cond;                                 /**< cond for task thread */
        _MMCamcorderTaskThreadState task_thread_state;          /**< state of task thread */
 
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+#ifdef _MMCAMCORDER_MM_RM_SUPPORT
        /* resource manager for H/W resources */
-       MMCamcorderResourceManager resource_manager;
-       MMCamcorderResourceManager resource_manager_sub;
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+       mm_resource_manager_h resource_manager;
+       mm_resource_manager_res_h camera_resource;
+       mm_resource_manager_res_h video_overlay_resource;
+       mm_resource_manager_res_h video_encoder_resource;
+       gboolean is_release_cb_calling;
+#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
 
        /* gdbus */
        GDBusConnection *gdbus_conn;                            /**< gdbus connection */
-       _MMCamcorderGDbusCbInfo gdbus_info_sound;               /**< Informations for the gbus cb of sound play */
-       _MMCamcorderGDbusCbInfo gdbus_info_solo_sound;          /**< Informations for the gbus cb of solo sound play */
+       _MMCamcorderGDbusCbInfo gdbus_info_sound;               /**< Information for the gdbus cb of sound play */
+       _MMCamcorderGDbusCbInfo gdbus_info_solo_sound;          /**< Information for the gdbus cb of solo sound play */
 
        /* DPM(device policy manager) */
        device_policy_manager_h dpm_handle;                     /**< DPM handle */
@@ -801,6 +861,17 @@ typedef struct mmf_camcorder {
        rm_category_request_s request_resources;
        rm_device_return_s returned_devices;
 #endif /* _MMCAMCORDER_RM_SUPPORT */
+#ifdef _MMCAMCORDER_CAMERA_CONF_MGR_SUPPORT
+       camera_conf_device_info_s conf_device_info;
+#endif /*_MMCAMCORDER_CAMERA_CONF_MGR_SUPPORT */
+
+       /* Profiling */
+       int measure_preview_fps;                                /**< Flag for measuring fps of preview frames */
+
+       _MMCamcorderExtraPreview extra_preview;                 /**< Extra preview */
+
+       GQuark buffer_quark;                                    /**< Quark for buffer */
+
        int reserved[4];                                        /**< reserved */
 } mmf_camcorder_t;
 
@@ -963,7 +1034,7 @@ int _mmcamcorder_commit(MMHandleType hcamcorder);
 int _mmcamcorder_cancel(MMHandleType hcamcorder);
 
 /**
- *     This function calls after commiting action finished asynchronously.
+ *     This function calls after committing action finished asynchronously.
  *     In this function, remaining process , such as state change, happens.
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
@@ -981,7 +1052,7 @@ int _mmcamcorder_commit_async_end(MMHandleType hcamcorder);
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
  *     @param[in]      callback        Specifies the function pointer of callback function
- *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
  *
  *     @return         This function returns zero on success, or negative value with error code.
  *     @remarks        typedef bool (*mm_message_callback) (int msg, mm_messageType *param, void *user_param);@n
@@ -1018,7 +1089,7 @@ int _mmcamcorder_set_message_callback(MMHandleType hcamcorder,
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
  *     @param[in]      callback        Specifies the function pointer of callback function
- *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
  *
  *     @return         This function returns zero on success, or negative value with error code.
  *     @see            mmcamcorder_error_type
@@ -1032,7 +1103,7 @@ int _mmcamcorder_set_video_stream_callback(MMHandleType hcamcorder,
  *
  *     @param[in]      hcamcorder      Specifies the camcorder handle
  *     @param[in]      callback        Specifies the function pointer of callback function
- *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
  *
  *     @return         This function returns zero on success, or negative value with error code.
  *     @see            mmcamcorder_error_type
@@ -1046,7 +1117,7 @@ int _mmcamcorder_set_audio_stream_callback(MMHandleType handle,
  *
  *     @param[in]      hcamcorder      Specifies the camcorder handle
  *     @param[in]      callback        Specifies the function pointer of callback function
- *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
  *
  *     @return         This function returns zero on success, or negative value with error code.
  *     @see            mmcamcorder_error_type
@@ -1060,7 +1131,7 @@ int _mmcamcorder_set_muxed_stream_callback(MMHandleType handle,
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
  *     @param[in]      callback        Specifies the function pointer of callback function
- *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
  *
  *     @return         This function returns zero on success, or negative value with error code.
  *     @see            mmcamcorder_error_type
@@ -1070,6 +1141,19 @@ int _mmcamcorder_set_video_capture_callback(MMHandleType hcamcorder,
                                            void *user_data);
 
 /**
+ *     This function is to set callback for video encode decision.
+ *
+ *     @param[in]      hcamcorder      Specifies the camcorder  handle
+ *     @param[in]      callback        Specifies the function pointer of callback function
+ *     @param[in]      user_data       Specifies the user pointer for passing to callback function
+ *
+ *     @return         This function returns zero on success, or negative value with error code.
+ */
+int _mmcamcorder_set_video_encode_decision_callback(MMHandleType hcamcorder,
+                                           mm_camcorder_video_encode_decision_callback callback,
+                                           void *user_data);
+
+/**
  *     This function returns current state of camcorder, or negative value with error code.
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle.
@@ -1167,7 +1251,7 @@ int _mmcamcorder_set_functions(MMHandleType handle, int type);
 /**
  * This function is callback function of main pipeline.
  * Once this function is registered with certain pipeline using gst_bus_add_watch(),
- * this callback will be called every time when there is upcomming message from pipeline.
+ * this callback will be called every time when there is upcoming message from pipeline.
  * Basically, this function is used as error handling function, now.
  *
  * @param[in]  bus             pointer of buf that called this function.
@@ -1183,7 +1267,7 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi
 /**
  * This function is callback function of main pipeline.
  * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
- * this callback will be called every time when there is upcomming message from pipeline.
+ * this callback will be called every time when there is upcoming message from pipeline.
  * Basically, this function is used as sync error handling function, now.
  *
  * @param[in]  bus             pointer of buf that called this function.
@@ -1199,7 +1283,7 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage
 /**
  * This function is callback function of encode pipeline.
  * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
- * this callback will be called every time when there is upcomming message from pipeline.
+ * this callback will be called every time when there is upcoming message from pipeline.
  * Basically, this function is used for EOS and error handling now.
  *
  * @param[in]  bus             pointer of buf that called this function.
@@ -1263,14 +1347,8 @@ void _mmcamcorder_video_current_framerate_init(MMHandleType handle);
 int _mmcamcorder_video_current_framerate(MMHandleType handle);
 int _mmcamcorder_video_average_framerate(MMHandleType handle);
 
-/* sound focus related function */
+/* for stopping forcedly */
 void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_system);
-void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
-       mm_sound_focus_state_e focus_state, const char *reason_for_change,
-       int option, const char *additional_info, void *user_data);
-void _mmcamcorder_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state,
-       const char *reason_for_change, const char *additional_info, void *user_data);
-void _mmcamcorder_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data);
 
 /* device policy manager */
 void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *value, void *user_data);
@@ -1282,6 +1360,9 @@ void _mmcamcorder_emit_signal(MMHandleType handle, const char *object_name,
 /* external storage state management */
 int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_state);
 
+/* get focus level */
+int _mmcamcorder_get_focus_level(MMHandleType handle, int *level);
+
 #ifdef __cplusplus
 }
 #endif