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

Niklas Söderlund niklas.soderlund at ragnatech.se
Tue Feb 5 01:07:01 CET 2019


From: Kieran Bingham <kieran.bingham at 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 at ideasonboard.com>
---
 src/libcamera/pipeline/uvcvideo.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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;
 }
 
-- 
2.20.1



More information about the libcamera-devel mailing list