From 77ae64eb24bf6c2fe241b6f7b841315b1ee15707 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 29 Apr 2019 15:15:23 +0300 Subject: libcamera: Refactor the camera configuration storage and API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor the CameraConfiguration structure to not rely on Stream instances. This is a step towards making the camera configuration object more powerful with configuration validation using "try" semantics. The CameraConfiguration now exposes a simple vector-like API to access the contained stream configurations. Both operator[]() and at() are provided to access elements. The isEmpty() method is renamed to empty() and the methods reordered to match the std::vector class. As applications need access to the Stream instances associated with the configuration entries in order to associate buffers with streams when creating requests, expose the stream selected by the pipeline handler through a new StreamConfiguration::stream(). Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libcamera/pipeline/rkisp1') diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 4bd8c510..ec6980b0 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -36,8 +36,7 @@ public: CameraConfiguration generateConfiguration(Camera *camera, const StreamRoles &roles) override; - int configure(Camera *camera, - const CameraConfiguration &config) override; + int configure(Camera *camera, CameraConfiguration &config) override; int allocateBuffers(Camera *camera, const std::set &streams) override; @@ -117,16 +116,15 @@ CameraConfiguration PipelineHandlerRkISP1::generateConfiguration(Camera *camera, cfg.size = data->sensor_->resolution(); cfg.bufferCount = RKISP1_BUFFER_COUNT; - config[&data->stream_] = cfg; + config.addConfiguration(cfg); return config; } -int PipelineHandlerRkISP1::configure(Camera *camera, - const CameraConfiguration &config) +int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration &config) { RkISP1CameraData *data = cameraData(camera); - const StreamConfiguration &cfg = config[&data->stream_]; + StreamConfiguration &cfg = config[0]; CameraSensor *sensor = data->sensor_; int ret; @@ -217,6 +215,8 @@ int PipelineHandlerRkISP1::configure(Camera *camera, return -EINVAL; } + cfg.setStream(&data->stream_); + return 0; } -- cgit v1.2.1