diff --git a/core/libcamera_app.cpp b/core/libcamera_app.cpp index 233c9647..776b1431 100644 --- a/core/libcamera_app.cpp +++ b/core/libcamera_app.cpp @@ -136,7 +136,7 @@ void LibcameraApp::OpenCamera() if (ret) throw std::runtime_error("camera manager failed to start, code " + std::to_string(-ret)); - std::vector> cameras = LibcameraApp::GetCameras(camera_manager_); + std::vector> cameras = GetCameras(); if (cameras.size() == 0) throw std::runtime_error("no cameras available"); if (options_->camera >= cameras.size()) @@ -773,6 +773,11 @@ libcamera::Stream *LibcameraApp::GetMainStream() const return nullptr; } +const libcamera::CameraManager *LibcameraApp::GetCameraManager() const +{ + return camera_manager_.get(); +} + std::vector> LibcameraApp::Mmap(FrameBuffer *buffer) const { auto item = mapped_buffers_.find(buffer); diff --git a/core/libcamera_app.hpp b/core/libcamera_app.hpp index 94da5e90..20eb7f5c 100644 --- a/core/libcamera_app.hpp +++ b/core/libcamera_app.hpp @@ -119,6 +119,12 @@ class LibcameraApp Stream *LoresStream(StreamInfo *info = nullptr) const; Stream *GetMainStream() const; + const CameraManager *GetCameraManager() const; + std::vector> GetCameras() + { + return GetCameras(camera_manager_.get()); + } + std::vector> Mmap(FrameBuffer *buffer) const; void ShowPreview(CompletedRequestPtr &completed_request, Stream *stream); @@ -129,7 +135,7 @@ class LibcameraApp static unsigned int verbosity; static unsigned int GetVerbosity() { return verbosity; } - static std::vector> GetCameras(const std::unique_ptr &cm) + static std::vector> GetCameras(const CameraManager *cm) { std::vector> cameras = cm->cameras(); // Do not show USB webcams as these are not supported in libcamera-apps! diff --git a/core/options.cpp b/core/options.cpp index e42678ae..13d12b11 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -154,7 +154,7 @@ bool Options::Parse(int argc, char *argv[]) if (ret) throw std::runtime_error("camera manager failed to start, code " + std::to_string(-ret)); - std::vector> cameras = LibcameraApp::GetCameras(cm); + std::vector> cameras = LibcameraApp::GetCameras(cm.get()); if (cameras.size() != 0) { unsigned int idx = 0;