summaryrefslogtreecommitdiff
path: root/test/camera
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-29 15:15:23 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-05-23 00:27:14 +0300
commit77ae64eb24bf6c2fe241b6f7b841315b1ee15707 (patch)
tree7c85eba53482bf3212644acc7b02796dea2a3b48 /test/camera
parenta40023e6cc005dfc57cc535167ee44761f3ed9f6 (diff)
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>
Diffstat (limited to 'test/camera')
-rw-r--r--test/camera/capture.cpp4
-rw-r--r--test/camera/configuration_set.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index e7e64382..bfd11eef 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -44,8 +44,7 @@ protected:
{
CameraConfiguration config =
camera_->generateConfiguration({ StreamRole::VideoRecording });
- Stream *stream = config.front();
- StreamConfiguration *cfg = &config[stream];
+ StreamConfiguration *cfg = &config[0];
if (!config.isValid()) {
cout << "Failed to read default configuration" << endl;
@@ -67,6 +66,7 @@ protected:
return TestFail;
}
+ Stream *stream = cfg->stream();
BufferPool &pool = stream->bufferPool();
std::vector<Request *> requests;
for (Buffer &buffer : pool.buffers()) {
diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp
index 76d8bc3e..25b5db67 100644
--- a/test/camera/configuration_set.cpp
+++ b/test/camera/configuration_set.cpp
@@ -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;