[libcamera-devel] [PATCH v2 04/21] qcam: main_window: Move request queuing to a separate function
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Mar 23 18:35:42 CET 2020
Requests are requeued synchronously from the completion handler. To
prepare for delayed requeuing, move the queuing to a separate function.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/qcam/main_window.cpp | 29 +++++++++++++++--------------
src/qcam/main_window.h | 1 +
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index e0668176e427..354a53367d0f 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -389,20 +389,7 @@ void MainWindow::requestComplete(Request *request)
display(buffer);
- request = camera_->createRequest();
- if (!request) {
- std::cerr << "Can't create request" << std::endl;
- return;
- }
-
- for (auto it = buffers.begin(); it != buffers.end(); ++it) {
- Stream *stream = it->first;
- FrameBuffer *buffer = it->second;
-
- request->addBuffer(stream, buffer);
- }
-
- camera_->queueRequest(request);
+ queueRequest(buffer);
}
int MainWindow::display(FrameBuffer *buffer)
@@ -417,3 +404,17 @@ int MainWindow::display(FrameBuffer *buffer)
return 0;
}
+
+void MainWindow::queueRequest(FrameBuffer *buffer)
+{
+ Request *request = camera_->createRequest();
+ if (!request) {
+ std::cerr << "Can't create request" << std::endl;
+ return;
+ }
+
+ Stream *stream = config_->at(0).stream();
+ request->addBuffer(stream, buffer);
+
+ camera_->queueRequest(request);
+}
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 40aa10aaea8e..720a3393e3dc 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -58,6 +58,7 @@ private:
void requestComplete(Request *request);
int display(FrameBuffer *buffer);
+ void queueRequest(FrameBuffer *buffer);
QString title_;
QTimer titleTimer_;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list