Add code to get replay gain information after audio recording
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_attribute.c
index 41b288e..fb85d7b 100644 (file)
@@ -37,6 +37,7 @@
 #define MMCAMCORDER_DEFAULT_CAMERA_HEIGHT       480
 #define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_BITRATE (1024*1024*10)
 #define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL 1000
+#define MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL  89.0
 
 /*---------------------------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS for internal                                          |
@@ -216,7 +217,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "camera-device-name",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -261,7 +262,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "audio-volume",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)1},
+                       {.value_double = 1.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = 0.0},
                        {.double_max = 10.0},
@@ -383,7 +384,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "camera-recording-motion-rate",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)1},
+                       {.value_double = 1.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = 0.0},
                        {.double_max = _MMCAMCORDER_MAX_DOUBLE},
@@ -671,7 +672,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "display-handle",
                        MMF_VALUE_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -838,7 +839,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "target-filename",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -882,7 +883,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-image-description",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -904,7 +905,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-software",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -916,7 +917,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-latitude",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)0},
+                       {.value_double = 0.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = -360.0},
                        {.double_max = 360.0},
@@ -927,7 +928,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-longitude",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)0},
+                       {.value_double = 0.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = -360.0},
                        {.double_max = 360.0},
@@ -938,7 +939,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-altitude",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)0},
+                       {.value_double = 0.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = -999999.0},
                        {.double_max = 999999.0},
@@ -1093,7 +1094,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "camera-focal-length",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)0},
+                       {.value_double = 0.0},
                        MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
                        {.double_min = 0.0},
                        {.double_max = 1000.0},
@@ -1138,7 +1139,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-gps-time-stamp",
                        MMF_VALUE_TYPE_DOUBLE,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)0},
+                       {.value_double = 0.0},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1149,7 +1150,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-gps-date-stamp",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1160,7 +1161,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "tag-gps-processing-method",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1182,7 +1183,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "captured-screennail",
                        MMF_VALUE_TYPE_DATA,
                        MM_ATTRS_FLAG_READABLE,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1282,7 +1283,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "captured-exif-raw-data",
                        MMF_VALUE_TYPE_DATA,
                        MM_ATTRS_FLAG_READABLE,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1293,7 +1294,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "display-evas-surface-sink",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_READABLE,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1504,7 +1505,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "display-socket-path",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1526,7 +1527,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "root-directory",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1548,7 +1549,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "sound-stream-type",
                        MMF_VALUE_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1570,7 +1571,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "display-reuse-element",
                        MMF_VALUE_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
@@ -1581,11 +1582,33 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
                        "gdbus-connection",
                        MMF_VALUE_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       {(void*)NULL},
+                       {NULL},
                        MM_ATTRS_VALID_TYPE_NONE,
                        {0},
                        {0},
                        NULL,
+               },
+               {
+                       MM_CAM_AUDIO_REPLAY_GAIN_ENABLE,
+                       "audio-replay-gain-enable",
+                       MMF_VALUE_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       {(void*)FALSE},
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       {.int_min = 0},
+                       {.int_max = 1},
+                       _mmcamcorder_commit_audio_replay_gain,
+               },
+               {
+                       MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL,
+                       "audio-replay-gain-reference-level",
+                       MMF_VALUE_TYPE_DOUBLE,
+                       MM_ATTRS_FLAG_RW,
+                       {.value_double = MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL},
+                       MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+                       {.double_min = 0.0},
+                       {.double_max = 150.0},
+                       _mmcamcorder_commit_audio_replay_gain,
                }
        };
 
@@ -1630,41 +1653,46 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
        __mmcamcorder_set_conf_to_valid_info(handle);
 
        for (idx = 0; idx < attr_count; idx++) {
-/*             _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);
+               mm_cam_attr_construct_info *attr_info = &hcamcorder->cam_attrs_const_info[idx];
+
+/*
+               _mmcam_dbg_log("Valid type [%s:%d, %d, %d]",
+                       attr_info->name, attr_info->validity_type,
+                       attr_info->validity_value1, attr_info->validity_value2);
 */
-               mmf_attrs_set_valid_type(attrs, idx, hcamcorder->cam_attrs_const_info[idx].validity_type);
+               mmf_attrs_set_valid_type(attrs, idx, attr_info->validity_type);
 
-               switch (hcamcorder->cam_attrs_const_info[idx].validity_type) {
+               switch (attr_info->validity_type) {
                case MM_ATTRS_VALID_TYPE_INT_ARRAY:
-                       if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array &&
-                           hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
+                       if (attr_info->validity_value_1.int_array &&
+                           attr_info->validity_value_2.count > 0) {
                                mmf_attrs_set_valid_array(attrs, idx,
-                                       (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);
+                                       (const int *)(attr_info->validity_value_1.int_array),
+                                       attr_info->validity_value_2.count,
+                                       attr_info->default_value.value_int);
                        }
                        break;
                case MM_ATTRS_VALID_TYPE_INT_RANGE:
                        mmf_attrs_set_valid_range(attrs, idx,
-                               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);
+                               attr_info->validity_value_1.int_min,
+                               attr_info->validity_value_2.int_max,
+                               attr_info->default_value.value_int);
                        break;
                case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
-                       if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array &&
-                           hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
+                       if (attr_info->validity_value_1.double_array &&
+                           attr_info->validity_value_2.count > 0) {
                                mmf_attrs_set_valid_double_array(attrs, idx,
-                                       (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);
+                                       (const double *)(attr_info->validity_value_1.double_array),
+                                       attr_info->validity_value_2.count,
+                                       attr_info->default_value.value_double);
                        }
                        break;
                case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
                        mmf_attrs_set_valid_double_range(attrs, idx,
-                               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);
+                               attr_info->validity_value_1.double_min,
+                               attr_info->validity_value_2.double_max,
+                               attr_info->default_value.value_double);
+                       ((mmf_attrs_t *)attrs)->items[idx].value.value.d_val = attr_info->default_value.value_double;
                        break;
                case MM_ATTRS_VALID_TYPE_NONE:
                        break;
@@ -1747,7 +1775,7 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha
        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);
+               _mmcam_dbg_err("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name);
                ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
        }
 
@@ -2004,6 +2032,7 @@ bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_i
        const char *videosrc_name = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
+       _MMCamcorderImageInfo *info = NULL;
        GstCameraControl *control = NULL;
        type_element *VideosrcElement = NULL;
 
@@ -2022,7 +2051,18 @@ bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_i
        if (!sc)
                return TRUE;
 
+       info = sc->info_image;
+       if (!info) {
+               _mmcam_dbg_err("info image is NULL");
+               return FALSE;
+       }
+
        if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) {
+               if (info->capture_send_count > 0) {
+                       info->capturing = FALSE;
+                       _mmcam_dbg_warn("capturing -> FALSE and skip capture callback since now");
+               }
+
                if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
                        _mmcam_dbg_warn("Can't cast Video source into camera control.");
                        return TRUE;
@@ -2563,9 +2603,7 @@ bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, cons
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find tilt control channel");
-               }
+               _mmcam_dbg_warn("failed to find tilt control channel");
        }
 
        return FALSE;
@@ -2630,9 +2668,7 @@ bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const mmf
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find pan control channel");
-               }
+               _mmcam_dbg_warn("failed to find pan control channel");
        }
 
        return FALSE;
@@ -2697,9 +2733,7 @@ bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const mm
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find tilt control channel");
-               }
+               _mmcam_dbg_warn("failed to find tilt control channel");
        }
 
        return FALSE;
@@ -3389,16 +3423,11 @@ 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;
-       const char *filename = NULL;
        int size = 0;
+       const char *filename = NULL;
 
        mmf_return_val_if_fail(handle && value, FALSE);
 
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc)
-               return TRUE;
-
        /* get string */
        filename = mmf_value_get_string(value, &size);
        if (filename == NULL) {
@@ -3406,22 +3435,7 @@ bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, cons
                return FALSE;
        }
 
-       if (sc->info_video) {
-               SAFE_G_FREE(sc->info_video->filename);
-               sc->info_video->filename = g_strdup(filename);
-               if (sc->info_video->filename == NULL) {
-                       _mmcam_dbg_err("failed to strdup filename [%s]", filename);
-                       return FALSE;
-               }
-       }
-
-       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_POINTER(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);
-       }
+       _mmcam_dbg_log("set filename [%s]", filename);
 
        return TRUE;
 }
@@ -3738,19 +3752,14 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const
                _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
 
                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));
+                       _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));
                } else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) {
                        _mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
                        MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
-               } else if (!strcmp(videosink_name, "waylandsink")) {
-                       MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle;
-
-                       _mmcam_dbg_log("wayland global surface id : %d", wl_info->global_surface_id);
-
-                       gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->global_surface_id);
-                       gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
-                               wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
+               } else if (!strcmp(videosink_name, "tizenwlsink")) {
+                       _mmcam_dbg_log("wayland global surface id : %d", *(int *)(p_handle));
+                       gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)*(int *)(p_handle));
                } else {
                        _mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name);
                        return FALSE;
@@ -3797,7 +3806,7 @@ bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const m
 
        _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
 
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
+       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
                _mmcam_dbg_log("Commit : display mode [%d]", value->value.i_val);
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val);
        } else {
@@ -3890,7 +3899,7 @@ bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, cons
                return FALSE;
        }
 
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
                !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "visible", value->value.i_val);
                _mmcam_dbg_log("Set visible [%d] done.", value->value.i_val);
@@ -3935,7 +3944,7 @@ bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_i
                return FALSE;
        }
 
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
            !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
                method = value->value.i_val;
                MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
@@ -3990,7 +3999,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m
                return FALSE;
        }
 
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
            !strcmp(videosink_name, "evaspixmapsink")) {
                int rect_x = 0;
                int rect_y = 0;
@@ -4044,7 +4053,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m
                if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
                        _mmcam_dbg_log("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height);
 
-                       if (!strcmp(videosink_name, "waylandsink")) {
+                       if (!strcmp(videosink_name, "tizenwlsink")) {
                            ret = gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
                                        rect_x, rect_y, rect_width, rect_height);
                                if (!ret) {
@@ -4060,12 +4069,11 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m
                                        NULL);
                        }
                }
-
-               return TRUE;
        } else {
-               _mmcam_dbg_warn("videosink[%s] does not support display rect.", videosink_name);
-               return FALSE;
+               _mmcam_dbg_warn("[%s] does not support display rect, but no error", videosink_name);
        }
+
+       return TRUE;
 }
 
 
@@ -4104,7 +4112,7 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const
        }
 
        zoom = value->value.i_val;
-       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
+       if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
                vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
 
                MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
@@ -4539,7 +4547,7 @@ bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx,
 
        new_pid = value->value.i_val;
 
-       _mmcam_dbg_log("Commit : pid %d, current focus id %d, subscribe id %u",
+       _mmcam_dbg_warn("Commit : pid %d, current focus id %d, subscribe id %u",
                new_pid, hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id);
 
        /* unregister sound focus and unsubscribe sound signal before set new one */
@@ -4561,6 +4569,17 @@ bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx,
                        hcamcorder->sound_focus_register = FALSE;
                        _mmcam_dbg_warn("no need to use sound focus internally");
                } else {
+                       /* check my session type : allow only media & call series here */
+                       if ((hcamcorder->session_type != MM_SESSION_TYPE_MEDIA) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_MEDIA_RECORD) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_CALL) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_VIDEOCALL) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_VOIP)) {
+                               _mmcam_dbg_err("Blocked by session policy, my session_type[%s]", hcamcorder->session_type);
+                               hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
+                               return FALSE;
+                       }
+
                        ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id);
                        if (ret != MM_ERROR_NONE) {
                                _mmcam_dbg_err("mm_sound_focus_get_id failed");
@@ -4617,13 +4636,6 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co
                return FALSE;
        }
 
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc || !sc->encode_element ||
-           !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
-               _mmcam_dbg_log("audiosrc element is not initialized, it will be set later");
-               return TRUE;
-       }
-
        mm_camcorder_get_attributes(handle, NULL,
                MMCAM_SOUND_STREAM_INDEX, &stream_index,
                NULL);
@@ -4632,7 +4644,17 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co
                return FALSE;
        }
 
-       _mmcam_dbg_log("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
+       /* unset watch callback if existed */
+       _mmcamcorder_sound_signal_callback(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1, (void *)handle);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc || !sc->encode_element ||
+           !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+               _mmcam_dbg_warn("audiosrc element is not initialized, it will be set later");
+               return TRUE;
+       }
+
+       _mmcam_dbg_warn("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
 
        return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
 }
@@ -4655,6 +4677,58 @@ bool _mmcamcorder_commit_tag(MMHandleType handle, int attr_idx, const mmf_value_
        return TRUE;
 }
 
+bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+       mmf_return_val_if_fail(hcamcorder && value, FALSE);
+
+       if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_ENABLE) {
+               /* Replay gain enable */
+               int current_state = MM_CAMCORDER_STATE_NONE;
+               int audio_disable = FALSE;
+
+               current_state = _mmcamcorder_get_state(handle);
+               if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
+                       _mmcam_dbg_err("Can not set replay gain enable [state : %d]", current_state);
+                       hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
+                       return FALSE;
+               }
+
+               mm_camcorder_get_attributes(handle, NULL,
+                       MMCAM_AUDIO_DISABLE, &audio_disable,
+                       NULL);
+
+               if (audio_disable) {
+                       _mmcam_dbg_err("audio is disabled");
+                       hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
+                       return FALSE;
+               }
+
+               _mmcam_dbg_log("set replay gain enable : %d", value->value.i_val);
+       } else if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL) {
+               /* Replay gain reference level */
+               int replay_gain_enable = FALSE;
+
+               mm_camcorder_get_attributes(handle, NULL,
+                       MMCAM_AUDIO_REPLAY_GAIN_ENABLE, &replay_gain_enable,
+                       NULL);
+
+               if (replay_gain_enable == FALSE) {
+                       _mmcam_dbg_err("replay gain is disabled");
+                       hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
+                       return FALSE;
+               }
+
+               _mmcam_dbg_log("set reference level for replay gain : %ld dB", value->value.d_val);
+       } else {
+               _mmcam_dbg_err("unknown attribute id %d", attr_idx);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 
 static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx)
 {
@@ -4700,7 +4774,6 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
                MM_CAM_CAMERA_WDR,
                MM_CAM_FILTER_CONTRAST,
                MM_CAM_FILTER_HUE,
-               MM_CAM_STROBE_MODE,
                MM_CAM_DETECT_MODE
        };
 
@@ -4716,7 +4789,7 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
 
-       _mmcam_dbg_log("Set all attribute again.");
+       _mmcam_dbg_log("commit some attributes again");
 
        attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
        if (attr == NULL) {
@@ -4757,6 +4830,45 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
 }
 
 
+bool _mmcamcorder_set_attribute_to_camsensor2(MMHandleType handle)
+{
+       mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       mmf_attrs_t *attr = NULL;
+
+       unsigned int i = 0;
+       int ret = TRUE;
+       int attr_idxs[] = {
+               MM_CAM_STROBE_MODE
+       };
+
+       mmf_return_val_if_fail(hcamcorder, FALSE);
+
+       _mmcam_dbg_log("commit some attribute again[2]");
+
+       attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+       if (attr == NULL) {
+               _mmcam_dbg_err("Get attribute handle failed.");
+               return FALSE;
+       } else {
+               _mmcam_dbg_log("attribute count(%d)", attr->count);
+
+               for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
+                       if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs[i]))
+                               mmf_attribute_set_modified(&(attr->items[attr_idxs[i]]));
+               }
+
+               if (mmf_attrs_commit((MMHandleType)attr) == -1)
+                       ret = FALSE;
+               else
+                       ret = TRUE;
+       }
+
+       _mmcam_dbg_log("Done.");
+
+       return ret;
+}
+
+
 int _mmcamcorder_lock_readonly_attributes(MMHandleType handle)
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);