summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-22 16:16:10 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-24 10:33:43 +0200
commit8e7d1bbe9b6d98a443da4982fe088321e6d4a583 (patch)
treec1245cacb9d79778c108ba2c135c123e509b7652
parentacd02afab0298bc91099fa280f13775e8e5e315b (diff)
qcam: main_window: Move request queuing to a separate function
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@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/qcam/main_window.cpp29
-rw-r--r--src/qcam/main_window.h1
2 files changed, 16 insertions, 14 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index e0668176..354a5336 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 40aa10aa..720a3393 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_;