diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-07-24 15:16:57 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-07-27 17:31:13 +0200 |
commit | ed734693350220f38aab768aee5e106b92dc9eb9 (patch) | |
tree | 85ae837edd9d0433fc3902a61c5acf7703d663db /src/cam/capture.cpp | |
parent | 01ea694003094b51bd96883055b11e52a011bef9 (diff) |
cam: capture: Cache the EventLoop handler
Prepare for the ability to exit the event loop based on conditions in
the request complete handler by caching the pointer instead of passing
it as an argument.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/capture.cpp')
-rw-r--r-- | src/cam/capture.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 55fa2dab..f811a18c 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -16,12 +16,13 @@ using namespace libcamera; -Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config) - : camera_(camera), config_(config), writer_(nullptr) +Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config, + EventLoop *loop) + : camera_(camera), config_(config), writer_(nullptr), loop_(loop) { } -int Capture::run(EventLoop *loop, const OptionsParser::Options &options) +int Capture::run(const OptionsParser::Options &options) { int ret; @@ -54,7 +55,7 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options) FrameBufferAllocator *allocator = new FrameBufferAllocator(camera_); - ret = capture(loop, allocator); + ret = capture(allocator); if (options.isSet(OptFile)) { delete writer_; @@ -66,7 +67,7 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options) return ret; } -int Capture::capture(EventLoop *loop, FrameBufferAllocator *allocator) +int Capture::capture(FrameBufferAllocator *allocator) { int ret; @@ -132,7 +133,7 @@ int Capture::capture(EventLoop *loop, FrameBufferAllocator *allocator) } std::cout << "Capture until user interrupts by SIGINT" << std::endl; - ret = loop->exec(); + ret = loop_->exec(); if (ret) std::cout << "Failed to run capture loop" << std::endl; |