From patchwork Thu Dec 8 13:44:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17958 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 88877BE08B for ; Thu, 8 Dec 2022 13:44:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CB90E63340; Thu, 8 Dec 2022 14:44:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670507060; bh=pD1HA6wyMaPB4DozO4ha4O7g1INwrPF6gZsNQw58020=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ieYiHgHduQWMT3G9zOY10etxiRR4I0pwcUP1hPdkKL0XH1kTRV6LYZN7XRSodPU2W 1bGRcAqTN94cWq1FbgSwfnDMIy0mrmJY3qM5yd7wOSA6VuMrUM30rGrmr2lFKwxiXV 2J5nIw8dEKyN4oDL29cBMwc6R61DkOMa94U7boOxuWZHLNG0gIK8X+eeidTlQiowgE wuT2AdUDegx1oAoWIjyk/Rawaczz4V+buQzWD6dLaynguA12vHCL/mRaOqXQACTSbZ HUwWEkJHmzj72V6Cy/6EpPxVvBwnUA8Pm0I5maUpn1xqucZfPKixH9+TSi8Qeg3Kax LUEZD32oT49ng== Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A78046333B for ; Thu, 8 Dec 2022 14:44:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="HIKZUVXB"; dkim-atps=neutral Received: by mail-wm1-x332.google.com with SMTP id v7so1090909wmn.0 for ; Thu, 08 Dec 2022 05:44:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FJolOTrMlufze8JmyK3JaUqHtwvmpMdh2Nq8ZEQwEhU=; b=HIKZUVXBV87MdbJ8qONEhhp14pnFSSC/twaKpGtO5VTFKK3UOhs5S0NN2Q7WVuE0pT YwMD2reGc8UXCXikWOkDIdvL0if5PxiREanMICGTX4csNUbj1JYP/Th2Hsyru274GPDJ q6hBc4Klpl4B5WkxWOrIvqYypzI6TlQJgbErHF8lH/yZY1zdO7ieTUzd187FMV5nhexr wKGeOEkuvD6ye2fiQAmRNcjxK8kg6ltdCXUBB6PkktGAymuoTHlM1HJ/GYYx8m+riiR0 459IVQkdWp6XtizpWaZ6bDqt7Og325Mg8avsH899AF/8OdypfK1Usz3ccIMBXLXAVuZq YMUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FJolOTrMlufze8JmyK3JaUqHtwvmpMdh2Nq8ZEQwEhU=; b=ud2Dw0dD0MED3AZDB4y+VN44rrWu9GpkBTwMQoEonNjP9IzDFBDYmqYjmQn1g7Xasa uRIpdTetCDuIYkfZC3aXrsJrG/1YH2oqhJd7msAwREeMElWydL3PVQufXUMUmIExqYz3 7SARiUIPZXZXEBCAN4cVNJ1dW5xnUs1t15mlmSvv10K2Gt9sPtVurjdhb9m9PhZIdUv/ 1r1bk1N708gez+6sgdDlFLy/aA8NTnwyiDs4MJhlJx5ZgA7Oh9Uk9RaNZU4QVV9ie/Kt 929cLkR2NE7MVFPwOL1qQMqit6LIDEdrbK3/Y4u0X90i2f+JNc0ooOVCWBPsWcccjw7R juuw== X-Gm-Message-State: ANoB5pmabybIWp7Q0W3Mo1n86DV6Ts76xejEcgi9KuX1kRtJeFhYAcFN ixA258g+vMCm1myhhs1tZlIK3hGy7co6SJ7c X-Google-Smtp-Source: AA0mqf7xLEhKEd2FFoI7H7bmAxIMApDsSfy2dDYVpRY2HbEzJCWZlgcO7h+mtTINwBTlE9H2ltv1Cg== X-Received: by 2002:a05:600c:1e89:b0:3cf:774b:ce6f with SMTP id be9-20020a05600c1e8900b003cf774bce6fmr24957738wmb.133.1670507058016; Thu, 08 Dec 2022 05:44:18 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id l12-20020a5d668c000000b00235da296623sm22537130wru.31.2022.12.08.05.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 05:44:17 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Dec 2022 13:44:14 +0000 Message-Id: <20221208134414.2917-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] py: Support controls that use an array of Rectangles 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: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The Python bindings will now accept, or return, a list or tuple of libcamera.Rectangle objects for such controls. This had previously been omitted, but now we have, for example, the AfWindows control which requires this feature. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck Reviewed-by: Tomi Valkeinen --- src/py/libcamera/py_helpers.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp index f685e606..79891ab6 100644 --- a/src/py/libcamera/py_helpers.cpp +++ b/src/py/libcamera/py_helpers.cpp @@ -46,10 +46,8 @@ py::object controlValueToPy(const ControlValue &cv) return valueOrTuple(cv); case ControlTypeString: return py::cast(cv.get()); - case ControlTypeRectangle: { - const Rectangle *v = reinterpret_cast(cv.data().data()); - return py::cast(v); - } + case ControlTypeRectangle: + return valueOrTuple(cv); case ControlTypeSize: { const Size *v = reinterpret_cast(cv.data().data()); return py::cast(v); @@ -88,7 +86,7 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type) case ControlTypeString: return ControlValue(ob.cast()); case ControlTypeRectangle: - return ControlValue(ob.cast()); + return controlValueMaybeArray(ob); case ControlTypeSize: return ControlValue(ob.cast()); case ControlTypeNone: