[libcamera-devel] [PATCH v5 0/3] Python bindings

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Mon Mar 14 16:46:30 CET 2022


Hi,

This is v5 of the series. The changes to v4:

- Changed to pybind11 'smart_holders' branch which allows us to drop the
  HACK for Camera public destructor
- Changed Request.set_control() so that we can drop the HACK for
  exposing Camera from Request
- Moved Python enum defs to a separate file for clarity
- "Forward" declare Python classes to fix docstring issues.

The set_control change breaks the current users of that function.
Previously you could do this:

req.set_control("Brightness", 1)

Now you need to do:

cid = camera.find_control("Brightness")
req.set_control(cid, 1)

 Tomi

Tomi Valkeinen (3):
  Add Python bindings
  py: add unittests.py
  py: Add cam.py

 meson.build                  |   1 +
 meson_options.txt            |   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 |  43 ++++
 src/py/libcamera/pyenums.cpp |  53 ++++
 src/py/libcamera/pymain.cpp  | 453 ++++++++++++++++++++++++++++++++++
 src/py/meson.build           |   1 +
 src/py/test/unittests.py     | 364 +++++++++++++++++++++++++++
 subprojects/.gitignore       |   3 +-
 subprojects/pybind11.wrap    |   6 +
 17 files changed, 2437 insertions(+), 1 deletion(-)
 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/pyenums.cpp
 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