From a2dddf7c26df3307b9d4554c25387a00687a6234 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Tue, 30 Apr 2019 21:16:28 +0300
Subject: libcamera: Use the Size class through libcamera
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Several of our structures include width and height fields that model a
size while we have a Size class for that purpose. Use the Size class
through libcamera, and give it a toString() method like other geometry
and format classes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 include/libcamera/geometry.h | 2 ++
 include/libcamera/stream.h   | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

(limited to 'include')

diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h
index 3dbbced5..a87d65d3 100644
--- a/include/libcamera/geometry.h
+++ b/include/libcamera/geometry.h
@@ -40,6 +40,8 @@ struct Size {
 
 	unsigned int width;
 	unsigned int height;
+
+	const std::string toString() const;
 };
 
 bool operator==(const Size &lhs, const Size &rhs);
diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 3caaefc9..0c986310 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -17,9 +17,8 @@ namespace libcamera {
 class Camera;
 
 struct StreamConfiguration {
-	unsigned int width;
-	unsigned int height;
 	unsigned int pixelFormat;
+	Size size;
 
 	unsigned int bufferCount;
 
@@ -40,7 +39,7 @@ public:
 
 protected:
 	explicit StreamUsage(Role role);
-	StreamUsage(Role role, int width, int height);
+	StreamUsage(Role role, const Size &size);
 
 private:
 	Role role_;
-- 
cgit v1.2.1