From 98edf29e012cce6a3c0a428e3d78490780c1a824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 5 Feb 2019 12:47:59 +0100 Subject: libcamera: camera: Cache the stream configuration in the stream object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API towards the application and pipeline handler can be simplified if the camera caches which streams have been selected and their respective configuration. Signed-off-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- include/libcamera/camera.h | 1 + src/libcamera/camera.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 36bf1cbb..1c0ee07c 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -55,6 +55,7 @@ private: std::shared_ptr pipe_; std::string name_; std::vector streams_; + std::vector activeStreams_; bool acquired_; bool disconnected_; diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 62291d2c..3f7b805b 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -253,7 +253,20 @@ int Camera::configureStreams(std::map &config) return -EINVAL; } - return pipe_->configureStreams(this, config); + ret = pipe_->configureStreams(this, config); + if (ret) + return ret; + + activeStreams_.clear(); + for (auto const &iter : config) { + Stream *stream = iter.first; + const StreamConfiguration &cfg = iter.second; + + stream->configuration_ = cfg; + activeStreams_.push_back(stream); + } + + return 0; } int Camera::exclusiveAccess() -- cgit v1.2.1