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
+ * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
+ * @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
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *timestamp);
+
+/**
* @}
*/
#ifdef __cplusplus
Name: capi-media-camera
Summary: A Camera API
-Version: 0.4.93
+Version: 0.4.94
Release: 0
Group: Multimedia/API
License: Apache-2.0
goto _PACKET_CREATE_FAILED;
}
- /* set timestamp : msec -> nsec */
- if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
+ if (media_packet_set_pts(pkt, stream->timestamp_nsec) != MEDIA_PACKET_ERROR_NONE)
CAM_LOG_WARNING("media_packet_set_pts failed");
if (media_packet_set_rotate_method(pkt, (media_packet_rotate_method_e)stream->rotation) != MEDIA_PACKET_ERROR_NONE)
return ret;
}
+
+
+int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *timestamp)
+{
+ camera_cli_s *pc = (camera_cli_s *)camera;
+
+ if (!pc || !pc->cb_info || !timestamp) {
+ CAM_LOG_ERROR("NULL pointer %p %p", pc, timestamp);
+ 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;
+ }
+
+ *timestamp = pc->cb_info->stream_data->timestamp_nsec;
+
+ CAM_LOG_DEBUG("frame timestamp[%lu]", *timestamp);
+
+ return CAMERA_ERROR_NONE;
+}
//LCOV_EXCL_STOP
int ret = CAMERA_ERROR_NONE;
camera_h cam_handle = (camera_h)user_data;
camera_rotation_e rotation = CAMERA_ROTATION_NONE;
+ unsigned long timestamp = 0;
if (!cam_handle || !frame) {
g_print("\n[PREVIEW_CB] NULL param! %p %p\n", cam_handle, frame);
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);
+ ret = camera_attr_get_preview_frame_timestamp(cam_handle, ×tamp);
+ if (ret != CAMERA_ERROR_NONE)
+ 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);
_camera_print_preview_info(frame);