From 0d913813b53564e83980f53204bb517095c866f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sat, 26 Jan 2019 21:19:57 +0100 Subject: libcamera: pipeline: extend pipelines to support stream configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All streams which are to be used for capture need to be configured at the same time. This allows the pipeline handler to take any dependencies between the different streams and their configuration into account when setting up the hardware. Extend the pipeline API and all pipeline implementations with two new functions, one to read a default configuration and one to set a new configuration. Both functions operate on a group of streams which the pipeline handler should consider when performing the operations. In the current implemented pipelines this is rather easy as they only have one stream each per camera. Furthermore as there is yet no way for the pipeline handlers to interact with the hardware all they do is return a null format, log that a default configuration has been requested and log that a new configuration has been set. Future work based on more components are needed to make the pipelines return a good default format and actually interact with the hardware. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/vimc.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/libcamera/pipeline/vimc.cpp') diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 9e1cf11a..6ed069ed 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -9,17 +9,26 @@ #include #include "device_enumerator.h" +#include "log.h" #include "media_device.h" #include "pipeline_handler.h" namespace libcamera { +LOG_DEFINE_CATEGORY(VIMC) + class PipeHandlerVimc : public PipelineHandler { public: PipeHandlerVimc(CameraManager *manager); ~PipeHandlerVimc(); + std::map + streamConfiguration(Camera *camera, + std::vector &streams) override; + int configureStreams(Camera *camera, + std::map &config) override; + bool match(DeviceEnumerator *enumerator); private: @@ -38,6 +47,32 @@ PipeHandlerVimc::~PipeHandlerVimc() media_->release(); } +std::map +PipeHandlerVimc::streamConfiguration(Camera *camera, + std::vector &streams) +{ + std::map configs; + + StreamConfiguration config{}; + + LOG(VIMC, Info) << "TODO: Return a good default format"; + + configs[&stream_] = config; + + return configs; +} + +int PipeHandlerVimc::configureStreams(Camera *camera, + std::map &config) +{ + StreamConfiguration *cfg = &config[&stream_]; + + LOG(VIMC, Info) << "TODO: Configure the camera for resolution " + << cfg->width << "x" << cfg->height; + + return 0; +} + bool PipeHandlerVimc::match(DeviceEnumerator *enumerator) { DeviceMatch dm("vimc"); -- cgit v1.2.1