[libcamera-devel] [RFC 0/4] prototype python bindings

Tomi Valkeinen tomi.valkeinen at iki.fi
Fri Sep 18 17:20:15 CEST 2020


Hi,

Laurent asked me to send these to get discussions about the challenges
on the list (rather than in private chats...).

This is a prototype, RFC, hack, whatever you want to call it, but it
works for me for the small subset of features used in test.py.

The main patch "libcamera python bindings" has some questions/issues
listed in the description, and I've added comments to the code where I'm
not sure where to go.

There were no submodules in libcamera, so I used the same convention
I've used in kms++: ext/<submodule>. pybind11 could be added as
something that comes from the system (at least Ubuntu 20.04 has it), but
as it's header only, I think having it as a submodule is the easiest and
most manageable way to add it.

 Tomi

Tomi Valkeinen (4):
  Add pybind11 submodule
  Add BoundMethodFunction
  hack: Camera public destructor
  libcamera python bindings

 .gitmodules                      |   3 +
 ext/pybind11                     |   1 +
 include/libcamera/bound_method.h |  25 +++++
 include/libcamera/camera.h       |   2 +-
 include/libcamera/signal.h       |   6 ++
 meson.build                      |   1 +
 meson_options.txt                |   2 +
 py/meson.build                   |   1 +
 py/pycamera/__init__.py          |  29 +++++
 py/pycamera/meson.build          |  35 ++++++
 py/pycamera/pymain.cpp           | 169 +++++++++++++++++++++++++++++
 py/test/run-valgrind.sh          |   3 +
 py/test/run.sh                   |   3 +
 py/test/test.py                  | 177 +++++++++++++++++++++++++++++++
 py/test/valgrind-pycamera.supp   |  17 +++
 15 files changed, 473 insertions(+), 1 deletion(-)
 create mode 100644 .gitmodules
 create mode 160000 ext/pybind11
 create mode 100644 py/meson.build
 create mode 100644 py/pycamera/__init__.py
 create mode 100644 py/pycamera/meson.build
 create mode 100644 py/pycamera/pymain.cpp
 create mode 100755 py/test/run-valgrind.sh
 create mode 100755 py/test/run.sh
 create mode 100755 py/test/test.py
 create mode 100644 py/test/valgrind-pycamera.supp

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



More information about the libcamera-devel mailing list