From 77ea51820acccfcd3aebe6aa27ad26af21e82a7a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 22 Mar 2020 17:17:42 +0200 Subject: 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 Reviewed-by: Kieran Bingham --- src/qcam/main_window.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/qcam/main_window.h') 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 #include +#include #include +#include #include #include @@ -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 doneQueue_; + QToolBar *toolbar_; ViewFinder *viewfinder_; std::map> mappedBuffers_; -- cgit v1.2.1