From patchwork Mon Jan 21 17:27:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 304 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CBC7760C96 for ; Mon, 21 Jan 2019 18:27:04 +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 relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 5F1631BF206; Mon, 21 Jan 2019 17:27:04 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Jan 2019 18:27:02 +0100 Message-Id: <20190121172705.19985-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121172705.19985-1-jacopo@jmondi.org> References: <20190121172705.19985-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify single/multiplane 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: Mon, 21 Jan 2019 17:27:05 -0000 Add functions to V4L2Capability to identify if a V4L2 device supports single or multiplane APIs. Signed-off-by: Jacopo Mondi --- src/libcamera/include/v4l2_device.h | 6 +++-- src/libcamera/v4l2_device.cpp | 37 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index 2787847..0101a4b 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -27,8 +27,10 @@ struct V4L2Capability final : v4l2_capability { return reinterpret_cast(v4l2_capability::bus_info); } - bool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; } - bool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; } + bool isSinglePlane() const; + bool isMultiPlane() const; + bool isCapture() const; + bool isOutput() const; bool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; } }; diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index aef0996..7cd89d7 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -47,17 +47,46 @@ namespace libcamera { * \return The string containing the device location */ + +/** + * \brief Identify if the device implements V4L2 single plane APIs + * \return true if the device supports single plane APIs + */ +bool V4L2Capability::isSinglePlane() const +{ + return (capabilities & V4L2_CAP_VIDEO_CAPTURE) || + (capabilities & V4L2_CAP_VIDEO_OUTPUT); +} + +/** + * \brief Identify if the device implements V4L2 multiplanar APIs + * \return true if the device supports multiplanar APIs + */ +bool V4L2Capability::isMultiPlane() const +{ + return (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) || + (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE); +} + /** - * \fn bool V4L2Capability::isCapture() * \brief Identify if the device is capable of capturing video - * \return True if the device can capture video frames + * \return true if the device can capture video frames */ +bool V4L2Capability::isCapture() const +{ + return (capabilities & V4L2_CAP_VIDEO_CAPTURE) || + (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE); +} /** - * \fn bool V4L2Capability::isOutput() * \brief Identify if the device is capable of outputting video - * \return True if the device can output video frames + * \return true if the device can capture video frames */ +bool V4L2Capability::isOutput() const +{ + return (capabilities & V4L2_CAP_VIDEO_OUTPUT) || + (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE); +} /** * \fn bool V4L2Capability::hasStreaming()