From patchwork Thu Jul 24 13:33:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23943 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 8337CC3237 for ; Thu, 24 Jul 2025 13:33:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F0BB6910D; Thu, 24 Jul 2025 15:33:42 +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="mglNfkMm"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5390F690F3 for ; Thu, 24 Jul 2025 15:33:39 +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=LRaoZxts0rRfXXC/4wwLzCTAK4hhxDv5qrgLBgadjmM=; b=mglNfkMmE7D/K9JtJ+AmI8ISQn Wiay/IktBTunLuYNgdLqaNy9PgsTYXSBVMjSnlhehFchsAfV79xIi+DCN5P1jOVoiqvcplYlu0GAz srLMMEH0dl/5EuwCZDXEAx/at4tGtaco0oXEVcj9hqKjEzH/Y45CYpjOMbzWOljvza6jcZZPV0Rzs I7+RoiqZvbQYzv2LmhmX1Vp3N/exH5mdLcHtiAeeVG2ZxfnV9VtnCW9lkDgTtalWLHp5lK526LXuK nbAHBh/P3Jk5tHf9t6kaNMDMhPU1vcKRToQU02zd7g8Gzd008cv6/Q89tQfwmdTs8wx9ElmThvV+v zrp0k2eQ==; 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 1uew4o-003CfR-Bw; Thu, 24 Jul 2025 15:33:38 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Jaslo Ziska , Nicolas Dufresne , Umang Jain Subject: [PATCH v4 1/3] gstreamer: Split value_set_rectangle() GValue helper Date: Thu, 24 Jul 2025 19:03:41 +0530 Message-ID: <20250724133343.353044-2-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250724133343.353044-1-uajain@igalia.com> References: <20250724133343.353044-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 --- 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;