From patchwork Wed Jul 1 21:16:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8550 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3255BBE905 for ; Wed, 1 Jul 2020 21:17:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 08EFD60C5C; Wed, 1 Jul 2020 23:17:02 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C7B7E60C57 for ; Wed, 1 Jul 2020 23:16:59 +0200 (CEST) X-Halon-ID: 32dd038a-bbe0-11ea-8fb8-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 32dd038a-bbe0-11ea-8fb8-005056917f90; Wed, 01 Jul 2020 23:16:59 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Wed, 1 Jul 2020 23:16:50 +0200 Message-Id: <20200701211650.1002567-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701211650.1002567-1-niklas.soderlund@ragnatech.se> References: <20200701211650.1002567-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 2/2] libcamera: formats: Remove ImageFormats 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ImageFormats helper class is not used anymore and can be removed. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/formats.h | 14 ----- src/libcamera/formats.cpp | 88 ---------------------------- 2 files changed, 102 deletions(-) diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index f59ac8fe36a1623b..70c2f5cb5b7d5eb4 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -18,20 +18,6 @@ namespace libcamera { -class ImageFormats -{ -public: - int addFormat(unsigned int format, const std::vector &sizes); - - bool isEmpty() const; - std::vector formats() const; - const std::vector &sizes(unsigned int format) const; - const std::map> &data() const; - -private: - std::map> data_; -}; - class PixelFormatInfo { public: diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 436672e8bf4f8571..10830ceb9aae8f0c 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -22,94 +22,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Formats) -/** - * \class ImageFormats - * \brief Describe V4L2Device and V4L2SubDevice image formats - * - * This class stores a list of image formats, each associated with a - * corresponding set of image sizes. It is used to describe the formats and - * sizes supported by a V4L2Device or V4L2Subdevice. - * - * Formats are stored as an integer. When used for a V4L2Device, the image - * formats are fourcc pixel formats. When used for a V4L2Subdevice they are - * media bus codes. Both are defined by the V4L2 specification. - * - * Sizes are stored as a list of SizeRange. - */ - -/** - * \brief Add a format and corresponding sizes to the description - * \param[in] format Pixel format or media bus code to describe - * \param[in] sizes List of supported size ranges for the format - * - * \return 0 on success or a negative error code otherwise - * \retval -EEXIST The format is already described - */ -int ImageFormats::addFormat(unsigned int format, const std::vector &sizes) -{ - if (data_.find(format) != data_.end()) - return -EEXIST; - - data_[format] = sizes; - - return 0; -} - -/** - * \brief Check if the list of devices supported formats is empty - * \return True if the list of supported formats is empty - */ -bool ImageFormats::isEmpty() const -{ - return data_.empty(); -} - -/** - * \brief Retrieve a list of all supported image formats - * \return List of pixel formats or media bus codes - */ -std::vector ImageFormats::formats() const -{ - std::vector formats; - formats.reserve(data_.size()); - - /* \todo: Should this be cached instead of computed each time? */ - for (auto const &it : data_) - formats.push_back(it.first); - - return formats; -} - -/** - * \brief Retrieve all sizes for a specific format - * \param[in] format The pixel format or mbus code - * - * Retrieve all size ranges for a specific format. For V4L2Device \a format is a - * pixel format while for a V4L2Subdevice \a format is a media bus code. - * - * \return The list of image sizes supported for \a format, or an empty list if - * the format is not supported - */ -const std::vector &ImageFormats::sizes(unsigned int format) const -{ - static const std::vector empty; - - auto const &it = data_.find(format); - if (it == data_.end()) - return empty; - - return it->second; -} - -/** - * \brief Retrieve the map that associates formats to image sizes - * \return The map that associates formats to image sizes - */ -const std::map> &ImageFormats::data() const -{ - return data_; -} - /** * \class PixelFormatInfo * \brief Information about pixel formats