summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-04-18 16:11:06 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-05-06 15:09:18 +0200
commit922833f774f69b9c7b378379bfa6770ff0380a1a (patch)
treed68a33f4689055ff649d999648bc506bb3cd8393 /src
parent62f53a0f2277862251a838ab915563e3a2219cce (diff)
libcamera: simple: Report sensor timestamp
Report the sensor's timestamp in the Request metadata using the completed buffer timestamp. The buffer's timestamp is recorded at DMA-transfer time, and it does not theoretically matches the 'start of exposure' definition. Record this with a \todo entry. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index f6095d38..e1ee640b 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -22,6 +22,7 @@
#include <linux/media-bus-format.h>
#include <libcamera/camera.h>
+#include <libcamera/control_ids.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
@@ -1117,6 +1118,16 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)
}
/*
+ * Record the sensor's timestamp in the request metadata.
+ *
+ * \todo The sensor timestamp should be better estimated by connecting
+ * to the V4L2Device::frameStart signal if the platform provides it.
+ */
+ Request *request = buffer->request();
+ request->metadata().set(controls::SensorTimestamp,
+ buffer->metadata().timestamp);
+
+ /*
* Queue the captured and the request buffer to the converter if format
* conversion is needed. If there's no queued request, just requeue the
* captured buffer for capture.
@@ -1133,7 +1144,6 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)
}
/* Otherwise simply complete the request. */
- Request *request = buffer->request();
completeBuffer(request, buffer);
completeRequest(request);
}