From patchwork Fri Jul 1 08:45:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16507 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 22E26BD808 for ; Fri, 1 Jul 2022 08:45:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C85AA656A3; 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=n1EnkpCAgGEuZsOraHgImGNrEvdPLQ6ff6kaFNZgqxg=; 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=0X3hQixHN/ydE43+/aopk4Cyz+gVvMYcuVx66Qv9NCToE28KPAd8J7JRKUPf9AuS3 uujJ6bDX+N+1DZfzbzvOaRW7tUuwliuNTZNoCbcKSVP4LMNlqX9ak+fRabPtOaMsHr Trv7lcI2mPHH+7eQLhygHXBSFt6wvPLVnrOC/mf0pWS07edLyYZ/8rpy/fp8fPLt9G t5SrUoI5qzD+QAmOML3dC4GyutYP3GOhhBoTh8V0QC4120UyhsowOndViO8CqGihi3 4zGc84EDW+lxA2rfW685b6NkgPBCbmOeWFSxpAiZM0tXhNCzp2nyIXX/7heL0RFLri 8Ng74G3Racv1w== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE6FC65699 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="s4paU6Ge"; 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 3F3D725C; Fri, 1 Jul 2022 10:45:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656665147; bh=n1EnkpCAgGEuZsOraHgImGNrEvdPLQ6ff6kaFNZgqxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s4paU6GeshDR9ZMZ99XcIsDHBf04vO0bJPVP49N0rvrKgXl7d3uR/R8O9kbdGSgGn XNvR1m+9heTxNimTsWFL+hyM4wwCWxr2o/PtSrHeKI1nrJf79s7E7aLHModAigXwF1 JZAu2lIUktTtIOGT/BO2Sj/n8cC++3xey/QVAwr0= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Fri, 1 Jul 2022 11:45:19 +0300 Message-Id: <20220701084521.31831-16-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 15/17] 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" 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..7bc9df10 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 return a single RequestCompleted event, but in some + # cases there could be multiple or none. - 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