From a2dddf7c26df3307b9d4554c25387a00687a6234 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart 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 Reviewed-by: Niklas Söderlund --- src/libcamera/stream.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/libcamera/stream.cpp') 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)) { } -- cgit v1.2.1