[libcamera-devel] [PATCH v8 7/7] py: Add cam.py

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Mon May 9 11:13:31 CEST 2022


On 07/05/2022 14:56, Laurent Pinchart wrote:

>>>> +def str_to_fourcc(str):
>>>> +    assert(len(str) == 4)
>>>> +    fourcc = 0
>>>> +    for i, v in enumerate([ord(c) for c in str]):
>>>> +        fourcc |= v << (i * 8)
>>>> +    return fourcc
>>>
>>> Is retrieving the numerical 4CC something that should be part of the
>>> PixelFormat bindings ?
>>
>> If it's part of libcamera, yes. But I think we should keep the bindings
>> to reflect libcamera as far as possible. Utility features can be built
>> to a pure python library on top.
> 
> It is part of libcamera :-) See PixelFormat::fourcc() and
> PixelFormat::modifier().

I'll leave the above as it is for now, but I have added a todo item to 
implement PixelFormat. At the moment the python bindings only use a 
fourcc string as the pixel format, and that's obviously not enough (but 
was quick to implement...).

  Tomi


More information about the libcamera-devel mailing list