[libcamera-devel] [PATCH v2 13/13] py: use geometry classes

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Wed May 18 08:57:09 CEST 2022


On 17/05/2022 20:20, Kieran Bingham wrote:
> Quoting Tomi Valkeinen (2022-05-17 15:33:25)
>> Now that we have proper geometry classes in the Python bindings, change
>> the existing bindings and the .py files accordingly.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>> ---
>>   src/py/cam/cam.py           |  7 +++++--
>>   src/py/cam/cam_kms.py       |  3 ++-
>>   src/py/cam/cam_qt.py        |  7 ++++---
>>   src/py/cam/cam_qtgl.py      |  3 ++-
>>   src/py/libcamera/pymain.cpp | 41 ++++++++-----------------------------
>>   5 files changed, 22 insertions(+), 39 deletions(-)
>>
>> diff --git a/src/py/cam/cam.py b/src/py/cam/cam.py
>> index 001fb9de..2f0690b5 100755
>> --- a/src/py/cam/cam.py
>> +++ b/src/py/cam/cam.py
>> @@ -160,8 +160,11 @@ def configure(ctx):
>>       for idx, stream_opts in enumerate(streams):
>>           stream_config = camconfig.at(idx)
>>   
>> -        if 'width' in stream_opts and 'height' in stream_opts:
>> -            stream_config.size = (stream_opts['width'], stream_opts['height'])
>> +        if 'width' in stream_opts:
>> +            stream_config.size.width = stream_opts['width']
>> +
>> +        if 'height' in stream_opts:
>> +            stream_config.size.height = stream_opts['height']
> 
> What happens here if only one of width, or height is set. Can it be
> enforced to set both? Actually - I suspect the validation phase should
> choose a (probably small, but more correct) configuration.

Yes, I think it picks up some default value for the other parameter. 
Maybe whatever is currently configured.

  Tomi


More information about the libcamera-devel mailing list