From patchwork Tue Mar 12 12:12:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 717 Return-Path: Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A9AA3610D5 for ; Tue, 12 Mar 2019 13:12:20 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 417651C000A; Tue, 12 Mar 2019 12:12:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 12 Mar 2019 13:12:30 +0100 Message-Id: <20190312121242.2253-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312121242.2253-1-jacopo@jmondi.org> References: <20190312121242.2253-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/14] libcamera: v4l2_subdevice: Define format enumeration type X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2019 12:12:20 -0000 Provide a type definition for the map used to enumerate the subdevice image formats and associated sizes. Signed-off-by: Jacopo Mondi --- src/libcamera/include/v4l2_subdevice.h | 5 +++-- src/libcamera/v4l2_subdevice.cpp | 14 +++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h index 700e66bcddac..15add95a825c 100644 --- a/src/libcamera/include/v4l2_subdevice.h +++ b/src/libcamera/include/v4l2_subdevice.h @@ -17,6 +17,8 @@ namespace libcamera { +typedef std::map> SubdevFormatEnum; + struct V4L2SubdeviceFormat { uint32_t mbus_code; uint32_t width; @@ -42,8 +44,7 @@ public: int setCrop(unsigned int pad, Rectangle *rect); int setCompose(unsigned int pad, Rectangle *rect); - const std::map> - formats(unsigned int pad); + const SubdevFormatEnum formats(unsigned int pad); int getFormat(unsigned int pad, V4L2SubdeviceFormat *format); int setFormat(unsigned int pad, V4L2SubdeviceFormat *format); diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 7c56ba3ba510..153330bccc97 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -28,6 +28,15 @@ namespace libcamera { LOG_DEFINE_CATEGORY(V4L2Subdev) +/** + * \typedef SubdevFormatEnum + * \brief Type definition for the map of image formats and associated sizes + * + * Type definition for the map of media bus codes and associated image + * resolutions used by V4L2Subdevice to report the enumeration of supported + * image formats. + */ + /** * \struct V4L2SubdeviceFormat * \brief The V4L2 sub-device image format and sizes @@ -210,10 +219,9 @@ int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect) * \return A map of image formats associated with a list of image sizes, or * an empty map on error or if the pad does not exist */ -const std::map> -V4L2Subdevice::formats(unsigned int pad) +const SubdevFormatEnum V4L2Subdevice::formats(unsigned int pad) { - std::map> formatMap = {}; + SubdevFormatEnum formatMap = {}; struct v4l2_subdev_mbus_code_enum mbusEnum = {}; int ret;