From patchwork Wed Oct 2 05:50:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 21468 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 A7EDBBD80A for ; Wed, 2 Oct 2024 05:50:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 192EB63512; Wed, 2 Oct 2024 07:50:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AqyNzjoQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 752DE63512 for ; Wed, 2 Oct 2024 07:50:16 +0200 (CEST) Received: from ideasonboard.com (unknown [5.77.88.238]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 78AC9A1A; Wed, 2 Oct 2024 07:48:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727848124; bh=cGo0UfLYVNri6IQT1UX1pG+d9scY8pRhOjGqSSN8CfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqyNzjoQnGJofWzPxdaaQORIf//w6SnLQncT3DAnvoCXA7vCPzSI0MWmzy48dq3WS jOgaoWKGDHRPd6q3MzKJd667foxaSopEQnS3R3OJixgVOlHBWs8c4nqt7vloEGMH0t gsci1NkQ1mvl5YSPM05k62IAjaMGiDW2sFn3nHhE= From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Yudhistira Erlandinata , Becker Hsieh , Harvey Yang , Jacopo Mondi , Laurent Pinchart Subject: [PATCH v10 3/5] libcamera: controls: Add ControlTypePoint Date: Wed, 2 Oct 2024 07:50:00 +0200 Message-ID: <20241002055002.6271-3-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241002055002.6271-1-jacopo.mondi@ideasonboard.com> References: <20241001191354.55056-1-jacopo.mondi@ideasonboard.com> <20241002055002.6271-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 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" From: Yudhistira Erlandinata Add a control_type<> specialization for libcamera::Point to allow storing data of that type in a ControlValue instance. The new control type will be used by controls introduced in the next patches. Signed-off-by: Yudhistira Erlandinata Co-developed-by: Becker Hsieh Co-developed-by: Harvey Yang Reviewed-by: Jacopo Mondi Signed-off-by: Jacopo Mondi Reviewed-by: Harvey Yang Reviewed-by: Laurent Pinchart --- include/libcamera/controls.h | 6 ++++++ src/libcamera/controls.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index c5131870d402..ca60bbacad17 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -35,6 +35,7 @@ enum ControlType { ControlTypeString, ControlTypeRectangle, ControlTypeSize, + ControlTypePoint, }; namespace details { @@ -97,6 +98,11 @@ struct control_type { static constexpr std::size_t size = 0; }; +template<> +struct control_type { + static constexpr ControlType value = ControlTypePoint; +}; + template struct control_type> : public control_type> { static constexpr std::size_t size = N; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index ea4397302a21..62185d643ecd 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -60,6 +60,7 @@ static constexpr size_t ControlValueSize[] = { [ControlTypeString] = sizeof(char), [ControlTypeRectangle] = sizeof(Rectangle), [ControlTypeSize] = sizeof(Size), + [ControlTypePoint] = sizeof(Point), }; } /* namespace */ @@ -254,6 +255,11 @@ std::string ControlValue::toString() const str += value->toString(); break; } + case ControlTypePoint: { + const Point *value = reinterpret_cast(data); + str += value->toString(); + break; + } case ControlTypeNone: case ControlTypeString: break;