From 70e53be538984739d500ef641c262e79affdeac4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>
Date: Mon, 25 Mar 2019 18:05:38 +0100
Subject: libcamera: stream: Add basic stream usages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In preparation of reworking how a default configuration is retrieved
from a camera add stream usages. The usages will be used by applications
to describe how they intend to use a camera and replace the Stream IDs
when retrieving default configuration from the camera using
streamConfiguration().

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/stream.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

(limited to 'include')

diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 970c4796..d0f7b0e1 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -8,6 +8,7 @@
 #define __LIBCAMERA_STREAM_H__
 
 #include <libcamera/buffer.h>
+#include <libcamera/geometry.h>
 
 namespace libcamera {
 
@@ -21,9 +22,48 @@ struct StreamConfiguration {
 	unsigned int bufferCount;
 };
 
+class StreamUsage
+{
+public:
+	enum Role {
+		StillCapture,
+		VideoRecording,
+		Viewfinder,
+	};
+
+	Role role() const { return role_; }
+	const Size &size() const { return size_; }
+
+protected:
+	explicit StreamUsage(Role role);
+	StreamUsage(Role role, int width, int height);
+
+private:
+	Role role_;
+	Size size_;
+};
+
 class Stream final
 {
 public:
+	class StillCapture : public StreamUsage
+	{
+	public:
+		StillCapture();
+	};
+
+	class VideoRecording : public StreamUsage
+	{
+	public:
+		VideoRecording();
+	};
+
+	class Viewfinder : public StreamUsage
+	{
+	public:
+		Viewfinder(int width, int height);
+	};
+
 	Stream();
 	BufferPool &bufferPool() { return bufferPool_; }
 	const StreamConfiguration &configuration() const { return configuration_; }
-- 
cgit v1.2.1