summaryrefslogtreecommitdiff
path: root/src/libcamera/stream.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-30 21:16:28 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-30 22:18:42 +0300
commita2dddf7c26df3307b9d4554c25387a00687a6234 (patch)
treebe4004bb072d39d471ee790069e3f74d1cd5bbe0 /src/libcamera/stream.cpp
parentbaad55d00975f8931d51c333def20472457dc943 (diff)
libcamera: Use the Size class through libcamera
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>
Diffstat (limited to 'src/libcamera/stream.cpp')
-rw-r--r--src/libcamera/stream.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index aeb479c5..4ff296e3 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -41,13 +41,8 @@ namespace libcamera {
*/
/**
- * \var StreamConfiguration::width
- * \brief Stream width in pixels
- */
-
-/**
- * \var StreamConfiguration::height
- * \brief Stream height in pixels
+ * \var StreamConfiguration::size
+ * \brief Stream size in pixels
*/
/**
@@ -73,8 +68,8 @@ std::string StreamConfiguration::toString() const
std::stringstream ss;
ss.fill(0);
- ss << width << "x" << height << "-0x" << std::hex
- << std::setw(8) << pixelFormat;
+ ss << size.toString() << "-0x" << std::hex << std::setw(8)
+ << pixelFormat;
return ss.str();
}
@@ -128,11 +123,10 @@ StreamUsage::StreamUsage(Role role)
/**
* \brief Create a stream usage with a desired size
* \param[in] role Stream role
- * \param[in] width The desired width
- * \param[in] height The desired height
+ * \param[in] size The desired size
*/
-StreamUsage::StreamUsage(Role role, int width, int height)
- : role_(role), size_(Size(width, height))
+StreamUsage::StreamUsage(Role role, const Size &size)
+ : role_(role), size_(size)
{
}
@@ -183,7 +177,7 @@ Stream::VideoRecording::VideoRecording()
* \param[in] height The desired viewfinder height
*/
Stream::Viewfinder::Viewfinder(int width, int height)
- : StreamUsage(Role::Viewfinder, width, height)
+ : StreamUsage(Role::Viewfinder, Size(width, height))
{
}