[Release version 0.2.34] Add New APIs - Pan, Tilt, Display ROI Area 75/66375/5
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 18 Apr 2016 12:12:55 +0000 (21:12 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 2 May 2016 07:02:57 +0000 (16:02 +0900)
Change-Id: Ia6c87cad55c12fe9bd2118fd3c24710bff7260e4
Signed-off-by: Haesu Gwon <haesu.gwon@samsung.com>
legacy/include/legacy_camera.h
legacy/include/legacy_camera_private.h
legacy/src/legacy_camera.c
muse/include/muse_camera.h
muse/src/muse_camera_dispatcher.c

index 119a701..77eb7f5 100644 (file)
@@ -295,6 +295,7 @@ typedef enum
        CAMERA_DISPLAY_MODE_ORIGIN_SIZE,       /**< Origin size */
        CAMERA_DISPLAY_MODE_FULL,              /**< Full screen */
        CAMERA_DISPLAY_MODE_CROPPED_FULL,      /**< Cropped full screen */
+       CAMERA_DISPLAY_MODE_CUSTOM_ROI,        /**< Custom ROI */
 } camera_display_mode_e;
 
 /**
@@ -502,6 +503,24 @@ typedef enum
        CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL /**< Enable HDR capture and keep original image data */
 } camera_attr_hdr_mode_e;
 
+/**
+ * @brief Enumeration for PTZ(Pan Tilt Zoom) type.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       CAMERA_ATTR_PTZ_TYPE_MECHANICAL = 0,  /**< Move the camera device physically */
+       CAMERA_ATTR_PTZ_TYPE_ELECTRONIC       /**< Zoom digitally and move into portion of the image */
+} camera_attr_ptz_type_e;
+
+/**
+ * @brief Enumeration for PTZ(Pan Tilt Zoom) movement type.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       CAMERA_ATTR_PTZ_MOVE_ABSOLUTE = 0,  /**< Move to a specific coordinate position */
+       CAMERA_ATTR_PTZ_MOVE_RELATIVE       /**< Move a specific distance from the current position */
+} camera_attr_ptz_move_type_e;
+
 
 /**
  * @}
@@ -1950,6 +1969,17 @@ typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotat
 typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e mode, void *user_data);
 
 /**
+ * @brief Called to get each supported PTZ(Pan Tilt Zoom) type.
+ * @since_tizen 3.0
+ * @param[in] type The supported ptz type
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
+ * @pre        camera_attr_foreach_supported_ptz_type() will invoke this callback.
+ * @see        camera_attr_foreach_supported_ptz_type()
+ */
+typedef bool (*camera_attr_supported_ptz_type_cb)(camera_attr_ptz_type_e type, void *user_data);
+
+/**
  * @}
  */
 
@@ -3528,6 +3558,164 @@ int legacy_camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *in
  */
 int legacy_camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval);
 
+/**
+ * @brief Sets the position to move horizontally.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[in] move_type The PTZ(Pan Tilt Zoom) move type
+ * @param[in] pan_step The step to move the camera
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_set_pan(camera_h camera, int move_type, int pan_step);
+
+/**
+ * @brief Gets the current position of the camera.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[out] pan_step The current horizontal distance from the starting point.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_get_pan(camera_h camera, int *pan_step);
+
+/**
+ * @brief Gets lower limit and upper limit for pan position.
+ * @since_tizen 3.0
+ * @remarks If the min value is greater than the max value, it means that this feature is not supported.
+ * @param[in] camera The handle to the camera
+ * @param[out] min The lower limit for pan
+ * @param[out] max The upper limit for pan
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_get_pan_range(camera_h camera, int *min, int *max);
+
+/**
+ * @brief Sets the position to move vertically.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[in] move_type The PTZ(Pan Tilt Zoom) move type
+ * @param[in] tilt_step The step to move the camera
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_set_tilt(camera_h camera, int move_type, int tilt_step);
+
+/**
+ * @brief Gets the current position of the camera.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[out] tilt_step The current vertical distance from the starting point.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_get_tilt(camera_h camera, int *tilt_step);
+
+/**
+ * @brief Gets lower limit and upper limit for tilt position.
+ * @since_tizen 3.0
+ * @remarks If the min value is greater than the max value, it means that this feature is not supported.
+ * @param[in] camera The handle to the camera
+ * @param[out] min The lower limit for tilt
+ * @param[out] max The upper limit for tilt
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_get_tilt_range(camera_h camera, int *min, int *max);
+
+/**
+ * @brief Sets the type of PTZ(Pan Tilt Zoom).
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[in] ptz_type PTZ type
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_set_ptz_type(camera_h camera, int ptz_type);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Retrieves all supported PTZ(Pan Tilt Zoom) types by invoking callback function once for each supported ptz type.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post This function invokes camera_attr_supported_ptz_type_cb() to get all supported ptz type.
+ * @see camera_attr_set_ptz_type()
+ */
+int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the ROI(Region Of Interest) area of display.
+ * @since_tizen 3.0
+ * @remarks Before set display ROI area, #CAMERA_DISPLAY_MODE_CUSTOM_ROI should be set with legacy_camera_set_display_mode().
+ * @param[in] camera The handle to the camera
+ * @param[in] display_roi_area The information of ROI(Region Of Interest) area
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_set_display_roi_area(camera_h camera, int *display_roi_area);
+
+/**
+ * @brief Gets the ROI(Region Of Interest) area of display.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[out] display_roi_area The information of ROI(Region Of Interest) area
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int legacy_camera_attr_get_display_roi_area(camera_h camera, int *display_roi_area);
+
 
 /**
  * @}
index d59c35e..0108530 100644 (file)
@@ -79,6 +79,7 @@ typedef struct _camera_s{
        bool on_continuous_focusing;
        int cached_focus_mode;
        camera_device_e device_type;
+       camera_attr_ptz_type_e ptz_type;
 
        GList *cb_data_list;
        GMutex idle_cb_lock;
index d2d56ca..313eae5 100644 (file)
@@ -644,6 +644,7 @@ int legacy_camera_create(camera_device_e device, camera_h* camera)
        handle->on_continuous_focusing = false;
        handle->cached_focus_mode = -1;
        handle->device_type = device;
+       handle->ptz_type = CAMERA_ATTR_PTZ_TYPE_ELECTRONIC;
 
        g_mutex_init(&handle->idle_cb_lock);
 
@@ -4229,3 +4230,315 @@ int legacy_camera_attr_set_encoded_preview_gop_interval(camera_h camera, int int
 
        return __convert_camera_error_code(__func__, ret);
 }
+
+
+int legacy_camera_attr_set_pan(camera_h camera, int move_type, int pan_step)
+{
+       if (camera == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       int step = 0;
+       char *pan_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               pan_type = MMCAM_CAMERA_PAN_MECHA;
+       else
+               pan_type = MMCAM_CAMERA_PAN_ELEC;
+
+       if (move_type == CAMERA_ATTR_PTZ_MOVE_RELATIVE) {
+               ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         pan_type, &step,
+                                         NULL);
+
+               if (ret == MM_ERROR_NONE) {
+                       step += pan_step;
+               } else {
+                       LOGE("mm_camcorder_get_attributes failed : 0x%x", ret);
+                       return __convert_camera_error_code(__func__, ret);
+               }
+       } else {
+               step = pan_step;
+       }
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+                                         pan_type, step,
+                                         NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_get_pan(camera_h camera, int *pan_step)
+{
+       if (camera == NULL || pan_step == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       char *pan_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               pan_type = MMCAM_CAMERA_PAN_MECHA;
+       else
+               pan_type = MMCAM_CAMERA_PAN_ELEC;
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         pan_type, pan_step,
+                                         NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_get_pan_range(camera_h camera, int *min, int *max)
+{
+       if (camera == NULL || min == NULL || max == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       char *pan_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+       MMCamAttrsInfo ainfo;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               pan_type = MMCAM_CAMERA_PAN_MECHA;
+       else
+               pan_type = MMCAM_CAMERA_PAN_ELEC;
+
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, pan_type, &ainfo);
+       if (ret == MM_ERROR_NONE) {
+               *min = ainfo.int_range.min;
+               *max = ainfo.int_range.max;
+       }
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_set_tilt(camera_h camera, int move_type, int tilt_step)
+{
+       if (camera == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       int step = 0;
+       char *tilt_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               tilt_type = MMCAM_CAMERA_TILT_MECHA;
+       else
+               tilt_type = MMCAM_CAMERA_TILT_ELEC;
+
+       if (move_type == CAMERA_ATTR_PTZ_MOVE_RELATIVE) {
+               ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         tilt_type, &step,
+                                         NULL);
+
+               if (ret == MM_ERROR_NONE) {
+                       step += tilt_step;
+               } else {
+                       LOGE("mm_camcorder_get_attributes failed : 0x%x", ret);
+                       return __convert_camera_error_code(__func__, ret);
+               }
+       } else {
+               step = tilt_step;
+       }
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+                                         tilt_type, step,
+                                         NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_get_tilt(camera_h camera, int *tilt_step)
+{
+       if (camera == NULL || tilt_step == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       char *tilt_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               tilt_type = MMCAM_CAMERA_TILT_MECHA;
+       else
+               tilt_type = MMCAM_CAMERA_TILT_ELEC;
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         tilt_type, tilt_step,
+                                         NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
+{
+       if (camera == NULL || min == NULL || max == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       char *tilt_type = NULL;
+       camera_s *handle = (camera_s *)camera;
+       MMCamAttrsInfo ainfo;
+
+       if (handle->ptz_type == CAMERA_ATTR_PTZ_TYPE_MECHANICAL)
+               tilt_type = MMCAM_CAMERA_TILT_MECHA;
+       else
+               tilt_type = MMCAM_CAMERA_TILT_ELEC;
+
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, tilt_type, &ainfo);
+       if (ret == MM_ERROR_NONE) {
+               *min = ainfo.int_range.min;
+               *max = ainfo.int_range.max;
+       }
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_set_ptz_type(camera_h camera, int ptz_type)
+{
+       if (camera == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       camera_s *handle = (camera_s *)camera;
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+                                         MMCAM_CAMERA_PTZ_TYPE, ptz_type,
+                                         NULL);
+
+       if (ret != MM_ERROR_NONE)
+               handle->ptz_type = ptz_type;
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
+{
+       if (camera == NULL || foreach_cb == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int i = 0;
+       int ret = MM_ERROR_NONE;
+       camera_s *handle = (camera_s *)camera;
+       MMCamAttrsInfo info;
+
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_PTZ_TYPE, &info);
+       if (ret != MM_ERROR_NONE) {
+               return __convert_camera_error_code(__func__, ret);
+       }
+
+       for (i = 0 ; i < info.int_array.count ; i++) {
+               if (!foreach_cb(info.int_array.array[i], user_data)) {
+                       break;
+               }
+       }
+
+       return CAMERA_ERROR_NONE;
+}
+
+
+int legacy_camera_attr_set_display_roi_area(camera_h camera, int *display_roi_area)
+{
+       if (camera == NULL || display_roi_area == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       int current_method = MM_DISPLAY_METHOD_LETTER_BOX;
+       camera_s *handle = (camera_s *)camera;
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         MMCAM_DISPLAY_GEOMETRY_METHOD, &current_method,
+                                         NULL);
+       if (ret != MM_ERROR_NONE) {
+               LOGE("INVALID_OPERATION(0x%08x)", CAMERA_ERROR_INVALID_OPERATION);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       if (current_method != MM_DISPLAY_METHOD_CUSTOM_ROI) {
+               LOGE("NOT CUSTOM_ROI mode - %d", current_method);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+                                         MMCAM_DISPLAY_RECT_X, display_roi_area[0],
+                                         MMCAM_DISPLAY_RECT_Y, display_roi_area[1],
+                                         MMCAM_DISPLAY_RECT_WIDTH, display_roi_area[2],
+                                         MMCAM_DISPLAY_RECT_HEIGHT, display_roi_area[3],
+                                         NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+int legacy_camera_attr_get_display_roi_area(camera_h camera, int *display_roi_area)
+{
+       if (camera == NULL || display_roi_area == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = MM_ERROR_NONE;
+       int current_method = MM_DISPLAY_METHOD_LETTER_BOX;
+       int x = 0;
+       int y = 0;
+       int width = 0;
+       int height = 0;
+       camera_s *handle = (camera_s *)camera;
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         MMCAM_DISPLAY_GEOMETRY_METHOD, &current_method,
+                                         NULL);
+       if (ret != MM_ERROR_NONE) {
+               LOGE("INVALID_OPERATION(0x%08x)", CAMERA_ERROR_INVALID_OPERATION);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       if (current_method != MM_DISPLAY_METHOD_CUSTOM_ROI) {
+               LOGE("NOT CUSTOM_ROI mode - %d", current_method);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+                                         MMCAM_DISPLAY_RECT_X, &x,
+                                         MMCAM_DISPLAY_RECT_Y, &y,
+                                         MMCAM_DISPLAY_RECT_WIDTH, &width,
+                                         MMCAM_DISPLAY_RECT_HEIGHT, &height,
+                                         NULL);
+
+       if (ret != MM_ERROR_NONE) {
+               LOGD("get roi area : %d,%d,%dx%d", x, y, width, height);
+
+               display_roi_area[0] = x;
+               display_roi_area[1] = y;
+               display_roi_area[2] = width;
+               display_roi_area[3] = height;
+       }
+
+       return __convert_camera_error_code(__func__, ret);
+}
index 6aeeafd..0646ec9 100644 (file)
@@ -170,8 +170,18 @@ typedef enum {
        MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE,
        MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL,
        MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL,
+       MUSE_CAMERA_API_ATTR_SET_PAN,
+       MUSE_CAMERA_API_ATTR_GET_PAN, //135
+       MUSE_CAMERA_API_ATTR_GET_PAN_RANGE,
+       MUSE_CAMERA_API_ATTR_SET_TILT,
+       MUSE_CAMERA_API_ATTR_GET_TILT,
+       MUSE_CAMERA_API_ATTR_GET_TILT_RANGE,
+       MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE, //140
+       MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE,
+       MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA,
+       MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA,
        MUSE_CAMERA_API_RETURN_BUFFER,
-       MUSE_CAMERA_API_PREVIEW_CB_RETURN, // 135
+       MUSE_CAMERA_API_PREVIEW_CB_RETURN, //145
        MUSE_CAMERA_API_MAX
 } muse_camera_api_e;
 
@@ -215,7 +225,8 @@ typedef enum {
        MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION,
        MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, //25
        MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION,
-       MUSE_CAMERA_EVENT_TYPE_NUM //27
+       MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE,
+       MUSE_CAMERA_EVENT_TYPE_NUM //28
 }muse_camera_event_e;
 
 /**
index d407270..8d3d68b 100644 (file)
@@ -265,6 +265,19 @@ void _camera_dispatcher_callback_supported_capture_resolution(int param1, int pa
                               INT, param2);
 }
 
+void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data)
+{
+       muse_module_h module = (muse_module_h)user_data;
+
+       LOGD("Enter!! param : %d", param1);
+
+       muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
+                              MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE,
+                              MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
+                              module,
+                              INT, param1);
+}
+
 static int _camera_remove_export_data(muse_module_h module, int key, int remove_all)
 {
        muse_camera_handle_s *muse_camera = NULL;
@@ -4072,6 +4085,238 @@ int camera_dispatcher_attr_set_encoded_preview_gop_interval(muse_module_h module
        return MUSE_CAMERA_ERROR_NONE;
 }
 
+int camera_dispatcher_attr_set_pan(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int set_move_type = 0;
+       int set_pan_step = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       muse_camera_msg_get(set_move_type, muse_core_client_get_msg(module));
+       muse_camera_msg_get(set_pan_step, muse_core_client_get_msg(module));
+
+       LOGD("handle : 0x%x", muse_camera);
+
+       ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, set_move_type, set_pan_step);
+
+       LOGD("ret : 0x%x", ret);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_get_pan(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int get_pan_step = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_pan_step);
+       if (ret == CAMERA_ERROR_NONE) {
+               muse_camera_msg_return1(api, class, ret, module, INT, get_pan_step);
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_get_pan_range(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int get_min = 0;
+       int get_max = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_min, &get_max);
+       if (ret == CAMERA_ERROR_NONE) {
+               muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max);
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_set_tilt(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int set_move_type = 0;
+       int set_tilt_step = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       muse_camera_msg_get(set_move_type, muse_core_client_get_msg(module));
+       muse_camera_msg_get(set_tilt_step, muse_core_client_get_msg(module));
+
+       LOGD("handle : 0x%x", muse_camera);
+
+       ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, set_move_type, set_tilt_step);
+
+       LOGD("ret : 0x%x", ret);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_get_tilt(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int get_tilt_step = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_tilt_step);
+       if (ret == CAMERA_ERROR_NONE) {
+               muse_camera_msg_return1(api, class, ret, module, INT, get_tilt_step);
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_get_tilt_range(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int get_min = 0;
+       int get_max = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_min, &get_max);
+       if (ret == CAMERA_ERROR_NONE) {
+               muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max);
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_set_ptz_type(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int set_ptz_type = 0;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       muse_camera_msg_get(set_ptz_type, muse_core_client_get_msg(module));
+
+       LOGD("handle : 0x%x", muse_camera);
+
+       ret = legacy_camera_attr_set_ptz_type(muse_camera->camera_handle, set_ptz_type);
+
+       LOGD("ret : 0x%x", ret);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle,
+                                                          (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type,
+                                                          (void *)module);
+
+       LOGD("ret : 0x%x", ret);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_set_display_roi_area(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int set_display_roi_area[4] = {0,};
+       muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       muse_camera_msg_get_array(set_display_roi_area, muse_core_client_get_msg(module));
+
+       LOGD("handle : 0x%x, x : %d, y : %d, width : %d, height : %d", muse_camera,
+               set_display_roi_area[0], set_display_roi_area[1], set_display_roi_area[2], set_display_roi_area[3]);
+
+       ret = legacy_camera_attr_set_display_roi_area(muse_camera->camera_handle, set_display_roi_area);
+
+       LOGD("ret : 0x%x", ret);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_attr_get_display_roi_area(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       muse_camera_handle_s *muse_camera = NULL;
+       int get_display_roi_area[4] = {0,};
+       muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       LOGD("handle : %p", muse_camera);
+
+       ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_display_roi_area);
+       if (ret == CAMERA_ERROR_NONE) {
+               muse_camera_msg_return_array(api, class, ret, module, get_display_roi_area, sizeof(get_display_roi_area), sizeof(int));
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+
 int camera_dispatcher_return_buffer(muse_module_h module)
 {
        int tbm_key = 0;
@@ -4249,6 +4494,14 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
        camera_dispatcher_attr_set_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, */
        camera_dispatcher_attr_get_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, */
        camera_dispatcher_attr_set_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, */
+       camera_dispatcher_attr_set_pan, /* MUSE_CAMERA_API_ATTR_SET_PAN */
+       camera_dispatcher_attr_get_pan, /* MUSE_CAMERA_API_ATTR_GET_PAN */
+       camera_dispatcher_attr_get_pan_range, /* MUSE_CAMERA_API_ATTR_GET_PAN_RANGE */
+       camera_dispatcher_attr_set_tilt, /* MUSE_CAMERA_API_ATTR_SET_TILT */
+       camera_dispatcher_attr_get_tilt, /* MUSE_CAMERA_API_ATTR_GET_TILT */
+       camera_dispatcher_attr_get_tilt_range, /* MUSE_CAMERA_API_ATTR_GET_TILT_RANGE */
+       camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */
+       camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
        camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER, */
        camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN, */
 };