[Release version 0.10.54] Avoid FALL_THROUGH checker of Svace
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_internal.c
index 895ce61..6403c29 100644 (file)
@@ -42,7 +42,9 @@
 #include <mm_session.h>
 #include <mm_session_private.h>
 
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
 #include <murphy/common/glib-glue.h>
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
 
 /*---------------------------------------------------------------------------------------
@@ -333,6 +335,12 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                                                        "SupportMediaPacketPreviewCb",
                                                        &(hcamcorder->support_media_packet_preview_cb));
 
+                       /* Get UseVideoconvert value from INI */
+                       _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+                                                       CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
+                                                       "UseVideoconvert",
+                                                       &hcamcorder->use_videoconvert);
+
                        ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
                                                    MMCAM_CAMERA_WIDTH, &resolution_width,
                                                    MMCAM_CAMERA_HEIGHT, &resolution_height,
@@ -340,9 +348,10 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
 
                        mm_camcorder_get_fps_list_by_resolution((MMHandleType)hcamcorder, resolution_width, resolution_height, &fps_info);
 
-                       _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format);
-                       _mmcam_dbg_log("SupportMediaPacketPreviewCb : %d", hcamcorder->support_media_packet_preview_cb);
-                       _mmcam_dbg_log("res : %d X %d, Default FPS by resolution  : %d", resolution_width, resolution_height, fps_info.int_array.def);
+                       _mmcam_dbg_log("UseZeroCopyFormat %d, UseVideoconvert %d, SupportMediaPacketPreviewCb %d",
+                               hcamcorder->use_zero_copy_format, hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb);
+                       _mmcam_dbg_log("res : %d X %d, Default FPS by resolution  : %d",
+                               resolution_width, resolution_height, fps_info.int_array.def);
 
                        if (camera_facing_direction == 1) {
                                if (rcmd_dpy_rotation == MM_DISPLAY_ROTATION_270 || rcmd_dpy_rotation == MM_DISPLAY_ROTATION_90) {
@@ -350,7 +359,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                                } else {
                                        camera_default_flip = MM_FLIP_HORIZONTAL;
                                }
-                               _mmcam_dbg_log("camera_default_flip : [%d]",camera_default_flip);
+                               _mmcam_dbg_log("camera_default_flip : [%d]", camera_default_flip);
                        }
 
                        mm_camcorder_set_attributes((MMHandleType)hcamcorder, &err_attr_name,
@@ -423,6 +432,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                }
        }
 
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
        /* initialize resource manager */
        ret = _mmcamcorder_resource_manager_init(&hcamcorder->resource_manager, (void *)hcamcorder);
        if (ret != MM_ERROR_NONE) {
@@ -430,6 +440,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
                ret = MM_ERROR_CAMCORDER_INTERNAL;
                goto _ERR_DEFAULT_VALUE_INIT;
        }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
        traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:CREATE:INIT_GSTREAMER");
 
@@ -499,8 +510,10 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
        return MM_ERROR_NONE;
 
 _ERR_DEFAULT_VALUE_INIT:
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
        /* de-initialize resource manager */
        _mmcamcorder_resource_manager_deinit(&hcamcorder->resource_manager);
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
        /* unregister sound focus */
        if (hcamcorder->sound_focus_register && hcamcorder->sound_focus_id > 0) {
@@ -647,11 +660,13 @@ int _mmcamcorder_destroy(MMHandleType handle)
                hcamcorder->sub_context = NULL;
        }
 
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
        /* de-initialize resource manager */
        ret = _mmcamcorder_resource_manager_deinit(&hcamcorder->resource_manager);
        if (ret != MM_ERROR_NONE) {
                _mmcam_dbg_err("failed to de-initialize resource manager 0x%x", ret);
        }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
        /* Remove idle function which is not called yet */
        if (hcamcorder->setting_event_id) {
@@ -782,7 +797,6 @@ int _mmcamcorder_realize(MMHandleType handle)
 {
        int ret = MM_ERROR_NONE;
        int ret_sound = MM_ERROR_NONE;
-       int ret_resource = MM_ERROR_NONE;
        int state = MM_CAMCORDER_STATE_NONE;
        int state_FROM = MM_CAMCORDER_STATE_NULL;
        int state_TO = MM_CAMCORDER_STATE_READY;
@@ -992,7 +1006,7 @@ int _mmcamcorder_realize(MMHandleType handle)
                } else {
                        _mmcam_dbg_warn("NULL dpm_policy");
                }
-
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
                /* prepare resource manager for camera */
                ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, MM_CAMCORDER_RESOURCE_TYPE_CAMERA);
                if (ret != MM_ERROR_NONE) {
@@ -1021,6 +1035,7 @@ int _mmcamcorder_realize(MMHandleType handle)
                        _mmcamcorder_resource_manager_unprepare(&hcamcorder->resource_manager);
                        goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
                }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
        }
 
        /* create pipeline */
@@ -1059,9 +1074,10 @@ int _mmcamcorder_realize(MMHandleType handle)
        return MM_ERROR_NONE;
 
 _ERR_CAMCORDER_CMD:
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
        /* release hw resources */
        if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
-               ret_resource = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
+               int ret_resource = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
                if (ret_resource == MM_ERROR_RESOURCE_INVALID_STATE) {
                        _mmcam_dbg_warn("it could be in the middle of resource callback or there's no acquired resource");
                }
@@ -1073,6 +1089,7 @@ _ERR_CAMCORDER_CMD:
                        _mmcam_dbg_err("failed to unprepare resource manager, ret_resource(0x%x)", ret_resource);
                }
        }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
        _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
@@ -1146,6 +1163,7 @@ int _mmcamcorder_unrealize(MMHandleType handle)
                hcamcorder->sub_context = NULL;
        }
 
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
        if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
                /* release resource */
                ret = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
@@ -1162,6 +1180,7 @@ int _mmcamcorder_unrealize(MMHandleType handle)
                        _mmcam_dbg_err("failed to unprepare resource manager, ret(0x%x)", ret);
                }
        }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
        /* Deinitialize main context member */
        hcamcorder->command = NULL;
@@ -3403,6 +3422,7 @@ int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstSta
                        switch (getChangeReturn) {
                        case GST_STATE_CHANGE_NO_PREROLL:
                                _mmcam_dbg_log("status=GST_STATE_CHANGE_NO_PREROLL.");
+                               /* fall through */
                        case GST_STATE_CHANGE_SUCCESS:
                                /* if we reached the final target state, exit */
                                if (pipeline_state == target_state) {