Message ID | 20230112173411.11276-1-daniel.oakley@ideasonboard.com |
---|---|
State | Accepted |
Commit | 20e33bc0df452232378b317e46e370e25db1cc2a |
Headers | show |
Series |
|
Related | show |
On 12/01/2023 19:34, Daniel Oakley wrote: > Currently, if there are multiple steams, the --metadata flag will > print the metadata for each request multiple times. > > Moving the metadata print logic outside the steam for loop this will > no longer occur. > > Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> > --- > src/py/cam/cam.py | 10 +++++----- > 1 file 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) Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Tomi
Hi Daniel, Thank you for the patch. On Thu, Jan 12, 2023 at 05:34:11PM +0000, Daniel Oakley via libcamera-devel wrote: > Currently, if there are multiple steams, the --metadata flag will It sometimes feel like libcamera requires lots of steam to run, but in this case I believe you meant s/steams/streams/. > print the metadata for each request multiple times. > > Moving the metadata print logic outside the steam for loop this will Ditto. > no longer occur. > > Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> I'll fix the typos when applying the patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/py/cam/cam.py | 10 +++++----- > 1 file 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)
Thank you for reviewing this and for offering to fix those typos when applying the patch. I frequently impress myself with such typos, but "steam" and "stream" is a new one for me. Thanks again, Daniel On Mon, 2023-01-16 at 16:16 +0200, Laurent Pinchart wrote: > Hi Daniel, > > Thank you for the patch. > > On Thu, Jan 12, 2023 at 05:34:11PM +0000, Daniel Oakley via > libcamera-devel wrote: > > Currently, if there are multiple steams, the --metadata flag will > > It sometimes feel like libcamera requires lots of steam to run, but > in > this case I believe you meant s/steams/streams/. > > > print the metadata for each request multiple times. > > > > Moving the metadata print logic outside the steam for loop this > > will > > Ditto. > > > no longer occur. > > > > Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> > > I'll fix the typos when applying the patch. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > --- > > src/py/cam/cam.py | 10 +++++----- > > 1 file 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) >
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)
Currently, if there are multiple steams, the --metadata flag will print the metadata for each request multiple times. Moving the metadata print logic outside the steam for loop this will no longer occur. Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> --- src/py/cam/cam.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)