[libcamera-devel,SimpleCam,1/2] simple-cam: processRequest: Report timestamp and enhance description
diff mbox series

Message ID 20220216123544.637834-2-kieran.bingham@ideasonboard.com
State Accepted
Delegated to: Kieran Bingham
Headers show
Series
  • Extend Request metadata reporting
Related show

Commit Message

Kieran Bingham Feb. 16, 2022, 12:35 p.m. UTC
Report the timestamp of the completed buffers when the processRequest()
call handles a request and improve the description to discuss more of
the operations that can be done here.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 simple-cam.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Paul Elder Feb. 25, 2022, 10:29 a.m. UTC | #1
Hi Kieran,

On Wed, Feb 16, 2022 at 12:35:43PM +0000, Kieran Bingham wrote:
> Report the timestamp of the completed buffers when the processRequest()
> call handles a request and improve the description to discuss more of
> the operations that can be done here.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  simple-cam.cpp | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/simple-cam.cpp b/simple-cam.cpp
> index 71a715a0c27d..e282463c3976 100644
> --- a/simple-cam.cpp
> +++ b/simple-cam.cpp
> @@ -46,8 +46,17 @@ static void requestComplete(Request *request)
>  
>  static void processRequest(Request *request)
>  {
> +	/*
> +	 * Each buffer has its own FrameMetadata to describe its state, or the
> +	 * usage of each buffer. While in our simple capture we only provide one
> +	 * buffer per request, a request can have a buffer for each stream that
> +	 * is established when configuring the camera.
> +	 *
> +	 * This allows a viewfinder and a still image to be processed at the
> +	 * same time, or to allow obtaining the RAW capture buffer from the
> +	 * sensor along with the image as processed by the ISP.
> +	 */
>  	const Request::BufferMap &buffers = request->buffers();
> -
>  	for (auto bufferPair : buffers) {
>  		// (Unused) Stream *stream = bufferPair.first;
>  		FrameBuffer *buffer = bufferPair.second;
> @@ -55,6 +64,7 @@ static void processRequest(Request *request)
>  
>  		/* Print some information about the buffer which has completed. */
>  		std::cout << " seq: " << std::setw(6) << std::setfill('0') << metadata.sequence
> +			  << " timestamp: " << metadata.timestamp
>  			  << " bytesused: ";
>  
>  		unsigned int nplane = 0;
> -- 
> 2.32.0
>

Patch
diff mbox series

diff --git a/simple-cam.cpp b/simple-cam.cpp
index 71a715a0c27d..e282463c3976 100644
--- a/simple-cam.cpp
+++ b/simple-cam.cpp
@@ -46,8 +46,17 @@  static void requestComplete(Request *request)
 
 static void processRequest(Request *request)
 {
+	/*
+	 * Each buffer has its own FrameMetadata to describe its state, or the
+	 * usage of each buffer. While in our simple capture we only provide one
+	 * buffer per request, a request can have a buffer for each stream that
+	 * is established when configuring the camera.
+	 *
+	 * This allows a viewfinder and a still image to be processed at the
+	 * same time, or to allow obtaining the RAW capture buffer from the
+	 * sensor along with the image as processed by the ISP.
+	 */
 	const Request::BufferMap &buffers = request->buffers();
-
 	for (auto bufferPair : buffers) {
 		// (Unused) Stream *stream = bufferPair.first;
 		FrameBuffer *buffer = bufferPair.second;
@@ -55,6 +64,7 @@  static void processRequest(Request *request)
 
 		/* Print some information about the buffer which has completed. */
 		std::cout << " seq: " << std::setw(6) << std::setfill('0') << metadata.sequence
+			  << " timestamp: " << metadata.timestamp
 			  << " bytesused: ";
 
 		unsigned int nplane = 0;