summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaesu Gwon <haesu.gwon@samsung.com>2016-04-18 15:50:22 +0900
committerHaesu Gwon <haesu.gwon@samsung.com>2016-04-28 17:08:15 +0900
commitb68feebd52733597dc772a43742ab2aa2429fd15 (patch)
treeaea3b59120a5cbb4f71bc49c6831356a6ab5b027
parent27e24905e839d232b6dbb29912f704dd9290e855 (diff)
downloadcamera-b68feebd52733597dc772a43742ab2aa2429fd15.tar.gz
camera-b68feebd52733597dc772a43742ab2aa2429fd15.tar.bz2
camera-b68feebd52733597dc772a43742ab2aa2429fd15.zip
[Release version 0.2.54] Add New APIs - Pan, Tilt, Display ROI Area.
Change-Id: I1b785cb490bdca267e9a9117048f786b6960c74e Signed-off-by: Haesu Gwon <haesu.gwon@samsung.com>
-rw-r--r--include/camera.h237
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c334
-rw-r--r--test/camera_test.c17
4 files changed, 578 insertions, 12 deletions
diff --git a/include/camera.h b/include/camera.h
index a702ff4..4d76985 100644
--- a/include/camera.h
+++ b/include/camera.h
@@ -282,10 +282,12 @@ typedef void *camera_display_h;
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum {
- CAMERA_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */
- CAMERA_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */
- CAMERA_DISPLAY_MODE_FULL, /**< Full screen */
- CAMERA_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full screen */
+ CAMERA_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */
+ CAMERA_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */
+ CAMERA_DISPLAY_MODE_FULL, /**< Full screen */
+ CAMERA_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full screen */
+ CAMERA_DISPLAY_MODE_ORIGIN_OR_LETTER_BOX, /**< Original size or letter box (Since 3.0) */
+ CAMERA_DISPLAY_MODE_CUSTOM_ROI, /**< Custom ROI (Since 3.0) */
} camera_display_mode_e;
/**
@@ -482,6 +484,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;
+
/**
* @}
@@ -1517,7 +1537,7 @@ int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state);
* @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_supported_preview_format_cb() repeatly to retrieve each supported preview format.
+ * @post This function invokes camera_supported_preview_format_cb() repeatedly to retrieve each supported preview format.
* @see camera_set_preview_format()
* @see camera_get_preview_format()
* @see camera_supported_preview_format_cb()
@@ -1603,7 +1623,7 @@ bool camera_is_supported_media_packet_preview_cb(camera_h camera);
* This function should be called before previewing (see camera_start_preview()).\n
* A registered callback is called on the internal thread of the camera.\n
* A video frame can be retrieved using a registered callback,\n
- * and the buffer is only available in a registerd callback.\n
+ * and the buffer is only available in a registered callback.\n
* Since tizen 3.0, if you change the buffer in a registered callback,\n
* it could not be displayed on the device in case of copied buffer.\n
* and if camera_is_supported_media_packet_preview_cb() returns false,\n
@@ -1644,7 +1664,7 @@ int camera_unset_preview_cb(camera_h camera);
* A registered callback is called on the internal thread of the camera.\n
* A video frame can be retrieved using a registered callback as a media packet.\n
* The callback function holds the same buffer that will be drawn on the display device.\n
- * So if you change the media packet in a registerd callback, it will be displayed on the device\n
+ * So if you change the media packet in a registered callback, it will be displayed on the device\n
* and the media packet is available until it's destroyed by media_packet_destroy().
* @param[in] camera The handle to the camera
* @param[in] callback The callback function to be registered
@@ -1937,6 +1957,18 @@ 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_mode() will invoke this callback.
+ * @see camera_attr_foreach_supported_ptz_mode()
+ */
+typedef bool (*camera_attr_supported_ptz_type_cb)(camera_attr_ptz_type_e type, void *user_data);
+
+
+/**
* @}
*/
@@ -1998,7 +2030,7 @@ int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps);
* @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_fps_cb() repeatly to get each supported FPS mode.
+ * @post This function invokes camera_attr_supported_fps_cb() repeatedly to get each supported FPS mode.
* @see camera_attr_set_preview_fps()
* @see camera_attr_get_preview_fps()
* @see camera_attr_supported_fps_cb()
@@ -2020,7 +2052,7 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps
* @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_fps_cb() repeatly to get each supported FPS mode.
+ * @post This function invokes camera_attr_supported_fps_cb() repeatedly to get each supported FPS mode.
* @see camera_attr_set_preview_fps()
* @see camera_attr_get_preview_fps()
* @see camera_attr_supported_fps_cb()
@@ -2492,7 +2524,7 @@ int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mod
* @brief Gets the theater mode.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] camera The handle to the camera
- * @param[in] mode Currnet theater mode
+ * @param[in] mode Current theater mode
* @return @c 0 on success, otherwise a negative error value
* @retval #CAMERA_ERROR_NONE Successful
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
@@ -3508,6 +3540,191 @@ bool camera_attr_is_supported_auto_contrast(camera_h camera);
int camera_attr_disable_shutter_sound(camera_h camera, bool disable);
/**
+ * @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
+ * @see camera_attr_get_pan()
+ * @see camera_attr_get_pan_range()
+ */
+int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e 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
+ * @see camera_attr_set_pan()
+ * @see camera_attr_get_pan_range()
+ */
+int 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
+ * @see camera_attr_set_pan()
+ * @see camera_attr_get_pan()
+ */
+int 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
+ * @see camera_attr_get_tilt()
+ * @see camera_attr_get_tilt_range()
+ */
+int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e 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
+ * @see camera_attr_set_tilt()
+ * @see camera_attr_get_tilt_range()
+ */
+int 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
+ * @see camera_attr_set_tilt()
+ * @see camera_attr_get_tilt()
+ */
+int 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
+ * @see camera_attr_get_pan()
+ * @see camera_attr_set_pan()
+ * @see camera_attr_get_pan_range()
+ * @see camera_attr_get_tilt()
+ * @see camera_attr_set_tilt()
+ * @see camera_attr_get_tilt_range()
+ * @see camera_attr_foreach_supported_ptz_type()
+ */
+int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e 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 camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb callback, 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 camera_set_display_mode().
+ * @param[in] camera The handle to the camera
+ * @param[in] x X coordinate of area
+ * @param[in] y Y coordinate of area
+ * @param[in] width Width of area
+ * @param[in] height Height of 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
+ * @see camera_attr_get_display_roi_area()
+ */
+int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height);
+
+/**
+ * @brief Gets the ROI(Region Of Interest) area of display.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[out] x X coordinate of area
+ * @param[out] y Y coordinate of area
+ * @param[out] width Width of area
+ * @param[out] height Height of 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
+ * @see camera_attr_set_display_roi_area()
+ */
+int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height);
+
+/**
* @}
*/
#ifdef __cplusplus
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index d446b7b..68df13c 100644
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -3,7 +3,7 @@
Name: capi-media-camera
Summary: A Camera API
-Version: 0.2.53
+Version: 0.2.54
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index 26cfc1b..c63561d 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -1235,6 +1235,17 @@ static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, mus
LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
}
break;
+ case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
+ muse_camera_msg_get(param1, recv_msg);
+
+ LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);
+
+ if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
+ cb_info->user_cb[event] = NULL;
+ cb_info->user_data[event] = NULL;
+ LOGD("stop foreach callback for SUPPORTED_PTZ_TYPE");
+ }
+ break;
case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
{
camera_image_data_s *rImage = NULL;
@@ -3109,7 +3120,7 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
return CAMERA_ERROR_INVALID_PARAMETER;
}
- if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
+ if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
LOGE("Invalid mode %d", mode);
return CAMERA_ERROR_INVALID_PARAMETER;
}
@@ -5177,6 +5188,7 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
return ret;
}
+
int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
{
int sock_fd = -1;
@@ -5247,6 +5259,7 @@ Exit:
return ret;
}
+
int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
{
if (camera == NULL || foreach_cb == NULL) {
@@ -6069,3 +6082,322 @@ int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
LOGD("ret : 0x%x", ret);
return ret;
}
+
+
+int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
+{
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int set_move_type = (int)move_type;
+ int set_pan_step = pan_step;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int 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;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int get_pan_step;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
+ *pan_step = get_pan_step;
+ }
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int 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;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int get_min;
+ int get_max;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
+ muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
+ *min = get_min;
+ *max = get_max;
+ }
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
+{
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int set_move_type = (int)move_type;
+ int set_tilt_step = tilt_step;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int 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;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int get_tilt_step;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
+ *tilt_step = get_tilt_step;
+ }
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int 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;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int get_min;
+ int get_max;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
+ muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
+ *min = get_min;
+ *max = get_max;
+ }
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
+{
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int set_ptz_type = (int)ptz_type;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
+
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int 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 ret = CAMERA_ERROR_NONE;
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
+ int sock_fd;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+ sock_fd = pc->cb_info->fd;
+ LOGD("Enter, handle :%x", pc->remote_handle);
+ pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
+ pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
+
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+ LOGD("ret : 0x%x", ret);
+ return ret;
+}
+
+
+int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
+{
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int set_display_roi_area[4] = {x, y, width, height};
+ muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
+
+ if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
+ g_mutex_lock(&pc->cb_info->evas_mutex);
+
+ ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
+
+ g_mutex_unlock(&pc->cb_info->evas_mutex);
+
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+ } else {
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
+ set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
+ LOGD("ret : 0x%x", ret);
+ }
+
+ return ret;
+}
+
+
+int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
+{
+ if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = CAMERA_ERROR_NONE;
+ int sock_fd = pc->cb_info->fd;
+ int get_display_roi_area[4] = {0,};
+ muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
+
+ if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
+ g_mutex_lock(&pc->cb_info->evas_mutex);
+
+ ret = mm_evas_renderer_get_roi_area(pc->cb_info->evas_info, x, y, width, height);
+
+ g_mutex_unlock(&pc->cb_info->evas_mutex);
+
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_evas_renderer_get_roi_area error 0x%x", ret);
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+ } else {
+ LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
+ *x = get_display_roi_area[0];
+ *y = get_display_roi_area[1];
+ *width = get_display_roi_area[2];
+ *height = get_display_roi_area[3];
+
+ LOGD("ret : 0x%x", ret);
+ } else {
+ LOGE("Returned value is not valid : 0x%x", ret);
+ }
+ }
+
+ return ret;
+}
diff --git a/test/camera_test.c b/test/camera_test.c
index a4d0d3e..c9ec498 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -712,6 +712,7 @@ static void print_menu()
g_print("\t 't' Color tone \n");
g_print("\t 'd' WDR \n");
g_print("\t 'e' EV program mode \n");
+ g_print("\t 'R' Display ROI area \n");
g_print("\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc.]\n");
g_print("\t 'z' Strobe (Flash) \n");
g_print("\t 'S' Strobe (Flash) state\n");
@@ -720,6 +721,7 @@ static void print_menu()
g_print("\t 'k' Anti-handshake \n");
g_print("\t 'K' Video-stabilization \n");
g_print("\t 'u' Touch AF area \n");
+
g_print("\t 'b' back\n");
g_print("\t=======================================\n");
break;
@@ -1068,6 +1070,21 @@ static void setting_menu(gchar buf)
err = scanf("%d", &idx);
bret = camera_attr_set_scene_mode(hcamcorder->camera, idx);
break;
+ case 'R': /* Setting > Display ROI area */
+ g_print("* Set display roi area. Select x y width height \n");
+ flush_stdin();
+ err = scanf("%d %d %d %d", &x, &y, &width, &height);
+ camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_CUSTOM_ROI);
+ err = camera_attr_set_display_roi_area(hcamcorder->camera, x, y, width, height);
+ if (CAMERA_ERROR_NONE != err)
+ g_print("* Error : %d\n", err);
+
+ err = camera_attr_get_display_roi_area(hcamcorder->camera, &x, &y, &width, &height);
+ if (CAMERA_ERROR_NONE == err)
+ g_print("Current display roi area : x %d, y %d, width %d, height %d\n", x, y, width, height);
+ else
+ g_print("* Error : %d\n", err);
+ break;
/* ext. setting */
case 'z': /* Setting > Strobe setting */