From patchwork Mon Oct 28 11:02:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2288 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C0C4B6017F for ; Mon, 28 Oct 2019 12:02:20 +0100 (CET) Received: from pendragon.ideasonboard.com (unknown [91.217.168.176]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5CDFDB7D for ; Mon, 28 Oct 2019 12:02:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1572260540; bh=kJj3ADYx+OdeCoe8CtEz+7JuirOoi2z97a+J1IWotxo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qt8o5nv2jhm+T8qPh5SVQULKyyU6t1ucWFSFuApeVcFFiUeWGb80IT/7rM4Tvpy+Z PO73oGzQZ0RGkF0XwTSElGFbUrjngSXfW8H/iRjwBZOe62H7z4d9aVH9IclNpzVB19 fKJYnNirc8j9i9dKB6EN/T2dbyr8oz7iW3aY5lLo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 13:02:06 +0200 Message-Id: <20191028110208.15751-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028110208.15751-1-laurent.pinchart@ideasonboard.com> References: <20191028110208.15751-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/7] libcamera: stream: Use the newly defined PixelFormat X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 11:02:22 -0000 From: Jacopo Mondi Use the newly defined PixelFormat type to define the image format contained in the StreamFormats and StreamConfiguration classes. Update the classes documentation accordingly. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/stream.h | 13 +++++++------ src/libcamera/stream.cpp | 17 +++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 2e619cdf0e89..a404eccf34d9 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -14,6 +14,7 @@ #include #include +#include namespace libcamera { @@ -24,15 +25,15 @@ class StreamFormats { public: StreamFormats(); - StreamFormats(const std::map> &formats); + StreamFormats(const std::map> &formats); - std::vector pixelformats() const; - std::vector sizes(unsigned int pixelformat) const; + std::vector pixelformats() const; + std::vector sizes(PixelFormat pixelformat) const; - SizeRange range(unsigned int pixelformat) const; + SizeRange range(PixelFormat pixelformat) const; private: - std::map> formats_; + std::map> formats_; }; enum MemoryType { @@ -44,7 +45,7 @@ struct StreamConfiguration { StreamConfiguration(); StreamConfiguration(const StreamFormats &formats); - unsigned int pixelFormat; + PixelFormat pixelFormat; Size size; MemoryType memoryType; diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index b8e7209c1047..45f31ae1e2da 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -94,7 +94,7 @@ StreamFormats::StreamFormats() * \brief Construct a StreamFormats object with a map of image formats * \param[in] formats A map of pixel formats to a sizes description */ -StreamFormats::StreamFormats(const std::map> &formats) +StreamFormats::StreamFormats(const std::map> &formats) : formats_(formats) { } @@ -103,9 +103,9 @@ StreamFormats::StreamFormats(const std::map * \brief Retrieve the list of supported pixel formats * \return The list of supported pixel formats */ -std::vector StreamFormats::pixelformats() const +std::vector StreamFormats::pixelformats() const { - std::vector formats; + std::vector formats; for (auto const &it : formats_) formats.push_back(it.first); @@ -115,7 +115,7 @@ std::vector StreamFormats::pixelformats() const /** * \brief Retrieve the list of frame sizes supported for \a pixelformat - * \param[in] pixelformat Pixel format to retrieve sizes for + * \param[in] pixelformat PixelFormat to retrieve sizes for * * If the sizes described for \a pixelformat are discrete they are returned * directly. @@ -127,7 +127,7 @@ std::vector StreamFormats::pixelformats() const * * \return A list of frame sizes or an empty list on error */ -std::vector StreamFormats::sizes(unsigned int pixelformat) const +std::vector StreamFormats::sizes(PixelFormat pixelformat) const { /* * Sizes to try and extract from ranges. @@ -230,7 +230,7 @@ std::vector StreamFormats::sizes(unsigned int pixelformat) const /** * \brief Retrieve the range of minimum and maximum sizes - * \param[in] pixelformat Pixel format to retrieve range for + * \param[in] pixelformat PixelFormat to retrieve range for * * If the size described for \a pixelformat is a range, that range is returned * directly. If the sizes described are a list of discrete sizes, a range is @@ -240,7 +240,7 @@ std::vector StreamFormats::sizes(unsigned int pixelformat) const * * \return A range of valid image sizes or an empty range on error */ -SizeRange StreamFormats::range(unsigned int pixelformat) const +SizeRange StreamFormats::range(PixelFormat pixelformat) const { auto const it = formats_.find(pixelformat); if (it == formats_.end()) @@ -311,9 +311,6 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) /** * \var StreamConfiguration::pixelFormat * \brief Stream pixel format - * - * This is a little endian four character code representation of the pixel - * format described in V4L2 using the V4L2_PIX_FMT_* definitions. */ /**