summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-10-27 21:20:10 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-11-20 17:19:58 +0100
commit1d32f21136c641318e78b1ba6f075d8865cd51c1 (patch)
treee331407b27f30e0c954e82fbd7fd1d2e4581931c /src
parentbcf42994530a0112ac250a1640562edc16353299 (diff)
cam: Store camera as shared pointer everywhere
Do not store the camera raw pointer in the capture class, this will prevent forwarding the shared pointer in the future. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/cam/capture.cpp2
-rw-r--r--src/cam/capture.h4
-rw-r--r--src/cam/main.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index 27332df1..e665d819 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -16,7 +16,7 @@
using namespace libcamera;
-Capture::Capture(Camera *camera, CameraConfiguration *config)
+Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config)
: camera_(camera), config_(config), writer_(nullptr)
{
}
diff --git a/src/cam/capture.h b/src/cam/capture.h
index 4d396afb..c692d489 100644
--- a/src/cam/capture.h
+++ b/src/cam/capture.h
@@ -21,7 +21,7 @@
class Capture
{
public:
- Capture(libcamera::Camera *camera,
+ Capture(std::shared_ptr<libcamera::Camera> camera,
libcamera::CameraConfiguration *config);
int run(EventLoop *loop, const OptionsParser::Options &options);
@@ -30,7 +30,7 @@ private:
void requestComplete(libcamera::Request *request);
- libcamera::Camera *camera_;
+ std::shared_ptr<libcamera::Camera> camera_;
libcamera::CameraConfiguration *config_;
std::map<libcamera::Stream *, std::string> streamName_;
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 9d99f558..a38cca95 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -319,7 +319,7 @@ int CamApp::run()
}
if (options_.isSet(OptCapture)) {
- Capture capture(camera_.get(), config_.get());
+ Capture capture(camera_, config_.get());
return capture.run(loop_, options_);
}