[libcamera-devel] [PATCH v3 17/18] py: generate pixel formats list
Tomi Valkeinen
tomi.valkeinen at ideasonboard.com
Wed May 18 17:00:01 CEST 2022
On 18/05/2022 16:54, Laurent Pinchart wrote:
> Hi Tomi,
>
> Thank you for the patch.
>
> On Wed, May 18, 2022 at 04:13:28PM +0300, Tomi Valkeinen wrote:
>> Generate a list of pixel formats under "libcamera.formats".
>>
>> I'm not super happy about this solution, as the user can change the
>> formats (libcamera.formats.XRGB8888 = None) and, for some reason,
>
> I won't make it a blocker for this patch, but is there a way this could
> be fixed ?
Another way would be to:
class dummy_base {};
void init_py_formats_generated(py::module& m)
{
py::class_<dummy_base>(m, "formats")
.def_readonly_static("R8", &libcamera::formats::R8)
.def_readonly_static("R10", &libcamera::formats::R10)
.def_readonly_static("R12", &libcamera::formats::R12)
...
So, we would create a class to hold the formats, and then we can use
def_readonly_static. We do need a C++ base class, thus the dummy_base...
If we don't mind changing the API a bit, we could have these readonly
statics inside PixelFormat, so:
libcamera.PixelFormat.MJPEG
Tomi
More information about the libcamera-devel
mailing list