[libcamera-devel] [RFC PATCH 0/8] Configuration files and parsing
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Nov 23 17:43:11 CET 2020
A preliminary posting of a series which allows me to parse controls on a
CameraSensor from a json file which overrides the location and rotation
properties.
For example, creating a camera_sensor.json file within the libcamera
sysconf paths, with the following content can manually set the
properties:
pi at mercury:~/libcamera $ cat /usr/local/etc/libcamera/camera_sensor.json
{
"/base/soc/i2c0mux/i2c at 1/imx219 at 10": {
"properties": {
"Rotation" : 270,
"Location" : 0
}
}
}
This implementation exposes the nlohmann json library to libcamera
internals rather than wrapping it and re-encoding a generic any-type
into another type.
The series starts out by cleaning up our meson files to easily obtain
and parse the system paths from our config.h and cleans up the IPA meson
to re-use those new variables.
The Configuration class instance itself is really only about finding and
parsing the configuration files, and how the data is parsed is up to the
internal code that needs to use the files.
Kieran Bingham (8):
meson: Simplify pkg_mod.generate
src: meson: Re-order subdir layout
src: meson: Simplify v4l2 enablement
src: meson: Define system paths
src: ipa: meson: Re-use existing system paths
libcamera: Add configuration interface
test: Add configuration parser tests
libcamera: camera_sensor: Parse configuration properties
README.rst | 2 +-
include/libcamera/internal/camera_sensor.h | 1 +
include/libcamera/internal/configuration.h | 37 ++++++++
meson.build | 3 +-
src/ipa/meson.build | 16 ++--
src/libcamera/camera_sensor.cpp | 50 ++++++++++
src/libcamera/configuration.cpp | 91 ++++++++++++++++++
src/libcamera/meson.build | 1 +
src/meson.build | 23 ++++-
src/v4l2/meson.build | 4 +
test/configuration.cpp | 105 +++++++++++++++++++++
test/data/test_configuration.json | 15 +++
test/data/unparsable.json | 7 ++
test/meson.build | 1 +
14 files changed, 339 insertions(+), 17 deletions(-)
create mode 100644 include/libcamera/internal/configuration.h
create mode 100644 src/libcamera/configuration.cpp
create mode 100644 test/configuration.cpp
create mode 100644 test/data/test_configuration.json
create mode 100644 test/data/unparsable.json
--
2.25.1
More information about the libcamera-devel
mailing list