summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2023-03-21 15:52:22 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2023-03-28 12:14:33 +0900
commit687bafe44f6c0716998742fc701788ba82179540 (patch)
treea65884c2dfb9f80f6d92ba4245bced769d10d730
parent24a350ae260cfe50ca25e0bb3467cefd43f03136 (diff)
downloadcamera-accepted/tizen/7.0/unified/20230330.014257.tar.gz
camera-accepted/tizen/7.0/unified/20230330.014257.tar.bz2
camera-accepted/tizen/7.0/unified/20230330.014257.zip
Add new internal API to get meta timestampaccepted/tizen/7.0/unified/20230330.014257
[Version] 0.4.98 [Issue Type] New feature Change-Id: Id54842c6fea4bc2fd02ce413c0df9114c0f1722e Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--include/camera_internal.h44
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c7
-rw-r--r--src/camera_internal.c31
-rw-r--r--test/camera_test.c18
5 files changed, 96 insertions, 6 deletions
diff --git a/include/camera_internal.h b/include/camera_internal.h
index 913539d..4de519e 100644
--- a/include/camera_internal.h
+++ b/include/camera_internal.h
@@ -39,11 +39,35 @@ extern "C" {
#define CAMERA_DEVICE_MAX ((CAMERA_DEVICE_CAMERA9 + 1) * 2)
+/**
+ * @internal
+ * @brief The structure type of the camera device list.
+ * @since_tizen 6.0
+ */
typedef struct _camera_device_list_s {
unsigned int count;
camera_device_s device[CAMERA_DEVICE_MAX];
} camera_device_list_s;
+/**
+ * @internal
+ * @brief The structure type of the meta timestamp.
+ * @since_tizen 7.0
+ * @remarks This is available for specific device only.
+ */
+typedef struct _camera_meta_timestamp_s {
+ unsigned long long ts_soe;
+ unsigned long long ts_eoe;
+ unsigned long long ts_sof;
+ unsigned long long ts_eof;
+ unsigned long long ts_hal;
+ unsigned long long ts_qmf;
+ unsigned long long ts_gst;
+ unsigned long long td_exp;
+ unsigned long long ts_aux;
+ unsigned long long td_aux;
+} camera_meta_timestamp_s;
+
/**
* @internal
@@ -256,9 +280,9 @@ int camera_request_codec_config(camera_h camera);
* @internal
* @brief Gets the timestamp of preview frame in nano second.
* @since_tizen 7.0
- * @remarks The function should be called in camera_preview_cb(),\n
+ * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
* otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
- * @param[in] camera The handle to the camera
+ * @param[in] camera The handle to the camera
* @param[out] timestamp The timestamp of preview frame (in nsec)
* @return @c 0 on success, otherwise a negative error value
* @retval #CAMERA_ERROR_NONE Successful
@@ -268,6 +292,22 @@ int camera_request_codec_config(camera_h camera);
int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *timestamp);
/**
+ * @internal
+ * @brief Gets the meta timestamp of preview frame in nano second.
+ * @since_tizen 7.0
+ * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
+ * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
+ * @param[in] camera The handle to the camera
+ * @param[out] meta_timestamp The meta timestamp of preview frame (in nsec)
+ * @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
+ */
+int camera_attr_get_preview_frame_meta_timestamp(camera_h camera, camera_meta_timestamp_s *meta_timestamp);
+
+
+/**
* @}
*/
#ifdef __cplusplus
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 624636c..ba29c34 100644
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -1,6 +1,6 @@
Name: capi-media-camera
Summary: A Camera API
-Version: 0.4.97
+Version: 0.4.98
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index a0a07e9..d3a4672 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -425,6 +425,13 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
/* get stream info */
stream = (MMCamcorderVideoStreamDataType *)buf_pos;
+ CAM_LOG_VERBOSE("meta ts: [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu]",
+ stream->ts_soe, stream->ts_eoe,
+ stream->ts_sof, stream->ts_eof,
+ stream->ts_hal, stream->ts_qmf,
+ stream->ts_gst, stream->td_exp,
+ stream->ts_aux, stream->td_aux);
+
if (num_buffer_fd == 0 && CAMERA_IS_FD_VALID(tfd[1])) {
/* import tbm data_bo and get virtual address */
if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[1], &data_bo, &data_bo_handle)) {
diff --git a/src/camera_internal.c b/src/camera_internal.c
index fe5468b..f6b2be0 100644
--- a/src/camera_internal.c
+++ b/src/camera_internal.c
@@ -400,4 +400,35 @@ int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *time
return CAMERA_ERROR_NONE;
}
+
+
+int camera_attr_get_preview_frame_meta_timestamp(camera_h camera, camera_meta_timestamp_s *meta_timestamp)
+{
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ MMCamcorderVideoStreamDataType *stream = NULL;
+
+ if (!pc || !pc->cb_info || !meta_timestamp) {
+ CAM_LOG_ERROR("NULL pointer %p %p", pc, meta_timestamp);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ stream = pc->cb_info->stream_data;
+ if (!stream) {
+ CAM_LOG_ERROR("no stream data, maybe it's not in preview callback");
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+
+ meta_timestamp->ts_soe = stream->ts_soe;
+ meta_timestamp->ts_eoe = stream->ts_eoe;
+ meta_timestamp->ts_sof = stream->ts_sof;
+ meta_timestamp->ts_eof = stream->ts_eof;
+ meta_timestamp->ts_hal = stream->ts_hal;
+ meta_timestamp->ts_qmf = stream->ts_qmf;
+ meta_timestamp->ts_gst = stream->ts_gst;
+ meta_timestamp->td_exp = stream->td_exp;
+ meta_timestamp->ts_aux = stream->ts_aux;
+ meta_timestamp->td_aux = stream->td_aux;
+
+ return CAMERA_ERROR_NONE;
+}
//LCOV_EXCL_STOP
diff --git a/test/camera_test.c b/test/camera_test.c
index bca41fe..ac1fc8b 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -460,6 +460,7 @@ static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
camera_h cam_handle = (camera_h)user_data;
camera_rotation_e rotation = CAMERA_ROTATION_NONE;
unsigned long timestamp = 0;
+ camera_meta_timestamp_s meta_timestamp = {0, };
if (!cam_handle || !frame) {
g_print("\n[PREVIEW_CB] NULL param! %p %p\n", cam_handle, frame);
@@ -471,11 +472,22 @@ static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
g_print("[PREVIEW_CB] get preview frame rotation failed[0x%x]\n", ret);
ret = camera_attr_get_preview_frame_timestamp(cam_handle, &timestamp);
- if (ret != CAMERA_ERROR_NONE)
+ if (ret == CAMERA_ERROR_NONE)
+ g_print("[PREVIEW_CB] preview[rotation:%d,timestamp:%lu] callback\n", rotation, timestamp);
+ else
g_print("[PREVIEW_CB] get preview frame timestamp failed[0x%x]\n", ret);
- g_print("[PREVIEW_CB] preview[rotation:%d,timestamp:%lu] callback\n",
- rotation, timestamp);
+ ret = camera_attr_get_preview_frame_meta_timestamp(cam_handle, &meta_timestamp);
+ if (ret == CAMERA_ERROR_NONE) {
+ g_print("[PREVIEW_CB] meta %llu,%llu,%llu,%llu,%llu,%llu,%llu,%llu,%llu,%llu\n",
+ meta_timestamp.ts_soe, meta_timestamp.ts_eoe,
+ meta_timestamp.ts_sof, meta_timestamp.ts_eof,
+ meta_timestamp.ts_hal, meta_timestamp.ts_qmf,
+ meta_timestamp.ts_gst, meta_timestamp.td_exp,
+ meta_timestamp.ts_aux, meta_timestamp.td_aux);
+ } else {
+ g_print("[PREVIEW_CB] get preview frame meta timestamp failed[0x%x]\n", ret);
+ }
_camera_print_preview_info(frame);