[libcamera-devel] [PATCH v3 00/30] More misc Python patches

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Fri May 27 16:44:17 CEST 2022


Hi,

This series just seems to grow...

Main changes to v2:
- Fixed, I hope, all the comments from Laurent
- --mode option for gen-py-controls.py
- Fixed the missing call to init_py_properties_generated()
- Added a bunch of new patches

I've moved the examples on top of all the other patches. I added
simple-cam.py, which is a copy of the .cpp version.

I still like the simple-capture.py and simple-continuous-capture.py,
though.

simple-capture.py is very simple, but it does all the work in a
single main function, and should be a good way to get familiar with the
concepts even if it's perhaps not useful in the real life.

simple-continuous-capture.py takes it further and makes it more
realistic, but also more complex as it adds a few functions, also
handles keyboard input, adds a class to store the context, etc.

simple-continuous-capture.py and simple-cam.py are somewhat different,
as the simple-cam.py follows the .cpp version as strictly as it can,
whereas in simple-continuous-capture.py we use the nice extra stuff from
Python.

I didn't really touch itest.py much. We can leave that out for the time
being, although I find myself using it often.

 Tomi

Tomi Valkeinen (30):
  py: Generate pixel formats list
  py: cam_qt: Use libcamera.formats
  py: cam: Cleanups
  py: Fix SceneFlicker enum values
  py: Fix None value in ControlType enum
  py: Add CameraManager.read_event()
  py: Move MappedFrameBuffer to libcamera.utils
  py: MappedFrameBuffer: Add type hints & docs
  py: cam: Drop WA_ShowWithoutActivating
  py: cam: Convert ctx and state to classes
  py: Add README.md
  py: Re-implement controls geneneration
  py: Re-structure the controls API
  py: Rename 'efd' to 'event_fd'
  py: Generate bindings for properties
  py: Use ln --relative to create symlinks
  py: unittests: Fix test_sleep()
  py: unittests: Fix test_select()
  py: cam: Move conversion funcs to helpers.py
  py: cam: Drop PIL dependency
  py: Add Request.__str__()
  py: Add FrameMetadataPlane
  py: Implement FrameBufferPlane
  py: MappedFrameBuffer: Support non-contextmanager use
  py: MappedFrameBuffer: Add 'fb' property
  py: cam: cam_qt: mmap the fbs only once
  py: examples: Add simple-capture.py
  py: examples: Add simple-continuous-capture.py
  py: examples: Add itest.py
  py: examples: Add simple-cam.py

 src/py/README.md                              |  60 ++
 src/py/cam/cam.py                             | 583 +++++++++---------
 src/py/cam/cam_kms.py                         |  20 +-
 src/py/cam/cam_null.py                        |  10 +-
 src/py/cam/cam_qt.py                          | 259 ++------
 src/py/cam/cam_qtgl.py                        |  34 +-
 src/py/cam/{cam_qt.py => helpers.py}          | 178 +-----
 src/py/examples/itest.py                      | 197 ++++++
 src/py/examples/simple-cam.py                 | 352 +++++++++++
 src/py/examples/simple-capture.py             | 159 +++++
 src/py/examples/simple-continuous-capture.py  | 201 ++++++
 src/py/libcamera/__init__.py                  |  80 ---
 ...py-control-enums.py => gen-py-controls.py} |  46 +-
 src/py/libcamera/gen-py-formats.py            |  56 ++
 src/py/libcamera/meson.build                  |  46 +-
 ...ed.cpp.in => py_controls_generated.cpp.in} |  17 +-
 src/py/libcamera/py_enums.cpp                 |   2 +-
 ...ted.cpp.in => py_formats_generated.cpp.in} |  14 +-
 src/py/libcamera/py_main.cpp                  | 184 +++---
 .../libcamera/py_properties_generated.cpp.in  |  30 +
 .../MappedFrameBuffer.py}                     |  61 +-
 src/py/libcamera/utils/__init__.py            |   4 +
 test/py/unittests.py                          |  21 +-
 23 files changed, 1691 insertions(+), 923 deletions(-)
 create mode 100644 src/py/README.md
 copy src/py/cam/{cam_qt.py => helpers.py} (51%)
 create mode 100755 src/py/examples/itest.py
 create mode 100755 src/py/examples/simple-cam.py
 create mode 100755 src/py/examples/simple-capture.py
 create mode 100755 src/py/examples/simple-continuous-capture.py
 rename src/py/libcamera/{gen-py-control-enums.py => gen-py-controls.py} (60%)
 create mode 100755 src/py/libcamera/gen-py-formats.py
 copy src/py/libcamera/{py_control_enums_generated.cpp.in => py_controls_generated.cpp.in} (50%)
 rename src/py/libcamera/{py_control_enums_generated.cpp.in => py_formats_generated.cpp.in} (56%)
 create mode 100644 src/py/libcamera/py_properties_generated.cpp.in
 copy src/py/libcamera/{__init__.py => utils/MappedFrameBuffer.py} (56%)
 create mode 100644 src/py/libcamera/utils/__init__.py

-- 
2.34.1



More information about the libcamera-devel mailing list