From patchwork Fri Jul 1 08:45:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16508 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 91C4FBD808 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 4D1E16565C; Fri, 1 Jul 2022 10:45:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656665158; bh=MYlDkRTAp41zXQKsbu1oUXZKNRGPOXw62F5eXwtarUg=; 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=tyxc+zIFHFBCdOBCtOOFfNA868w2yNInbLsPLqqK3McnDSiDtu7RrOPmP/DM7di3H evF/waMrGpSxgzGug2ekLfQ2XlGP7eGGya6WfF6ZnbWTpnJarPQfipmS8/VlISBODq TN1Sq/cRRO1XPsO8RzYC9Xr7nwBdYJKYOAKYVzfMNH3bEYYsEhtoeaI4u0/cNJPJaR 7+U/TcIRc5zND3Cxy+yo7Bo2+6juD5E5cqXdSYnn87/W3B/dFSR25W1r53u2bNINSH Y7e1g45QV5stYk70h6Ulr3o/041r4Bgn8LOkA+QpPyyuQotso0ZGdG4oTaoi8RHMvP DNy1noIRrOjQA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 34BAF65659 for ; Fri, 1 Jul 2022 10:45:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="S24WYZY/"; 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 AB25574A; 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=1656665148; bh=MYlDkRTAp41zXQKsbu1oUXZKNRGPOXw62F5eXwtarUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S24WYZY/bqbsZkg3GMANaNmEVikl2zVx9RxlLLGUFeFblDg3X1zlxzt/dgNBXrjT3 OLkw+8+8J+aI7nTyBiLwaONJqmOL6VZoozTAPMCDa11ObGUdGdUD9cPFC3WAJQPNsX 10QOKzx9WBh0+r4wn7kFH9xyuaymVZicbtO3KjHk= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Fri, 1 Jul 2022 11:45:20 +0300 Message-Id: <20220701084521.31831-17-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 16/17] py: simple-cam.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-cam.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/py/examples/simple-cam.py b/src/py/examples/simple-cam.py index 1cd1019d..2dcf962a 100755 --- a/src/py/examples/simple-cam.py +++ b/src/py/examples/simple-cam.py @@ -19,16 +19,17 @@ TIMEOUT_SEC = 3 def handle_camera_event(cm): - # 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 = 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 - # Process the captured frames - - for req in reqs: - process_request(req) + # Process the captured frames + process_request(ev.request) def process_request(request):