From 922833f774f69b9c7b378379bfa6770ff0380a1a Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Sun, 18 Apr 2021 16:11:06 +0200 Subject: libcamera: simple: Report sensor timestamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/simple/simple.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/libcamera/pipeline') 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 #include +#include #include #include @@ -1116,6 +1117,16 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer) return; } + /* + * 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 @@ -1133,7 +1144,6 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer) } /* Otherwise simply complete the request. */ - Request *request = buffer->request(); completeBuffer(request, buffer); completeRequest(request); } -- cgit v1.2.1