summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-22 17:17:42 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-24 10:33:44 +0200
commit77ea51820acccfcd3aebe6aa27ad26af21e82a7a (patch)
tree717d9b20c97cac88311de65db348659b1fbeb295 /src/qcam/main_window.h
parent8e7d1bbe9b6d98a443da4982fe088321e6d4a583 (diff)
qcam: main_window: Move capture event processing to main thread
To avoid blocking the camera manager for a long amount of time, move capture event processing to the main thread. Captured buffers are added to a queue and an event is posted to the main window to signal availability of a buffer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/main_window.h')
-rw-r--r--src/qcam/main_window.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 720a3393..c623120d 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -11,7 +11,9 @@
#include <QElapsedTimer>
#include <QMainWindow>
+#include <QMutex>
#include <QObject>
+#include <QQueue>
#include <QTimer>
#include <libcamera/buffer.h>
@@ -40,6 +42,8 @@ public:
MainWindow(CameraManager *cm, const OptionsParser::Options &options);
~MainWindow();
+ bool event(QEvent *e) override;
+
private Q_SLOTS:
void quit();
void updateTitle();
@@ -57,6 +61,7 @@ private:
int openCamera();
void requestComplete(Request *request);
+ void processCapture();
int display(FrameBuffer *buffer);
void queueRequest(FrameBuffer *buffer);
@@ -78,6 +83,9 @@ private:
uint32_t previousFrames_;
uint32_t framesCaptured_;
+ QMutex mutex_;
+ QQueue<FrameBuffer *> doneQueue_;
+
QToolBar *toolbar_;
ViewFinder *viewfinder_;
std::map<int, std::pair<void *, unsigned int>> mappedBuffers_;