[libcamera-devel] [PATCH v4 0/5] Python bindings

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Fri Feb 4 14:38:09 CET 2022


Hi,

v4 of the RFC. I'm still not calling this "PATCH" due to the two hacks
in the series. I have not had too much time to work on this, but I
wanted to fix the easy ones.

Changes in this version:
- Add unittests.py
- Move cam.py files under a separate dir
- Rename the python module to "libcamera"
- Support array controls
- Rename StreamConfiguration.fmt to pixelFormat
- Cosmetic changes all around
- Rebased to latest master (and fixed the issues)

The two major issues not solved are related to the two HACK patches in
the series. I don't have a good solution for the Camera destructor
issue, although I did add a link to a pybind11 pull request which does
fix it. The other issue, exposing Camera from Request, should be
fixable, but needs a real amount of work.

I have tested this only on my PC. Unfortunately I wasn't able to run
libcamera on RPi anymore. I guess I need a custom built kernel now?

 Tomi

Tomi Valkeinen (5):
  HACK: libcamera: Camera public destructor
  HACK: libcamera: Request: expose Camera from Request
  Add Python bindings
  py: add unittests.py
  py: Add cam.py

 include/libcamera/camera.h   |   2 +-
 include/libcamera/request.h  |   2 +
 meson.build                  |   1 +
 meson_options.txt            |   5 +
 src/libcamera/request.cpp    |   5 +
 src/meson.build              |   1 +
 src/py/cam/cam.py            | 461 +++++++++++++++++++++++++++++++++++
 src/py/cam/cam_kms.py        | 183 ++++++++++++++
 src/py/cam/cam_null.py       |  46 ++++
 src/py/cam/cam_qt.py         | 355 +++++++++++++++++++++++++++
 src/py/cam/cam_qtgl.py       | 386 +++++++++++++++++++++++++++++
 src/py/cam/gl_helpers.py     |  67 +++++
 src/py/libcamera/__init__.py |  10 +
 src/py/libcamera/meson.build |  41 ++++
 src/py/libcamera/pymain.cpp  | 440 +++++++++++++++++++++++++++++++++
 src/py/meson.build           |   1 +
 src/py/test/unittests.py     | 366 +++++++++++++++++++++++++++
 subprojects/.gitignore       |   3 +-
 subprojects/pybind11.wrap    |  12 +
 19 files changed, 2385 insertions(+), 2 deletions(-)
 create mode 100755 src/py/cam/cam.py
 create mode 100644 src/py/cam/cam_kms.py
 create mode 100644 src/py/cam/cam_null.py
 create mode 100644 src/py/cam/cam_qt.py
 create mode 100644 src/py/cam/cam_qtgl.py
 create mode 100644 src/py/cam/gl_helpers.py
 create mode 100644 src/py/libcamera/__init__.py
 create mode 100644 src/py/libcamera/meson.build
 create mode 100644 src/py/libcamera/pymain.cpp
 create mode 100644 src/py/meson.build
 create mode 100755 src/py/test/unittests.py
 create mode 100644 subprojects/pybind11.wrap

-- 
2.25.1



More information about the libcamera-devel mailing list