From patchwork Thu Mar 9 14:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 18367 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 2E2F2C329E for ; Thu, 9 Mar 2023 14:26:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CB5E3626E2; Thu, 9 Mar 2023 15:26:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678371984; bh=ivMAMfY7LAj8Ihu/ud9j0ozVaB9QF6fEIVB/e9R5Ukw=; 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=XI9qZYP91nD7+pd+9a0+hGLt5QLitQHhESmdapajS8N8vh0wq9fc8z3nTy4vfmoRH b+KluvQpiwnQKx3E5/cSop/e302FAkX/+VxDvnmcc71p2VzF5MqhUeAJzVG/t1d6Dl xwax5psiAZoR6VpFWsY3EnxE6RU5RLOWAxWmYrdoR8kDBpvHDJku/F61nbzxNmfwwj x4Bem8satuz5yFUVMjfKDX/rN5eZAd2MmjMDXrmeU5PvpJc7IW7MB2Y2FMoso6TZJU RRcBGwm8K49DHUfJXXl2OBg7mnqwjdPQ2P0WoF2aDf6Aclomvz3+Mzr0H5VmFQ+x/N fHl8O2jb7SJpw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD3B061ED7 for ; Thu, 9 Mar 2023 15:26:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JBc+z+mT"; dkim-atps=neutral Received: from desky.lan (91-154-32-225.elisa-laajakaista.fi [91.154.32.225]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 49E53589; Thu, 9 Mar 2023 15:26:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678371978; bh=ivMAMfY7LAj8Ihu/ud9j0ozVaB9QF6fEIVB/e9R5Ukw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JBc+z+mTKQFlCZhG0571ggM3xCkOaunCsOSk9iUxFLc48i3/izl5mG80fblcPJFMk H8j6V9XqSXcJTKXMxRh0YLF4+6qx+3bCl1cm+8OO1JoduPA00bh5AO3n3N2TxnoKWw ptoFnKDE4Y/KovCgycsJQMSzk3HrAmgjkRDBHTGA= To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Mar 2023 16:25:52 +0200 Message-Id: <20230309142601.70556-7-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309142601.70556-1-tomi.valkeinen@ideasonboard.com> References: <20230309142601.70556-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 06/15] py: simple-continuous-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" Update simple-continuous-capture.py to the new event model. Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/py/examples/simple-continuous-capture.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/py/examples/simple-continuous-capture.py b/src/py/examples/simple-continuous-capture.py index e1cb931e..37ca623c 100755 --- a/src/py/examples/simple-continuous-capture.py +++ b/src/py/examples/simple-continuous-capture.py @@ -83,16 +83,17 @@ class CaptureContext: camera_contexts: list[CameraCaptureContext] = [] def handle_camera_event(self): - # cm.get_ready_requests() returns the ready requests, which in our case - # should almost always return a single Request, but in some cases there - # could be multiple or none. + # cm.get_events() returns the ready events, which in our case should + # almost always be a single RequestCompleted event, but in some cases + # there could be multiple ones, other events, or no events at all. - reqs = self.cm.get_ready_requests() + for ev in self.cm.get_events(): + # We are only interested in RequestCompleted events + if ev.type != libcam.Event.Type.RequestCompleted: + continue - # Process the captured frames - - for req in reqs: - self.handle_request(req) + # Process the captured frames + self.handle_request(ev.request) return True