Add new API for extra preview support 43/272743/1
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 23 Mar 2022 12:44:10 +0000 (21:44 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 23 Mar 2022 12:44:29 +0000 (21:44 +0900)
[Version] 0.3.51
[Issue Type] New feature

Change-Id: Ic8ae11ea001c51eff8b91c91bab974794b4cb3dd
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
legacy/include/legacy_camera.h
legacy/src/legacy_camera.c
muse/include/muse_camera.h
muse/src/muse_camera_dispatcher.c
packaging/mmsvc-camera.spec

index 29d341b..9495cd6 100644 (file)
@@ -1692,6 +1692,19 @@ int legacy_camera_get_device_count(camera_h camera, int *device_count);
 bool legacy_camera_is_supported_media_packet_preview_cb(camera_h camera);
 
 /**
+ * @brief Gets the extra preview feature's supported state.
+ * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE
+ * @since_tizen 7.0
+ * @param[in] camera The handle to the camera
+ * @return @c true if supported, otherwise @c false
+ * @exception #CAMERA_ERROR_NONE Successful
+ * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ *
+ */
+bool legacy_camera_is_supported_extra_preview(camera_h camera);
+
+/**
  * @}
  */
 
index 7f76fd6..d1e6535 100644 (file)
@@ -1160,6 +1160,29 @@ bool legacy_camera_is_supported_media_packet_preview_cb(camera_h camera)
 }
 
 
+bool legacy_camera_is_supported_extra_preview(camera_h camera)
+{
+       int ret = MM_ERROR_NONE;
+       int supported_extra_preview = false;
+       camera_s *handle = (camera_s *)camera;
+
+       camera_return_val_if_fail(handle, false);
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+               MMCAM_SUPPORT_EXTRA_PREVIEW, &supported_extra_preview,
+               NULL);
+       set_last_result(__convert_camera_error_code(__func__, ret));
+       if (ret != MM_ERROR_NONE) {
+               CAM_LOG_ERROR("MMCAM_SUPPORT_EXTRA_PREVIEW get failed");
+               return false;
+       }
+
+       CAM_LOG_INFO("support extra preview[%d]", supported_extra_preview);
+
+       return supported_extra_preview;
+}
+
+
 int legacy_camera_get_device_count(camera_h camera, int *device_count)
 {
        int ret = MM_ERROR_NONE;
index 24d3ba9..f269a07 100644 (file)
@@ -206,6 +206,7 @@ typedef enum {
        MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_BITRATE,
        MUSE_CAMERA_API_ATTR_SET_EXTRA_PREVIEW_GOP_INTERVAL,
        MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_GOP_INTERVAL,    /* 170 */
+       MUSE_CAMERA_API_SUPPORT_EXTRA_PREVIEW,
        MUSE_CAMERA_API_MAX
 } muse_camera_api_e;
 
index 3766013..2fc8010 100644 (file)
@@ -1452,8 +1452,8 @@ int camera_dispatcher_create(muse_module_h module)
        int device_type = 0;
        int is_network = 0;
        int preview_format = CAMERA_PIXEL_FORMAT_INVALID;
-       int user_buffer_supported = 0;
        int pid = 0;
+       bool user_buffer_supported = false;
        bool camera_feature_supported = false;
        char *send_msg = NULL;
        void *gdbus_connection = NULL;
@@ -1770,7 +1770,7 @@ int camera_dispatcher_start_capture(muse_module_h module)
 
 int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -1779,11 +1779,11 @@ int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
+       supported = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("is supported ret[%d]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -1839,7 +1839,7 @@ int camera_dispatcher_stop_continuous_capture(muse_module_h module)
 
 int camera_dispatcher_is_supported_face_detection(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -1848,18 +1848,18 @@ int camera_dispatcher_is_supported_face_detection(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_is_supported_face_detection(muse_camera->camera_handle);
+       supported = legacy_camera_is_supported_face_detection(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("is supported ret[%d]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
 
 int camera_dispatcher_is_supported_zero_shutter_lag(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -1868,18 +1868,18 @@ int camera_dispatcher_is_supported_zero_shutter_lag(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
+       supported = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("is supported ret[%d]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
 
 int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -1888,11 +1888,31 @@ int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
+       supported = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("is supported ret[%d]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_is_supported_extra_preview(muse_module_h module)
+{
+       bool supported = false;
+       muse_camera_handle_s *muse_camera = NULL;
+       muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_EXTRA_PREVIEW;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_server_ipc_get_handle(module);
+
+       CAM_LOG_INFO("handle[%p]", muse_camera);
+
+       supported = legacy_camera_is_supported_extra_preview(muse_camera->camera_handle);
+
+       CAM_LOG_INFO("supported[%d]", supported);
+
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -4448,7 +4468,7 @@ int camera_dispatcher_attr_get_hdr_mode(muse_module_h module)
 
 int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -4457,11 +4477,11 @@ int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
+       supported = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("ret[0x%x]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -4556,7 +4576,7 @@ int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module)
 
 int camera_dispatcher_attr_is_supported_anti_shake(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -4565,11 +4585,11 @@ int camera_dispatcher_attr_is_supported_anti_shake(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
+       supported = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("ret[0x%x]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -4622,7 +4642,7 @@ int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module)
 
 int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -4631,11 +4651,11 @@ int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
+       supported = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("ret[0x%x]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -4688,7 +4708,7 @@ int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module)
 
 int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
 {
-       int ret = CAMERA_ERROR_NONE;
+       bool supported = false;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -4697,11 +4717,11 @@ int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
 
        CAM_LOG_INFO("handle[%p]", muse_camera);
 
-       ret = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
+       supported = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
 
-       CAM_LOG_INFO("ret[0x%x]", ret);
+       CAM_LOG_INFO("supported[%d]", supported);
 
-       muse_camera_msg_return(api, class, ret, module);
+       muse_camera_msg_return(api, class, (int)supported, module);
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -5947,7 +5967,8 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
        camera_dispatcher_attr_set_extra_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_EXTRA_PREVIEW_BITRATE */
        camera_dispatcher_attr_get_extra_preview_bitrate, /* MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_BITRATE */
        camera_dispatcher_attr_set_extra_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_EXTRA_PREVIEW_GOP_INTERVAL */
-       camera_dispatcher_attr_get_extra_preview_gop_interval /* MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_GOP_INTERVAL */
+       camera_dispatcher_attr_get_extra_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_GOP_INTERVAL */
+       camera_dispatcher_is_supported_extra_preview /* MUSE_CAMERA_API_SUPPORT_EXTRA_PREVIEW, */
 };
 
 
index b421d2d..00b691b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-camera
 Summary:    A Camera module for muse server
-Version:    0.3.50
+Version:    0.3.51
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0