diff options
author | Daniel Oakley <daniel.oakley@ideasonboard.com> | 2023-01-12 17:34:11 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2023-01-16 18:07:05 +0200 |
commit | 20e33bc0df452232378b317e46e370e25db1cc2a (patch) | |
tree | f169e8aadeb62f92045853eb72bcda54bc6c5e80 | |
parent | 3666290f5f5bc1da22a609f85e916e143fdf9c0b (diff) |
py: cam.py: Fix duplicate metadata output if more than one stream
Currently, if there are multiple streams, the --metadata flag will print
the metadata for each request multiple times.
Moving the metadata print logic outside the stream for loop this will no
longer occur.
Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | src/py/cam/cam.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/py/cam/cam.py b/src/py/cam/cam.py index 2701d937..967a72f5 100755 --- a/src/py/cam/cam.py +++ b/src/py/cam/cam.py @@ -266,6 +266,11 @@ class CaptureState: ctx.last = ts ctx.fps = fps + if ctx.opt_metadata: + reqmeta = req.metadata + for ctrl, val in reqmeta.items(): + print(f'\t{ctrl} = {val}') + for stream, fb in buffers.items(): stream_name = ctx.stream_names[stream] @@ -284,11 +289,6 @@ class CaptureState: '/'.join([str(p.bytes_used) for p in meta.planes]), crcs)) - if ctx.opt_metadata: - reqmeta = req.metadata - for ctrl, val in reqmeta.items(): - print(f'\t{ctrl} = {val}') - if ctx.opt_save_frames: with libcamera.utils.MappedFrameBuffer(fb) as mfb: filename = 'frame-{}-{}-{}.data'.format(ctx.id, stream_name, ctx.reqs_completed) |