From 9a7dc3ce7f4253578a0f7c0d58417425c8155cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 5 Apr 2019 01:23:23 +0200 Subject: libcamera: camera: Add CameraConfiguration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To properly support both multiple streams and stream usages the library must provide a method to map the stream usages to the returned streams configurations. Add a camera configuration object to handle this mapping. Applications can iterate over the returned camera configuration to retrieve the streams selected by the library in the same order as the usages it provided to the library. Applications can use the operator[] to retrieve the stream pointer and the stream configuration. Using a numerical index retrieves the stream pointer, the numerical indexes corresponds to the insertion order of usages in the CameraConfiguration, using the stream pointer retrieves the stream's configuration. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/camera.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include') diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 0386671c..6038da63 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -24,6 +24,35 @@ class Stream; class StreamConfiguration; class StreamUsage; +class CameraConfiguration +{ +public: + using iterator = std::vector::iterator; + using const_iterator = std::vector::const_iterator; + + CameraConfiguration(); + + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + + bool isValid() const; + bool isEmpty() const; + std::size_t size() const; + + Stream *front(); + const Stream *front() const; + + Stream *operator[](unsigned int index) const; + StreamConfiguration &operator[](Stream *stream); + const StreamConfiguration &operator[](Stream *stream) const; + +private: + std::vector order_; + std::map config_; +}; + class Camera final { public: -- cgit v1.2.1