@@ -38,7 +38,8 @@ public:
virtual ~CameraConfiguration();
- void addConfiguration(const StreamConfiguration &cfg);
+ StreamConfiguration &addConfiguration(const StreamConfiguration &cfg);
+
virtual Status validate() = 0;
StreamConfiguration &at(unsigned int index);
@@ -104,10 +104,18 @@ CameraConfiguration::~CameraConfiguration()
/**
* \brief Add a stream configuration to the camera configuration
* \param[in] cfg The stream configuration
+ *
+ * This method adds a new stream configuration to the CameraConfiguration using
+ * the values given in cfg, which are copied. A reference to the destination
+ * new StreamConfiguration is returned.
+ *
+ * \return A reference to the newly added stream configuration
*/
-void CameraConfiguration::addConfiguration(const StreamConfiguration &cfg)
+StreamConfiguration &CameraConfiguration::addConfiguration(const StreamConfiguration &cfg)
{
config_.push_back(cfg);
+
+ return config_.back();
}
/**
Facilitate easily referencing of the newly added StreamConfiguration as the source structure is copied, and not used after it has been added. This simplifies the caller, and allows the caller to compare the structure it passed to add, and the newly added configuration after validate() has been called. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- include/libcamera/camera.h | 3 ++- src/libcamera/camera.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)