From 20a6455e0b62575bb00136501f7f39f3e150d0d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>
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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/qcam/main_window.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'src/qcam')

diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index fea70142..faa3bc57 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -97,9 +97,8 @@ int MainWindow::startCapture()
 {
 	int ret;
 
-	Stream *stream = *camera_->streams().begin();
-	std::set<Stream *> streams{ stream };
-	config_ = camera_->streamConfiguration(streams);
+	config_ = camera_->streamConfiguration({ Stream::VideoRecording() });
+	Stream *stream = config_.begin()->first;
 	ret = camera_->configureStreams(config_);
 	if (ret < 0) {
 		std::cout << "Failed to configure camera" << std::endl;
-- 
cgit v1.2.1