[libcamera-devel] [PATCH v3 15/17] py: simple-continuous-capture.py: Use new events support
Jacopo Mondi
jacopo at jmondi.org
Thu Aug 18 17:52:59 CEST 2022
Hi Tomi
ditto
On Fri, Jul 01, 2022 at 11:45:19AM +0300, Tomi Valkeinen wrote:
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> ---
> 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
>
> --
> 2.34.1
>
More information about the libcamera-devel
mailing list