[{"id":27239,"web_url":"https://patchwork.libcamera.org/comment/27239/","msgid":"<20230605051609.GD22604@pendragon.ideasonboard.com>","date":"2023-06-05T05:16:09","subject":"Re: [libcamera-devel] [PATCH v5 07/13] py:\n\tsimple-continuous-capture.py: Use new events support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Sat, Jun 03, 2023 at 10:56:09AM +0300, Tomi Valkeinen wrote:\n> Update simple-continuous-capture.py to the new event model.\n> \n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/py/examples/simple-continuous-capture.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/py/examples/simple-continuous-capture.py b/src/py/examples/simple-continuous-capture.py\n> index e1cb931e..37ca623c 100755\n> --- a/src/py/examples/simple-continuous-capture.py\n> +++ b/src/py/examples/simple-continuous-capture.py\n> @@ -83,16 +83,17 @@ class CaptureContext:\n>      camera_contexts: list[CameraCaptureContext] = []\n>  \n>      def handle_camera_event(self):\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\nSame comment as for 06/13.\n\n>  \n> -        reqs = self.cm.get_ready_requests()\n> +        for ev in self.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> -            self.handle_request(req)\n> +            # Process the captured frames\n> +            self.handle_request(ev.request)\n>  \n>          return True\n>","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 C2B73C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jun 2023 05:16:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7DD4362728;\n\tMon,  5 Jun 2023 07:16:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C87462722\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jun 2023 07:16:11 +0200 (CEST)","from pendragon.ideasonboard.com (om126156242094.26.openmobile.ne.jp\n\t[126.156.242.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E26F11BA;\n\tMon,  5 Jun 2023 07:15:45 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685942172;\n\tbh=YoXhrT+y+d1XMnY9pbyUfPD5H5Tz5Sx5MK+zdtw6ZmY=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=d3jJk1ZPmFyvPcfJopQn3dhf90RkqSyabvZauINJZoWHkwJz8/AP0OPLAhM3XVFUl\n\tlDpy4eZA9CfozJpFWF5JLz/ogba3gLar8uUTUnJjFu8NGr3j4nmeFYp41RVnGQacEv\n\t5ClmrB4FzA5Hzwj5yr3rCrhoGJxukO4PChV/+D2LN7FFrfl7gEHuhoYNwCKc3P6e03\n\tV++Bc8DYkgeOCQrvuL+MKi4jW2mvJdniSCyFbaaqv6Aw1igIX/5RLr6rBn3K1B1vnf\n\t/oGwv7Sjt5JUQYRVYNsCz8iq+WYz9P3Vx/9CZTaHmL+do98D4GVPWTeRNMMJGeGI2s\n\txXDCzyoQscKhw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1685942146;\n\tbh=YoXhrT+y+d1XMnY9pbyUfPD5H5Tz5Sx5MK+zdtw6ZmY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wZMpqCYjjT5JD4MRe1IBi1Q9h1RipX+x3dlWolV1gwMW6O6K/6uKGlY6MxuYYVFro\n\t7gQYLXr4gwF+KaxRxyRMMzFtu4JrtRvwQqzBbeo5fDz40Q9K2vjIF2aSVTKBtxm3pe\n\tKekvZwt140zVn+Ecuwur2OKMxbYnPefN57ExY2HQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wZMpqCYj\"; dkim-atps=neutral","Date":"Mon, 5 Jun 2023 08:16:09 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<20230605051609.GD22604@pendragon.ideasonboard.com>","References":"<20230603075615.20663-1-tomi.valkeinen@ideasonboard.com>\n\t<20230603075615.20663-8-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230603075615.20663-8-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 07/13] py:\n\tsimple-continuous-capture.py: Use new events 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]