{"id":18693,"url":"https://patchwork.libcamera.org/api/patches/18693/?format=json","web_url":"https://patchwork.libcamera.org/patch/18693/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230603075615.20663-9-tomi.valkeinen@ideasonboard.com>","date":"2023-06-03T07:56:10","name":"[libcamera-devel,v5,08/13] py: simple-cam.py: Use new events support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2b0f75182fde505e0cbfbd2d69bd16510e07a91f","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18693/mbox/","series":[{"id":3904,"url":"https://patchwork.libcamera.org/api/series/3904/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3904","date":"2023-06-03T07:56:02","name":"py: New python bindings event handling","version":5,"mbox":"https://patchwork.libcamera.org/series/3904/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18693/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18693/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DA5FFC328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  3 Jun 2023 07:57:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 937F26278F;\n\tSat,  3 Jun 2023 09:57:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C094962885\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  3 Jun 2023 09:57:13 +0200 (CEST)","from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 39AF0468;\n\tSat,  3 Jun 2023 09:56:50 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685779039;\n\tbh=iaRylJ5l1sFUWopCwUojy8cIUA0Y2r4I2IXZHJH+WuA=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=f/3O9ePuRb5/s0zUC2iK5n4eIGihoWDbJrbM/ek8YGPou0KBEYAtN075vdHlc7dNG\n\tN9roYRNwRA77+68rIUrNxIwYTwKOKFRd9FWN5dcRLO6zGnjUvxwvvigafJYHpIuhS+\n\taaXkNANZy9lxVtjQgtL/AtyeFOT3jyQm+OBFhKHm6i68rTJJKT5xm/uCS4FDKnvZ7u\n\tE0Z7TUSwbL4P4BTY9Uv4x30Hg23LLvSqKCetDdmLR3b0YjryxoTsCZDIzsnElCR8CM\n\tGEiHawwdvWfXqRhWspxuhwrx3+tc6XZ7JKykvILORbc+uYC80cwXsN+//LN3MeAYrs\n\tWcDQuGtB/+cIA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1685779010;\n\tbh=iaRylJ5l1sFUWopCwUojy8cIUA0Y2r4I2IXZHJH+WuA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=MRx3syONFmePRqQc2z8fOHaWDGvCztRBb8Pppp96XQwj57rOnPsMgxJUGH2EDseik\n\tMnBpDLm1yS54+mT5HzH2Zdp0UU4B4vOVlM7J+Z/aHfZFUOjE8hA0eIv4I2XfrgD+Ot\n\t2WfZ7iSG5Q9EVJzlZzE5SW3bKNRpc91m7fQyAqCc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"MRx3syON\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  3 Jun 2023 10:56:10 +0300","Message-Id":"<20230603075615.20663-9-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230603075615.20663-1-tomi.valkeinen@ideasonboard.com>","References":"<20230603075615.20663-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 08/13] py: simple-cam.py: Use new\n\tevents support","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Update simple-cam.py to the new event model.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/py/examples/simple-cam.py | 19 ++++++++++---------\n 1 file changed, 10 insertions(+), 9 deletions(-)","diff":"diff --git a/src/py/examples/simple-cam.py b/src/py/examples/simple-cam.py\nindex 1cd1019d..2d359cb7 100755\n--- a/src/py/examples/simple-cam.py\n+++ b/src/py/examples/simple-cam.py\n@@ -19,16 +19,17 @@ TIMEOUT_SEC = 3\n \n \n def handle_camera_event(cm):\n-    # cm.get_ready_requests() returns the ready requests, which in our case\n-    # should almost always return a single Request, but in some cases there\n-    # could be multiple or none.\n+    # cm.get_events() returns the ready events, which in our case should\n+    # almost always be a single RequestCompleted event, but in some cases\n+    # there could be multiple ones, other events, or no events at all.\n \n-    reqs = cm.get_ready_requests()\n+    for ev in cm.get_events():\n+        # We are only interested in RequestCompleted events\n+        if ev.type != libcam.Event.Type.RequestCompleted:\n+            continue\n \n-    # Process the captured frames\n-\n-    for req in reqs:\n-        process_request(req)\n+        # Process the captured frames\n+        process_request(ev.request)\n \n \n def process_request(request):\n@@ -304,7 +305,7 @@ def main():\n     # CameraManager and an event will be raised using eventfd.\n     #\n     # The list of completed Requests can be retrieved with\n-    # CameraManager.get_ready_requests(), which will also clear the list in the\n+    # CameraManager.get_events(), which will also clear the list in the\n     # CameraManager.\n     #\n     # The eventfd can be retrieved from CameraManager.event_fd, and the fd can\n","prefixes":["libcamera-devel","v5","08/13"]}