From 20a6455e0b62575bb00136501f7f39f3e150d0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Wed, 27 Mar 2019 20:49:11 +0100 Subject: libcamera: camera: Add support for stream usages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Laurent Pinchart --- test/camera/capture.cpp | 5 ++--- test/camera/configuration_default.cpp | 17 ++++++----------- test/camera/configuration_set.cpp | 3 +-- test/camera/statemachine.cpp | 4 +--- 4 files changed, 10 insertions(+), 19 deletions(-) (limited to 'test/camera') 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 streams = { stream }; std::map 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 conf; - /* - * Test that asking for default configuration for a valid - * array of streams returns something valid. - */ - std::set 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 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 streams = { *camera_->streams().begin() }; std::map 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 streams = { stream }; - defconf_ = camera_->streamConfiguration(streams); + defconf_ = camera_->streamConfiguration({ Stream::VideoRecording() }); if (testAvailable() != TestPass) { cout << "State machine in Available state failed" << endl; -- cgit v1.2.1