[libcamera-devel,RFC,6/7] libcamera: pipeline: uvcvideo: Add queueRequest support

Message ID 20190205000702.15370-7-niklas.soderlund@ragnatech.se
State Superseded
Delegated to: Niklas Söderlund
Headers show
Series
  • libcamera: extend camera and pipeline to support requests
Related show

Commit Message

Niklas Söderlund Feb. 5, 2019, 12:07 a.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Extract the buffer from the Request bufferMap. The uvcvideo only supports a
single stream and so expects only a single buffer to queue.

Queue the retrieved buffer with the video device for processing.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/uvcvideo.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch

diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 3685dbf9d19c3d7d..632a4b4b09189240 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -6,6 +6,7 @@ 
  */
 
 #include <libcamera/camera.h>
+#include <libcamera/request.h>
 #include <libcamera/stream.h>
 
 #include "device_enumerator.h"
@@ -126,6 +127,19 @@  void PipelineHandlerUVC::stop(const Camera *camera)
 
 int PipelineHandlerUVC::queueRequest(const Camera *camera, Request *request)
 {
+	/* Set any controls, queue any buffers */
+
+	if (request->bufferMap.find(&stream_) == request->bufferMap.end()) {
+		LOG(UVC, Error)
+			<< "Attempt to queue request with invalid stream";
+
+		return -ENOENT;
+	}
+
+	Buffer *buffer = request->bufferMap[&stream_];
+
+	video_->queueBuffer(buffer);
+
 	return 0;
 }