summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-27 20:49:11 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-04-05 22:07:47 +0200
commit20a6455e0b62575bb00136501f7f39f3e150d0d9 (patch)
tree9a82eb4191c5bcfe7bcaa75a852c1b7100c71950 /test
parent70e53be538984739d500ef641c262e79affdeac4 (diff)
libcamera: camera: Add support for stream usages
Instead of requesting the default configuration for a set of streams where the application has to figure out which streams provided by the camera is best suited for its intended usage, have the library figure this out by using stream usages. The application asks the library for a list of streams and a suggested default configuration for them by supplying a list of stream usages. Once the list is retrieved the application can fine-tune the returned configuration and then try to apply it to the camera. Currently no pipeline handler is prepared to handle stream usages but nor did it make use of the list of Stream IDs which was the previous interface. The main reason for this is that all cameras currently only provide one stream each. This will still be the case but the API will be prepared to expand both pipeline handlers and applications to support streams usages. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
-rw-r--r--test/camera/capture.cpp5
-rw-r--r--test/camera/configuration_default.cpp17
-rw-r--r--test/camera/configuration_set.cpp3
-rw-r--r--test/camera/statemachine.cpp4
4 files changed, 10 insertions, 19 deletions
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index f6932b75..b8dbdb62 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -42,10 +42,9 @@ protected:
int run()
{
- Stream *stream = *camera_->streams().begin();
- std::set<Stream *> streams = { stream };
std::map<Stream *, StreamConfiguration> conf =
- camera_->streamConfiguration(streams);
+ camera_->streamConfiguration({ Stream::VideoRecording() });
+ Stream *stream = conf.begin()->first;
StreamConfiguration *sconf = &conf.begin()->second;
if (!configurationValid(conf)) {
diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp
index 856cd415..09861716 100644
--- a/test/camera/configuration_default.cpp
+++ b/test/camera/configuration_default.cpp
@@ -20,14 +20,10 @@ protected:
{
std::map<Stream *, StreamConfiguration> conf;
- /*
- * Test that asking for default configuration for a valid
- * array of streams returns something valid.
- */
- std::set<Stream *> streams = { *camera_->streams().begin() };
- conf = camera_->streamConfiguration(streams);
+ /* Test asking for configuration for a video stream. */
+ conf = camera_->streamConfiguration({ Stream::VideoRecording() });
if (conf.empty()) {
- cout << "Failed to retrieve configuration for valid streams"
+ cout << "Failed to retrieve configuration for video streams"
<< endl;
return TestFail;
}
@@ -39,12 +35,11 @@ protected:
/*
* Test that asking for configuration for an empty array of
- * streams returns an empty list of configurations.
+ * stream usages returns an empty list of configurations.
*/
- std::set<Stream *> streams_empty = {};
- conf = camera_->streamConfiguration(streams_empty);
+ conf = camera_->streamConfiguration({});
if (!conf.empty()) {
- cout << "Failed to retrieve configuration for empty streams"
+ cout << "Failed to retrieve configuration for empty usage list"
<< endl;
return TestFail;
}
diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp
index cac1da95..1bc01e66 100644
--- a/test/camera/configuration_set.cpp
+++ b/test/camera/configuration_set.cpp
@@ -18,9 +18,8 @@ class ConfigurationSet : public CameraTest
protected:
int run()
{
- std::set<Stream *> streams = { *camera_->streams().begin() };
std::map<Stream *, StreamConfiguration> conf =
- camera_->streamConfiguration(streams);
+ camera_->streamConfiguration({ Stream::VideoRecording() });
StreamConfiguration *sconf = &conf.begin()->second;
if (!configurationValid(conf)) {
diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
index f4395f2b..ab3c6fb5 100644
--- a/test/camera/statemachine.cpp
+++ b/test/camera/statemachine.cpp
@@ -235,9 +235,7 @@ protected:
int run()
{
- Stream *stream = *camera_->streams().begin();
- std::set<Stream *> streams = { stream };
- defconf_ = camera_->streamConfiguration(streams);
+ defconf_ = camera_->streamConfiguration({ Stream::VideoRecording() });
if (testAvailable() != TestPass) {
cout << "State machine in Available state failed" << endl;