From patchwork Fri Jul 1 08:45:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16506 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 8FE3BBD808 for ; Fri, 1 Jul 2022 08:45:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 598C165657; Fri, 1 Jul 2022 10:45:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656665157; bh=dEMxUwcl6KLgUabu02fgNyd1D1uOBovj3Is2gM6gduc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XEJs2dWp5Vx+A6n1oz1DqB/iSmqGJntvn/XkvIQ3OwEwdPp0zps2dRu2cSQXTHkp/ I90CF3AFWh9ZnIrDhZRjMHjrrpTv4KZAsP1cqYgvsZPMKhToXO0KMneAtskNnj4sfU SoTjl/YxPCG0exDZppLR6hR74V0fcxLkRF6j7DitOaKuAd7askuFguf89pBFjlEkX4 EyeApnWCB1GDjtJ/1u2kcdFDMr1aHIp3NttJR8TlJCZRI64WIoSm8c/xC4fKgQ6h95 EwyGZXMtfCkYDVP49gMBiDjWyEWJznK3cpbR5A3tPqTRGLLE/qhNd6L881wY5SOUY4 3TjST3YCmFJqw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F03465657 for ; Fri, 1 Jul 2022 10:45:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FLEbA0P1"; dkim-atps=neutral Received: from deskari.lan (91-158-154-79.elisa-laajakaista.fi [91.158.154.79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C6FFD6BB; Fri, 1 Jul 2022 10:45:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656665147; bh=dEMxUwcl6KLgUabu02fgNyd1D1uOBovj3Is2gM6gduc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLEbA0P1P0aU1Y6JtXWycPVJ/INmeB+n3yUkyF6245MSD0Tdcef40S5ErNJvflhwn +quOgbSoE6jEyQONqJQ6ILGu6K8UNDksHaJWVj34mEe/qlhvFauVVfr9GfGJCLwRki EvyNA5K/5MOtelkvfKJKj1M/pn/TA1vASqTcEhxM= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Fri, 1 Jul 2022 11:45:18 +0300 Message-Id: <20220701084521.31831-15-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220701084521.31831-1-tomi.valkeinen@ideasonboard.com> References: <20220701084521.31831-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 14/17] py: simple-capture.py: Use new events support 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: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/py/examples/simple-capture.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/py/examples/simple-capture.py b/src/py/examples/simple-capture.py index 4b85408f..c26e638b 100755 --- a/src/py/examples/simple-capture.py +++ b/src/py/examples/simple-capture.py @@ -107,7 +107,7 @@ def main(): sel.register(cm.event_fd, selectors.EVENT_READ) while frames_done < TOTAL_FRAMES: - # cm.get_ready_requests() does not block, so we use a Selector to wait + # cm.get_events() does not block, so we use a Selector to wait # for a camera event. Here we should almost always get a single # Request, but in some cases there could be multiple or none. @@ -115,9 +115,13 @@ def main(): if not events: continue - reqs = cm.get_ready_requests() + for ev in cm.get_events(): + # We are only interested in RequestCompleted events + if ev.type != libcam.Event.Type.RequestCompleted: + continue + + req = ev.request - for req in reqs: frames_done += 1 buffers = req.buffers