[libcamera-devel] [PATCH v2 09/10] cam: Store camera as shared pointer everywhere
Niklas Söderlund
niklas.soderlund at ragnatech.se
Wed Nov 20 02:55:05 CET 2019
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 at ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/cam/capture.cpp | 2 +-
src/cam/capture.h | 4 ++--
src/cam/main.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index 27332df1d55a5c2d..e665d819fb777a90 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 4d396afb8c771a74..c692d48918f2de1d 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 9d99f5587cbb77d0..a38cca959aca05ff 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_);
}
--
2.24.0
More information about the libcamera-devel
mailing list