[libcamera-devel] [RFC v2 0/4] prototype python bindings
Tomi Valkeinen
tomi.valkeinen at iki.fi
Fri Nov 27 14:37:34 CET 2020
Hi,
It's been a while since the v1 RFC, and even if I haven't had much time
to work on this, I thought it's time to send a new version, at least to
avoid anyone testing the old one.
Too many changes to v1 to mention them all (not that I even
remember...), but a few here:
- Use meson subprojects for pybind11. The public subproject repository
didn't have a recent pybind11, so I have pybind11 2.6.0 packaged here
in a separate patch.
- Use eventfd to convey events from C++ to Python. This gets rid of
multiple issues, e.g. the locking problems and the callback
subscriptions.
- simplecamera.py: a "simple" camera class which hopefully makes
libcamera more natural to use from python (compared to the very c++
like API that the basic bindings provide).
- Some new tests:
* test.py: simple test that just captures frames and exists
* drmtest.py: uses kms++ python bindings to show the captured images
on screen.
* icam.py: Meant to run in an interactive python session. Uses Qt to
* show (possibly from multiple cameras) captured images. One can
adjust the cameras & controls via the python shell.
Some clear issues are still present:
- Memory management, especially related to Requests and FBs is still not
clear.
- Not all control types are supported.
- There are open parts in the SimpleCamera config sequences. It must be
simple, but you also have to be able to do everything, and at the
moment it's a bit of a mess.
This is not a request to review as such, as I know there are plenty of
things to fix. I think the best feedback would be on the area of
thoughts about the API in general, or ideas on how to solve the issues.
Tomi
Tomi Valkeinen (4):
hack: Camera public destructor
HACK: expose Camera* from Request
libcamera python bindings
py: update pybind11 wrap to 2.6.0
.gitignore | 2 +
include/libcamera/camera.h | 2 +-
include/libcamera/request.h | 1 +
meson_options.txt | 2 +
src/libcamera/request.cpp | 5 +
src/meson.build | 1 +
src/py/meson.build | 1 +
src/py/pycamera/__init__.py | 11 +
src/py/pycamera/meson.build | 38 ++
src/py/pycamera/pymain.cpp | 382 ++++++++++++++++++
src/py/test/drmtest.py | 129 ++++++
src/py/test/icam.py | 154 +++++++
src/py/test/run-valgrind.sh | 6 +
src/py/test/run.sh | 3 +
src/py/test/simplecamera.py | 198 +++++++++
src/py/test/test.py | 210 ++++++++++
src/py/test/valgrind-pycamera.supp | 17 +
.../packagecache/pybind11-2.6.0-wrap.zip | Bin 0 -> 1456 bytes
subprojects/packagecache/pybind11-2.6.0.zip | Bin 0 -> 727287 bytes
subprojects/pybind11.wrap | 10 +
20 files changed, 1171 insertions(+), 1 deletion(-)
create mode 100644 src/py/meson.build
create mode 100644 src/py/pycamera/__init__.py
create mode 100644 src/py/pycamera/meson.build
create mode 100644 src/py/pycamera/pymain.cpp
create mode 100755 src/py/test/drmtest.py
create mode 100755 src/py/test/icam.py
create mode 100755 src/py/test/run-valgrind.sh
create mode 100755 src/py/test/run.sh
create mode 100644 src/py/test/simplecamera.py
create mode 100755 src/py/test/test.py
create mode 100644 src/py/test/valgrind-pycamera.supp
create mode 100644 subprojects/packagecache/pybind11-2.6.0-wrap.zip
create mode 100644 subprojects/packagecache/pybind11-2.6.0.zip
create mode 100644 subprojects/pybind11.wrap
--
2.25.1
More information about the libcamera-devel
mailing list