libcamera: Refactor the camera configuration storage and API

Refactor the CameraConfiguration structure to not rely on Stream
instances. This is a step towards making the camera configuration object
more powerful with configuration validation using "try" semantics.

The CameraConfiguration now exposes a simple vector-like API to access
the contained stream configurations. Both operator[]() and at() are
provided to access elements. The isEmpty() method is renamed to empty()
and the methods reordered to match the std::vector class.

As applications need access to the Stream instances associated with the
configuration entries in order to associate buffers with streams when
creating requests, expose the stream selected by the pipeline handler
through a new StreamConfiguration::stream().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart 2019-04-29 15:15:23 +03:00
parent a40023e6cc
commit 77ae64eb24
14 changed files with 258 additions and 225 deletions

View file

@ -20,7 +20,7 @@ protected:
{
CameraConfiguration config =
camera_->generateConfiguration({ StreamRole::VideoRecording });
StreamConfiguration *cfg = &config[config.front()];
StreamConfiguration *cfg = &config[0];
if (!config.isValid()) {
cout << "Failed to read default configuration" << endl;