From patchwork Mon Apr 1 10:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 824 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 20904600F9 for ; Mon, 1 Apr 2019 12:13:38 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 9FF391BF207; Mon, 1 Apr 2019 10:13:37 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Apr 2019 12:14:09 +0200 Message-Id: <20190401101410.4984-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401101410.4984-1-jacopo@jmondi.org> References: <20190401101410.4984-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 1/2] libcamera: stream: Implement StreamProperties X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2019 10:13:38 -0000 Add definition for the StreamProperties and StreamUsage classes. Use them in the IPU3 pipeline handler to store stream-specific properties, and extend the StreamProperties base class with IPU3 specific parameters, such as the desired ImgU pipeline mode. Also add an 'hints' field to StreamConfiguration to implement matching between the stream properties and a requested configuration. Signed-off-by: Jacopo Mondi --- include/libcamera/meson.build | 1 + include/libcamera/stream.h | 7 ++ include/libcamera/stream_usages.h | 20 ++++ src/libcamera/include/stream_properties.h | 41 ++++++++ src/libcamera/meson.build | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 45 ++++++++ src/libcamera/stream.cpp | 25 +++++ src/libcamera/stream_properties.cpp | 121 ++++++++++++++++++++++ 8 files changed, 261 insertions(+) create mode 100644 include/libcamera/stream_usages.h create mode 100644 src/libcamera/include/stream_properties.h create mode 100644 src/libcamera/stream_properties.cpp diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 3f4d1e28208b..25901303b97d 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -9,6 +9,7 @@ libcamera_api = files([ 'request.h', 'signal.h', 'stream.h', + 'stream_usages.h', 'timer.h', ]) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 970c479627fa..afcc4ff08923 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -7,7 +7,10 @@ #ifndef __LIBCAMERA_STREAM_H__ #define __LIBCAMERA_STREAM_H__ +#include + #include +#include namespace libcamera { @@ -19,6 +22,10 @@ struct StreamConfiguration { unsigned int pixelFormat; unsigned int bufferCount; + + std::forward_list hints; + + bool supports(const enum StreamUsage &usage) const; }; class Stream final diff --git a/include/libcamera/stream_usages.h b/include/libcamera/stream_usages.h new file mode 100644 index 000000000000..9f7358954181 --- /dev/null +++ b/include/libcamera/stream_usages.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * stream_usages.h - Definition of stream usage hints + */ +#ifndef __LIBCAMERA_STREAM_USAGES_H__ +#define __LIBCAMERA_STREAM_USAGES_H__ + +namespace libcamera { + +enum StreamUsage { + VIEWFINDER, + VIDEO_RECORDING, + STILL_CAPTURE, +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_STREAM_USAGES_H__ */ diff --git a/src/libcamera/include/stream_properties.h b/src/libcamera/include/stream_properties.h new file mode 100644 index 000000000000..ced8bb931bf6 --- /dev/null +++ b/src/libcamera/include/stream_properties.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * stream_properties.h - Properties associated with a camera stream + */ + +#ifndef __LIBCAMERA_STREAM_PROPERTIES_H__ +#define __LIBCAMERA_STREAM_PROPERTIES_H__ + +#include +#include + +#include +#include + +#include "formats.h" + +namespace libcamera { + +class StreamProperties { +public: + virtual ~StreamProperties() { } + + void addUsage(const enum StreamUsage &usage); + void addFormat(unsigned int pixfmt, std::vector sizes); + + const std::string &name() const { return name_; } + void setName(const std::string &name); + + virtual bool match(const StreamConfiguration &config) const; + +private: + std::forward_list usages_; + FormatEnum formats_; + std::string name_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_STREAM_USAGES_H__ */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 4433abfceca3..b00a34919c2c 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -16,6 +16,7 @@ libcamera_sources = files([ 'request.cpp', 'signal.cpp', 'stream.cpp', + 'stream_properties.cpp', 'timer.cpp', 'v4l2_device.cpp', 'v4l2_subdevice.cpp', diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 69b40aa0026b..46479944a4da 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -14,12 +14,14 @@ #include #include #include +#include #include "device_enumerator.h" #include "geometry.h" #include "log.h" #include "media_device.h" #include "pipeline_handler.h" +#include "stream_properties.h" #include "utils.h" #include "v4l2_device.h" #include "v4l2_subdevice.h" @@ -28,6 +30,17 @@ namespace libcamera { LOG_DEFINE_CATEGORY(IPU3) +class IPU3StreamProperties : public StreamProperties +{ +public: + static constexpr unsigned int IMGU_VIDEO_MODE = 0; + static constexpr unsigned int IMGU_STILL_MODE = 1; + + ~IPU3StreamProperties() { } + + unsigned int pipelineMode; +}; + static int mediaBusToCIO2Format(unsigned int code) { switch (code) { @@ -222,6 +235,7 @@ private: Stream outStream_; Stream vfStream_; + std::map streamProps_; /* Absolute miniumum and maximum sizes. */ SizeRange sizes_; @@ -811,6 +825,37 @@ int PipelineHandlerIPU3::registerCameras() data->imgu_->viewfinder_->bufferReady.connect(data.get(), &IPU3CameraData::imguCaptureBufferReady); + + /* + * Prepare the enumerations of formats supported by the + * streams. + * + * \todo: As of now, only support continous size ranges. + */ + SizeRange &cio2MaxSize = cio2->maxSizes_.second; + SizeRange ipu3StreamSizes(1, 1, cio2MaxSize.maxWidth, + cio2MaxSize.maxHeight); + + /* Fill in the properties for each supported stream. */ + IPU3StreamProperties outputStreamProps; + outputStreamProps.setName("output"); + outputStreamProps.addUsage(STILL_CAPTURE); + outputStreamProps.addFormat(V4L2_PIX_FMT_NV12, + { ipu3StreamSizes } ); + outputStreamProps.pipelineMode = + IPU3StreamProperties::IMGU_STILL_MODE; + data->streamProps_[&data->outStream_] = outputStreamProps; + + IPU3StreamProperties viewfinderStreamProps; + viewfinderStreamProps.setName("viewfinder"); + viewfinderStreamProps.addUsage(VIEWFINDER); + viewfinderStreamProps.addUsage(VIDEO_RECORDING); + viewfinderStreamProps.addFormat(V4L2_PIX_FMT_NV12, + { ipu3StreamSizes } ); + outputStreamProps.pipelineMode = + IPU3StreamProperties::IMGU_VIDEO_MODE; + data->streamProps_[&data->vfStream_] = viewfinderStreamProps; + /* Create and register the Camera instance. */ std::string cameraName = cio2->name() + " " + std::to_string(id); diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index c4943c91b2e6..7b8d6ac4f895 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -60,6 +60,31 @@ namespace libcamera { * \brief Requested number of buffers to allocate for the stream */ +/** + * \var StreamConfiguration::hints + * \brief List of intended stream usages + * + * This field represents a list of intended stream usage hints. It is set + * by applications when requesting the stream's default configurations with + * Camera::streamConfiguration() method. + */ + +/** + * \brief Verify if a stream configuration supports a \a usage + * \param[in] usage The stream usage to verify + * + * \return True if the usage is supported, false otherwise + */ +bool StreamConfiguration::supports(const enum StreamUsage &usage) const +{ + for (const enum StreamUsage &hint : hints) { + if (hint == usage) + return true; + } + + return false; +} + /** * \class Stream * \brief Video stream for a camera diff --git a/src/libcamera/stream_properties.cpp b/src/libcamera/stream_properties.cpp new file mode 100644 index 000000000000..582b314b7bb6 --- /dev/null +++ b/src/libcamera/stream_properties.cpp @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * stream_properties.cpp - Properties associated with a camera stream + */ + +#include + +#include "log.h" +#include "stream_properties.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(PROPS) + +/** + * \class StreamProperties + * \brief Collect a stream characteristics and matches them against a + * requested stream configuration + * + * The StreamProperties class collects all the informations related to a + * Stream capabilities, including its name, the list of supported formats and + * sizes and the list of intended usages of the streams. + * + * Streams are created by pipeline handlers, and their static properties are + * represented by instances of this class, which pipeline handlers should + * internally associate with each of its streams. + * + * The stream properties can be matched against a requested stream + * configuration, and this operations is usually performed by pipeline + * handlers trying to satisfy an application request at + * PipelineHander::streamConfiguration() time, where a list of + * StreamConfiguration instances gets associated with a list of Streams. + * + * Pipeline handlers are free to sub-class StreamProperties to extend them + * and add platform-specific informations, as StreamProperties are not exposed + * to applications nor in the public library interface (for this reason, there + * is not direct dependencies between this class and the Stream one, which is + * publicly exposed and directly used by applications). The additional + * platform specific informations shall be used in the stream matching procedure + * or to store pipeline specific configuration parameters associated with a + * stream. + */ + +/** + * \brief Add a usage hint to the stream property + * \param[in] usage The usage hint + */ +void StreamProperties::addUsage(const enum StreamUsage &usage) +{ + usages_.push_front(usage); +} + +/** + * \brief Add a list of supported sizes associated with a pixel format + * \param[in] pixfmt The pixel format + * \param[in] sizes The list of size ranges + */ +void StreamProperties::addFormat(unsigned int pixfmt, + std::vector sizes) +{ + if (formats_.find(pixfmt) != formats_.end()) + LOG(PROPS, Error) << "Overwriting sizes associated with format " + << pixfmt; + + formats_[pixfmt] = sizes; +} + +/** + * \fn StreamProperties::name() + * \brief Retrieve the stream name + * + * \return The stream name + */ + +/** + * \brief Set the stream name + * \param[in] name The stream name + */ +void StreamProperties::setName(const std::string &name) +{ + name_ = name; +} + +/** + * \brief Compare the properties of a stream with a stream configuration request + * \param[in] config The requested stream configuration + * + * This helper method compares the properties of a stream with a stream + * requested configuration. Its intended users are pipeline handlers that + * receive stream configurations and try to match them with a stream that + * satisfies the request parameters. + * + * A StreamProperties satisfies the requested \a config when: + * 1) The requested pixel format is listed in the property's formats map; + * 2) The requested sizes are included in the supported size intervals list in + * the property's formats map; + * 3) At least one of the requested usage hints is reported in the property's + * list of intended usages; + * + * If all the above criteria as satisfied, the helper return true and the + * stream associated with the property matches the requested configuration. + * + * \return True if the stream's properties satisfy the requested configuration, + * false otherwise + */ +bool StreamProperties::match(const StreamConfiguration &config) const +{ + /* \todo: as a proof of concept, right now only match on 'hints'. */ + for (const enum StreamUsage &usage : usages_) { + for (const enum StreamUsage &hint : config.hints) { + if (usage == hint) + return true; + } + } + + return false; +} + +} /* namespace libcamera */ From patchwork Mon Apr 1 10:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 825 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BD4C1600F9 for ; Mon, 1 Apr 2019 12:13:38 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 497F61BF214; Mon, 1 Apr 2019 10:13:38 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Apr 2019 12:14:10 +0200 Message-Id: <20190401101410.4984-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401101410.4984-1-jacopo@jmondi.org> References: <20190401101410.4984-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 2/2] libcamera: Modify streamConfiguration() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2019 10:13:39 -0000 Modify streamConfiguration() along the whole library stack: - streamConfiguration receives a list of required stream configurations - the camera, with support of the pipeline handler, associates one stream to each requested configuration - application modifies the received configuration and provide it to configureStreams() Implement stream matching in the IPU3 pipeline handler and modify the camera application use the new API and capture from output and viewfinder with different resolutions. Signed-off-by: Jacopo Mondi --- include/libcamera/camera.h | 2 +- src/cam/main.cpp | 48 +++++++------- src/libcamera/camera.cpp | 30 ++++----- src/libcamera/include/pipeline_handler.h | 3 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 82 ++++++++++++++++-------- src/libcamera/pipeline/uvcvideo.cpp | 4 +- src/libcamera/pipeline/vimc.cpp | 4 +- src/libcamera/pipeline_handler.cpp | 23 ++++--- 8 files changed, 118 insertions(+), 78 deletions(-) diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index bfd574a25070..01e0188468c1 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -44,7 +44,7 @@ public: const std::set &streams() const; std::map - streamConfiguration(std::set &streams); + streamConfiguration(std::list &configs); int configureStreams(std::map &config); int allocateBuffers(); diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 4608c2bc6f3c..fd94629e0726 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -5,6 +5,7 @@ * main.cpp - cam - The libcamera swiss army knife */ +#include #include #include #include @@ -90,39 +91,42 @@ static int configureStreams(Camera *camera, std::set &streams, std::map &config) { KeyValueParser::Options format = options[OptFormat]; - auto it = streams.begin(); - Stream *output = *it; - Stream *viewfinder = *(++it); - - std::map defaultConfig = - camera->streamConfiguration(streams); + std::list streamConfs; + StreamConfiguration outputConfig = {}; if (options.isSet(OptFormat)) { if (format.isSet("width")) - defaultConfig[output].width = format["width"]; + outputConfig.width = format["width"]; if (format.isSet("height")) - defaultConfig[output].height = format["height"]; + outputConfig.height = format["height"]; /* TODO: Translate 4CC string to ID. */ if (format.isSet("pixelformat")) - defaultConfig[output].pixelFormat = format["pixelformat"]; + outputConfig.pixelFormat = format["pixelformat"]; } + outputConfig.hints.push_front(STILL_CAPTURE); + streamConfs.push_back(outputConfig); - /* Configure the secondary output stream. */ - defaultConfig[viewfinder].width = 640; - defaultConfig[viewfinder].height = 480; + StreamConfiguration vfConfig = {}; + vfConfig.hints.push_front(VIEWFINDER); + streamConfs.push_back(vfConfig); - /* - * HACK: Select which stream to capture: use output if required, - * use viewfinder if required or if no option has been specified - * from the command line. - */ - if (options.isSet(OptOutput)) - config[output] = defaultConfig[output]; - if (options.isSet(OptViefinder) || - (!options.isSet(OptViefinder) && !options.isSet(OptOutput))) - config[viewfinder] = defaultConfig[viewfinder]; + config = camera->streamConfiguration(streamConfs); + if (config.empty()) { + std::cout << "Cannot configure the requested streams" + << std::endl; + return -EINVAL; + } + + for (auto &map : config) { + StreamConfiguration *c = &map.second; + + if (c->supports(VIEWFINDER)) { + c->width = 640; + c->height = 480; + } + } return camera->configureStreams(config); } diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 99eb0e6876f0..f2ae3d3e2d9a 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -346,32 +346,30 @@ const std::set &Camera::streams() const /** * \brief Retrieve a group of stream configurations - * \param[in] streams A map of stream IDs and configurations to setup + * \param[in] configs A set of requested stream configurations * - * Retrieve the camera's configuration for a specified group of streams. The - * caller can specifies which of the camera's streams to retrieve configuration - * from by populating \a streams. - * - * The easiest way to populate the array of streams to fetch configuration from - * is to first retrieve the camera's full array of stream with streams() and - * then potentially trim it down to only contain the streams the caller - * are interested in. + * Retrieve a list of streams and associated default configurations in the + * camera. The caller specifies the properties a stream shall satisfy by + * populating \a config and the camera associates each supplied configuration + * with a stream that matches the requested properties. The requested + * per-stream configuration might be modified by the camera to report the + * stream default parameters. The callers of this function are free to adjust + * the default paramters and provide such configuration to the + * configureStreams() method. * * \return A map of successfully retrieved stream IDs and configurations or an * empty list on error. */ std::map -Camera::streamConfiguration(std::set &streams) +Camera::streamConfiguration(std::list &configs) { - if (disconnected_ || !streams.size()) + if (disconnected_ || !configs.size()) return std::map{}; - for (Stream *stream : streams) { - if (streams_.find(stream) == streams_.end()) - return std::map{}; - } + if (configs.size() > streams_.size()) + return std::map{}; - return pipe_->streamConfiguration(this, streams); + return pipe_->streamConfiguration(this, configs); } /** diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index 6cdadcbdc3ea..ff9f265fe880 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -56,7 +56,8 @@ public: virtual bool match(DeviceEnumerator *enumerator) = 0; virtual std::map - streamConfiguration(Camera *camera, std::set &streams) = 0; + streamConfiguration(Camera *camera, + std::list &config) = 0; virtual int configureStreams(Camera *camera, std::map &config) = 0; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 46479944a4da..52583b2beefd 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -197,7 +197,7 @@ public: std::map streamConfiguration(Camera *camera, - std::set &streams) override; + std::list &confs) override; int configureStreams(Camera *camera, std::map &config) override; @@ -318,36 +318,66 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3() std::map PipelineHandlerIPU3::streamConfiguration(Camera *camera, - std::set &streams) + std::list &confs) { - std::map configs; + std::map configs = {}; IPU3CameraData *data = cameraData(camera); - StreamConfiguration config = {}; + + std::list availableStreams; + availableStreams.push_front(&data->outStream_); + availableStreams.push_front(&data->vfStream_); /* - * FIXME: Soraka: the maximum resolution reported by both sensors - * (2592x1944 for ov5670 and 4224x3136 for ov13858) are returned as - * default configurations but they're not correctly processed by the - * ImgU. Resolutions up tp 2560x1920 have been validated. - * - * \todo Clarify ImgU alignement requirements. + * Try to match all the requested stream configurations with all + * the streams available in the camera. */ - config.width = 2560; - config.height = 1920; - config.pixelFormat = V4L2_PIX_FMT_NV12; - config.bufferCount = IPU3_BUFFER_COUNT; - - configs[&data->outStream_] = config; - LOG(IPU3, Debug) - << "Stream 'output' format set to " << config.width << "x" - << config.height << "-0x" << std::hex << std::setfill('0') - << std::setw(8) << config.pixelFormat; - - configs[&data->vfStream_] = config; - LOG(IPU3, Debug) - << "Stream 'viewfinder' format set to " << config.width << "x" - << config.height << "-0x" << std::hex << std::setfill('0') - << std::setw(8) << config.pixelFormat; + for (auto it = confs.begin(); it != confs.end(); ++it) { + StreamConfiguration &conf = *it; + auto sit = availableStreams.begin(); + + while (sit != availableStreams.end()) { + IPU3StreamProperties *props = &data->streamProps_[*sit]; + + if (!props->match(conf)) { + ++sit; + continue; + } + + /* + * FIXME: Soraka: the maximum resolution reported by + * both sensors (2592x1944 for ov5670 and 4224x3136 for + * ov13858) are returned as default configurations but + * they're not correctly processed by the ImgU. + * Resolutions up tp 2560x1920 have been validated. + * + * \todo Clarify ImgU alignement requirements. + */ + conf.width = 2560; + conf.height = 1920; + conf.pixelFormat = V4L2_PIX_FMT_NV12; + conf.bufferCount = IPU3_BUFFER_COUNT; + configs[*sit] = conf; + + LOG(IPU3, Debug) + << "Stream " << props->name() + << " format set to " << conf.width << "x" + << conf.height << "-0x" << std::hex + << std::setfill('0') << std::setw(8) + << conf.pixelFormat; + + /* + * Once the stream has been assigned, remove it + * from the list of available ones. + */ + availableStreams.erase(sit); + break; + } + if (sit == availableStreams.end()) { + LOG(IPU3, Error) + << "Cannot satisfy the requested configuration"; + return std::map {}; + } + } return configs; } diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index d571b8b4ea83..a88784b28189 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -28,7 +28,7 @@ public: std::map streamConfiguration(Camera *camera, - std::set &streams) override; + std::list &confs) override; int configureStreams(Camera *camera, std::map &config) override; @@ -86,7 +86,7 @@ PipelineHandlerUVC::~PipelineHandlerUVC() std::map PipelineHandlerUVC::streamConfiguration(Camera *camera, - std::set &streams) + std::list &confs) { UVCCameraData *data = cameraData(camera); diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index e83416effad8..e36a58e70f8c 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -28,7 +28,7 @@ public: std::map streamConfiguration(Camera *camera, - std::set &streams) override; + std::list &confs) override; int configureStreams(Camera *camera, std::map &config) override; @@ -86,7 +86,7 @@ PipelineHandlerVimc::~PipelineHandlerVimc() std::map PipelineHandlerVimc::streamConfiguration(Camera *camera, - std::set &streams) + std::list &confs) { VimcCameraData *data = cameraData(camera); std::map configs; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 82070d364c03..2dc78d7f0b5e 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -183,18 +183,25 @@ PipelineHandler::~PipelineHandler() /** * \fn PipelineHandler::streamConfiguration() - * \brief Retrieve a group of stream configurations for a specified camera + * \brief Retrieve the streams matching a configurations for a specified camera * \param[in] camera The camera to fetch default configuration from - * \param[in] streams An array of streams to fetch information about + * \param[in] config The list of requested stream configurations * - * Retrieve the species camera's default configuration for a specified group of - * streams. The caller shall populate the \a streams array with the streams it - * wish to fetch the configuration from. The map of streams and configuration - * returned can then be examined by the caller to learn about the defualt - * parameters for the specified streams. + * For each provided stream configuration request, retrieve a stream in the + * camera that satisfies it and return it with an associated default + * configuration. + * + * The caller shall populate the \a config array with the stream configurations + * it wishes to have satisfied, specifying the requested sizes, formats and the + * stream's intended usage. The pipeline handler retrieves a stream that matches + * the characteristics reported in the configuration and associates it a default + * configuration in the returned map. + * + * The returned map can then be examined by the caller to learn about the + * defualt parameters for the returned streams. * * The intended companion to this is \a configureStreams() which can be used to - * change the group of streams parameters. + * change each stream parameters and have them applied in the Camera. * * \return A map of successfully retrieved streams and configurations or an * empty map on error.