From patchwork Tue Jul 29 15:39:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 24024 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 7BD55BDCC1 for ; Tue, 29 Jul 2025 15:39:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5DF76691EA; Tue, 29 Jul 2025 17:39:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="Bz0s1LK9"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C64C691DA for ; Tue, 29 Jul 2025 17:39:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sVZAg6thdnSiFRJYsLla6vN7DmdHXrAeqYK4TQ2Nw7k=; b=Bz0s1LK9Lg/8s2w8CCOV499jor uyjzObo7VMza/64BAUm9tPUEhJGIpjf+woRrLiqKyNC0eub1KlReSYZ+x6Xx4hHL6T8PZeXpDSScC sU+AzyenkAZdMBNUPTcw1eC8NpvxARdCTxR4/NmEauyfedZbIYa6soow00Uj6f/Qt+UMjyj6XuEBj F5pUcABYSKuMZY3E0Pua9e8JqBaglnQYwMQn7jPqcxCVLgZR6gsjOuELB3aUPMP+QLT+P9CxFD93+ 79VwsbZ4Pqpe6019lGG960P0ocOJe6GXM8Ms5CqHDgYkE1UBK94IOjkicurUSurBipLdY3JvsgneV pK8TBotw==; Received: from [49.36.71.87] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1ugmQ5-005UrS-HJ; Tue, 29 Jul 2025 17:39:13 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Jaslo Ziska , Nicolas Dufresne , Umang Jain Subject: [PATCH v5 1/3] gstreamer: Split value_set_rectangle() GValue helper Date: Tue, 29 Jul 2025 21:09:13 +0530 Message-ID: <20250729153915.159243-2-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250729153915.159243-1-uajain@igalia.com> References: <20250729153915.159243-1-uajain@igalia.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" Split the value_set_rectangle() GValue helper into further helpers pertaining to libcamera::Point and libcamera::Size. This would help to cover additional cases where helpers are needed for Point and Size individually (in subsequent commits). The libcamera::Rectangle's GValue helper can be easily constructed with the new Point and Size helpers. Hence, this patch does not introduce any functional changes. Signed-off-by: Umang Jain Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcamera-controls.cpp.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in index 2a16b39a..1bc781cc 100644 --- a/src/gstreamer/gstlibcamera-controls.cpp.in +++ b/src/gstreamer/gstlibcamera-controls.cpp.in @@ -17,21 +17,21 @@ using namespace libcamera; -static void value_set_rectangle(GValue *value, const Rectangle &rect) +static void value_set_point(GValue *value, const Point &point) { - Point top_left = rect.topLeft(); - Size size = rect.size(); - GValue x = G_VALUE_INIT; g_value_init(&x, G_TYPE_INT); - g_value_set_int(&x, top_left.x); + g_value_set_int(&x, point.x); gst_value_array_append_and_take_value(value, &x); GValue y = G_VALUE_INIT; g_value_init(&y, G_TYPE_INT); - g_value_set_int(&y, top_left.y); + g_value_set_int(&y, point.y); gst_value_array_append_and_take_value(value, &y); +} +static void value_set_size(GValue *value, const Size &size) +{ GValue width = G_VALUE_INIT; g_value_init(&width, G_TYPE_INT); g_value_set_int(&width, size.width); @@ -43,6 +43,12 @@ static void value_set_rectangle(GValue *value, const Rectangle &rect) gst_value_array_append_and_take_value(value, &height); } +static void value_set_rectangle(GValue *value, const Rectangle &rect) +{ + value_set_point(value, rect.topLeft()); + value_set_size(value, rect.size()); +} + static Rectangle value_get_rectangle(const GValue *value) { const GValue *r;