Bug fix - The extra preview callback is not invoked
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_attribute.c
index a6e2ef6..2f2cf4d 100644 (file)
@@ -4818,6 +4818,7 @@ bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, co
 
 bool _mmcamcorder_commit_extra_preview(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
 {
+       int ret = MM_ERROR_NONE;
        int current_state = MM_CAMCORDER_STATE_NONE;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        _MMCamcorderSubContext *sc = NULL;
@@ -4831,8 +4832,6 @@ bool _mmcamcorder_commit_extra_preview(MMHandleType handle, int attr_idx, const
 
        MMCAM_LOG_INFO("Enable extra preview(%d)", value->value.i_val);
 
-       hcamcorder->extra_preview.is_enabled = (gboolean)value->value.i_val;
-
        current_state = _mmcamcorder_get_state(handle);
        if (current_state < MM_CAMCORDER_STATE_READY) {
                MMCAM_LOG_INFO("will be set when preview is started");
@@ -4842,7 +4841,15 @@ bool _mmcamcorder_commit_extra_preview(MMHandleType handle, int attr_idx, const
        sc = MMF_CAMCORDER_SUBCONTEXT(handle);
        mmf_return_val_if_fail(sc, FALSE);
 
-       MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "extra-preview", value->value.i_val);
+       if (value->value.i_val)
+               ret = _mmcamcorder_initialize_extra_preview_mode(handle);
+       else
+               ret = _mmcamcorder_deinitialize_extra_preview_mode(handle);
+
+       if (ret != MM_ERROR_NONE) {
+               MMCAM_LOG_ERROR("set[%d] failed[0x%x]", value->value.i_val, ret);
+               return FALSE;
+       }
 
        MMCAM_LOG_INFO("done");