- A new internal API is added.
: camera_attr_get_preview_frame_rotation()
: It should be called in camera_preview_cb(),
otherwise, it will return CAMERA_ERROR_INVALID_OPERATION.
- A rotation method is set in media packet for preview frame.
It could be get with media_packet_get_rotate_method().
[Version] 0.4.65
[Issue Type] New feature
Change-Id: Ic728c4a9a6d285f6fb5ca570ee85bc4e53cfd859
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
int stride[BUFFER_MAX_PLANE_NUM]; /**< Stride of each plane */
int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
int extra_stream_id; /**< ID of extra preview stream */
+ int focus_state; /**< Focus state */
+ int facing_direction; /**< Facing direction */
+ int flip; /**< Flip */
+ int rotation; /**< Rotation */
} camera_stream_data_s;
int camera_attr_get_extra_preview_gop_interval(camera_h camera, int stream_id, int *interval);
/**
+ * @internal
+ * @brief Gets the rotation of preview frame.
+ * @since_tizen 6.5
+ * @remarks The function should be called in camera_preview_cb(),\n
+ * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
+ * @param[in] camera The handle to the camera
+ * @param[out] rotation The rotation of preview frame
+ * @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_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
+ */
+int camera_attr_get_preview_frame_rotation(camera_h camera, camera_rotation_e *rotation);
+
+/**
* @}
*/
#ifdef __cplusplus
/* media bridge */
media_bridge_h bridge;
GMutex bridge_lock;
+
+ /* preview stream */
+ camera_stream_data_s *stream_data;
} camera_cb_info_s;
typedef struct _camera_message_s {
Name: capi-media-camera
Summary: A Camera API
-Version: 0.4.64
+Version: 0.4.65
Release: 0
Group: Multimedia/API
License: Apache-2.0
cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]) {
camera_create_preview_frame(stream, num_buffer_fd, buffer_bo_handle, &data_bo_handle, &frame);
- if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] &&
- stream->extra_stream_id < 0) {
- ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
- cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
- }
+ /* set stream data for camera_get_preview_frame_rotation() */
+ cb_info->stream_data = stream;
- if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW] &&
- stream->extra_stream_id >= 0) {
- ((camera_extra_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW])(&frame,
- stream->extra_stream_id, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
+ if (stream->extra_stream_id < 0) {
+ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])
+ ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
+ cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
+ } else {
+ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW])
+ ((camera_extra_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW])(&frame,
+ stream->extra_stream_id, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
}
+
+ cb_info->stream_data = NULL;
}
if (stream->extra_stream_id >= 0)
if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
CAM_LOG_WARNING("media_packet_set_pts failed");
+ /* set rotation */
+ if (media_packet_set_rotate_method(pkt, (media_packet_rotate_method_e)stream->rotation) != MEDIA_PACKET_ERROR_NONE)
+ CAM_LOG_WARNING("media_packet_set_rotate_method failed");
+
CAM_LOG_VERBOSE("new media packet[%p], tbm surface[%p]", pkt, tsurf);
*packet = pkt;
return ret;
}
+
+int camera_attr_get_preview_frame_rotation(camera_h camera, camera_rotation_e *rotation)
+{
+ camera_cli_s *pc = (camera_cli_s *)camera;
+
+ if (!pc || !pc->cb_info || !rotation) {
+ CAM_LOG_ERROR("NULL pointer %p %p", pc, rotation);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!pc->cb_info->stream_data) {
+ CAM_LOG_ERROR("no stream data, maybe it's not in preview callback");
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+
+ *rotation = pc->cb_info->stream_data->rotation;
+
+ CAM_LOG_DEBUG("frame rotation[%d]", *rotation);
+
+ return CAMERA_ERROR_NONE;
+}
+
//LCOV_EXCL_STOP
static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
{
- if (!frame) {
- g_print("\n[PREVIEW_CB] NULL frame!\n");
+ int ret = CAMERA_ERROR_NONE;
+ camera_h cam_handle = (camera_h)user_data;
+ camera_rotation_e rotation = CAMERA_ROTATION_NONE;
+
+ if (!cam_handle || !frame) {
+ g_print("\n[PREVIEW_CB] NULL param! %p %p\n", cam_handle, frame);
return;
}
- g_print("[PREVIEW_CB] preview callback - ");
+ ret = camera_attr_get_preview_frame_rotation(cam_handle, &rotation);
+ if (ret != CAMERA_ERROR_NONE)
+ g_print("[PREVIEW_CB] get preview frame rotation failed[0x%x]\n", ret);
+
+ g_print("[PREVIEW_CB] preview[rotation:%d] callback - ", rotation);
_camera_print_preview_info(frame);