From patchwork Tue Apr 2 00:53:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 833 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E66D76110A for ; Tue, 2 Apr 2019 02:54:00 +0200 (CEST) X-Halon-ID: cc5ff4f2-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id cc5ff4f2-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:53:58 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:53:28 +0200 Message-Id: <20190402005332.25018-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> References: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 1/5] cam: Rework how streams configuration is prepared 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: Tue, 02 Apr 2019 00:54:01 -0000 In preparation of reworking how a default configuration is retrieved from a camera separate preparation of stream configuration and applying of it into to different functions. Reason for this is that preparation of camera configuration will become more complex. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/main.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/cam/main.cpp b/src/cam/main.cpp index e7490c32f99a01ad..cc5302ca4e72ea6f 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -78,27 +78,27 @@ static int parseOptions(int argc, char *argv[]) return 0; } -static int configureStreams(Camera *camera, std::set &streams) +static int prepare_camera_config(std::map *config) { - KeyValueParser::Options format = options[OptFormat]; - Stream *id = *streams.begin(); - - std::map config = - camera->streamConfiguration(streams); + std::set streams = camera->streams(); + *config = camera->streamConfiguration(streams); + Stream *stream = config->begin()->first; if (options.isSet(OptFormat)) { + KeyValueParser::Options format = options[OptFormat]; + if (format.isSet("width")) - config[id].width = format["width"]; + (*config)[stream].width = format["width"]; if (format.isSet("height")) - config[id].height = format["height"]; + (*config)[stream].height = format["height"]; /* TODO: Translate 4CC string to ID. */ if (format.isSet("pixelformat")) - config[id].pixelFormat = format["pixelformat"]; + (*config)[stream].pixelFormat = format["pixelformat"]; } - return camera->configureStreams(config); + return 0; } static void requestComplete(Request *request, const std::map &buffers) @@ -136,18 +136,23 @@ static void requestComplete(Request *request, const std::map static int capture() { - int ret; - - std::set streams = camera->streams(); + std::map config; std::vector requests; + int ret; - ret = configureStreams(camera.get(), streams); + ret = prepare_camera_config(&config); + if (ret) { + std::cout << "Failed to prepare camera configuration" << std::endl; + return ret; + } + + ret = camera->configureStreams(config); if (ret < 0) { std::cout << "Failed to configure camera" << std::endl; return ret; } - Stream *stream = *streams.begin(); + Stream *stream = config.begin()->first; ret = camera->allocateBuffers(); if (ret) { From patchwork Tue Apr 2 00:53:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 832 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E4AD9610C5 for ; Tue, 2 Apr 2019 02:54:00 +0200 (CEST) X-Halon-ID: cd4cfd77-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id cd4cfd77-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:54:00 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:53:29 +0200 Message-Id: <20190402005332.25018-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> References: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 2/5] test: camera: Remove streams argument from configurationValid() 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: Tue, 02 Apr 2019 00:54:01 -0000 In preparation of reworking how a default configuration is retrieved from a camera remove the streams and validation using the stream when judging if a camera configuration is valid. This is needed as once stream usage hints are added applications will no longer fetch default configuration based on Stream IDs so using them to verify the returned format is not useful. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/camera/camera_test.cpp | 26 ++++++++------------------ test/camera/camera_test.h | 3 +-- test/camera/capture.cpp | 2 +- test/camera/configuration_default.cpp | 2 +- test/camera/configuration_set.cpp | 2 +- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/test/camera/camera_test.cpp b/test/camera/camera_test.cpp index a92f2165bf3a53c1..5985b85c44816e30 100644 --- a/test/camera/camera_test.cpp +++ b/test/camera/camera_test.cpp @@ -46,27 +46,17 @@ void CameraTest::cleanup() cm_->stop(); }; -bool CameraTest::configurationValid(const std::set &streams, - const std::map &conf) const +bool CameraTest::configurationValid(const std::map &config) const { - /* Test that the numbers of streams matches that of configuration. */ - if (streams.size() != conf.size()) + /* Test that the configuration is not empty. */ + if (config.empty()) return false; - /* - * Test that stream can be found in configuration and that the - * configuration is valid. - */ - for (Stream *stream : streams) { - std::map::const_iterator it = - conf.find(stream); - - if (it == conf.end()) - return false; - - const StreamConfiguration *sconf = &it->second; - if (sconf->width == 0 || sconf->height == 0 || - sconf->pixelFormat == 0 || sconf->bufferCount == 0) + /* Test that configuration is valid. */ + for (auto const &it : config) { + const StreamConfiguration &conf = it.second; + if (conf.width == 0 || conf.height == 0 || + conf.pixelFormat == 0 || conf.bufferCount == 0) return false; } diff --git a/test/camera/camera_test.h b/test/camera/camera_test.h index 48fb47a23fe8f49c..5801fad3281e1653 100644 --- a/test/camera/camera_test.h +++ b/test/camera/camera_test.h @@ -23,8 +23,7 @@ protected: int init(); void cleanup(); - bool configurationValid(const std::set &streams, - const std::map &conf) const; + bool configurationValid(const std::map &config) const; std::shared_ptr camera_; diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index 28eb61405d90a4c7..f6932b7505571712 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -48,7 +48,7 @@ protected: camera_->streamConfiguration(streams); StreamConfiguration *sconf = &conf.begin()->second; - if (!configurationValid(streams, conf)) { + if (!configurationValid(conf)) { cout << "Failed to read default configuration" << endl; return TestFail; } diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp index 71e79844667591b2..53ee021d33ca39b1 100644 --- a/test/camera/configuration_default.cpp +++ b/test/camera/configuration_default.cpp @@ -32,7 +32,7 @@ protected: return TestFail; } - if (!configurationValid(streams, conf)) { + if (!configurationValid(conf)) { cout << "Default configuration invalid" << endl; return TestFail; } diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp index dedb85009335aa46..cac1da959f241bc5 100644 --- a/test/camera/configuration_set.cpp +++ b/test/camera/configuration_set.cpp @@ -23,7 +23,7 @@ protected: camera_->streamConfiguration(streams); StreamConfiguration *sconf = &conf.begin()->second; - if (!configurationValid(streams, conf)) { + if (!configurationValid(conf)) { cout << "Failed to read default configuration" << endl; return TestFail; } From patchwork Tue Apr 2 00:53:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 834 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 276B8610BF for ; Tue, 2 Apr 2019 02:54:01 +0200 (CEST) X-Halon-ID: cda2301d-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id cda2301d-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:54:00 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:53:30 +0200 Message-Id: <20190402005332.25018-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> References: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 3/5] test: camera: Remove test for bad Stream IDs 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: Tue, 02 Apr 2019 00:54:01 -0000 In preparation of reworking how a default configuration is retrieved from a camera remove test that stream IDs must be valid as the data type passed to Camera::streamConfiguration() will change. This change is in preparation for a invasive change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/camera/configuration_default.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp index 53ee021d33ca39b1..856cd415f7a6aec1 100644 --- a/test/camera/configuration_default.cpp +++ b/test/camera/configuration_default.cpp @@ -49,19 +49,6 @@ protected: return TestFail; } - /* - * Test that asking for configuration for an array of bad streams - * returns an empty list of configurations. - */ - Stream *stream_bad = reinterpret_cast(0xdeadbeef); - std::set streams_bad = { stream_bad }; - conf = camera_->streamConfiguration(streams_bad); - if (!conf.empty()) { - cout << "Failed to retrieve configuration for bad streams" - << endl; - return TestFail; - } - return TestPass; } }; From patchwork Tue Apr 2 00:53:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 835 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A4B73610BF for ; Tue, 2 Apr 2019 02:54:02 +0200 (CEST) X-Halon-ID: cde5a054-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id cde5a054-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:54:01 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:53:31 +0200 Message-Id: <20190402005332.25018-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> References: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 4/5] libcamera: stream: Add basic stream usage hints definitions 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: Tue, 02 Apr 2019 00:54:02 -0000 In preparation of reworking how a default configuration is retrieved from a camera add stream usage hints. The hints will be used by applications to describe how it intends to use a camera and replace the Stream IDs role when retrieving default configuration from the camera using streamConfiguration(). Signed-off-by: Niklas Söderlund --- include/libcamera/stream.h | 39 ++++++++++++++++++ src/libcamera/stream.cpp | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 3e8e83a2ff245879..445b80de66217934 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -35,7 +35,46 @@ private: StreamConfiguration configuration_; }; +class StreamHint +{ +public: + enum Type { + Viewfinder, + Video, + Still, + }; + Type type() const { return type_; } + +protected: + StreamHint(Type type); + StreamHint(Type type, StreamConfiguration hints); + +private: + Type type_; + StreamConfiguration hints_; +}; + +class Viewfinder : public StreamHint +{ +public: + Viewfinder(unsigned int width, unsigned int height); + +private: + static StreamConfiguration initHints(unsigned int width, unsigned int height); +}; + +class Video : public StreamHint +{ +public: + Video(); +}; + +class Still : public StreamHint +{ +public: + Still(); +}; } /* namespace libcamera */ diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index c4943c91b2e6ce13..32f26a1f8e6adb2c 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -102,4 +102,88 @@ Stream::Stream() * \return The active configuration of the stream */ +/** + * \class StreamHint + * \brief Stream usage hint information + * + * The StreamHint class carries information about stream usage hints from the + * application to a specific pipeline handler implementation. The pipeline + * handler shall take the usage hints into account when select which stream + * to use for the desired operation. + */ + +/** + * \enum StreamHint::Type + * \brief List of types of usage hints + */ + +/** + * \fn StreamHint::type() + * \brief Retrieve the usage hint type + * \return The hint type + */ + +/** + * \brief Create a stream hint + * \param[in] type Stream hint type + */ +StreamHint::StreamHint(Type type) + : type_(type), hints_() +{ +} + +/** + * \brief Create a stream hint with parameters + * \param[in] type Stream hint type + * \param[in] hints Stream hint parameters + */ +StreamHint::StreamHint(Type type, StreamConfiguration hints) + : type_(type), hints_(hints) +{ +} + +/** + * \class Viewfinder + * \brief Stream usage hint for viewfinder + */ + +/** + * \brief Create a viewfinder stream hint + * \param[in] width Desired view finder width + * \param[in] height Desired view finder height + */ +Viewfinder::Viewfinder(unsigned int width, unsigned int height) + : StreamHint(Type::Viewfinder, initHints(width, height)) +{ +} + +StreamConfiguration Viewfinder::initHints(unsigned int width, + unsigned int height) +{ + StreamConfiguration hints = {}; + + hints.width = width; + hints.height = height; + + return hints; +} + +/** + * \class Video + * \brief Stream usage hint for video + */ +Video::Video() + : StreamHint(Type::Video) +{ +} + +/** + * \class Still + * \brief Stream usage hint for still images + */ +Still::Still() + : StreamHint(Type::Still) +{ +} + } /* namespace libcamera */ From patchwork Tue Apr 2 00:53:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 836 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D2F7261112 for ; Tue, 2 Apr 2019 02:54:02 +0200 (CEST) X-Halon-ID: ce4c63db-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id ce4c63db-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:54:01 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:53:32 +0200 Message-Id: <20190402005332.25018-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> References: <20190402005332.25018-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 5/5] libcamera: camera: Add support for stream usage hints 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: Tue, 02 Apr 2019 00:54:03 -0000 Instead of requesting the default configuration for a set of streams where the application have to figure out which streams provided by the camera is best suited for its intended usage have the library figure this out by using stream usage hints. The application asks the library for a list of streams and a suggested default configuration for them by supplying a list of stream usage hints. Once the list is retrieved the application can try and fine-tune the returned configuration and then try to apply it to the camera. Currently no pipeline handler is prepared to handle usage hints but nor did it make use of the list of Stream IDs which was the previous interface. The main reason for this is that all cameras currently only provide one stream each. This will still be the case but the API will be prepared to expand both pipeline handlers and applications to support multiple streams. Signed-off-by: Niklas Söderlund --- include/libcamera/camera.h | 3 ++- src/cam/main.cpp | 2 +- src/libcamera/camera.cpp | 30 ++++++++---------------- src/libcamera/include/pipeline_handler.h | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 4 ++-- src/libcamera/pipeline/uvcvideo.cpp | 6 ++--- src/libcamera/pipeline/vimc.cpp | 6 ++--- src/libcamera/pipeline_handler.cpp | 4 ++-- src/qcam/main_window.cpp | 5 ++-- test/camera/capture.cpp | 5 ++-- test/camera/configuration_default.cpp | 17 +++++--------- test/camera/configuration_set.cpp | 3 +-- test/camera/statemachine.cpp | 4 +--- 13 files changed, 34 insertions(+), 57 deletions(-) diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 77e4cd1ee14c2c61..ca5cf9faf866a6a6 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -22,6 +22,7 @@ class PipelineHandler; class Request; class Stream; class StreamConfiguration; +class StreamHint; class Camera final { @@ -44,7 +45,7 @@ public: const std::set &streams() const; std::map - streamConfiguration(std::set &streams); + streamConfiguration(const std::vector &hints); int configureStreams(std::map &config); int allocateBuffers(); diff --git a/src/cam/main.cpp b/src/cam/main.cpp index cc5302ca4e72ea6f..0a248d042cfe772b 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -81,7 +81,7 @@ static int parseOptions(int argc, char *argv[]) static int prepare_camera_config(std::map *config) { std::set streams = camera->streams(); - *config = camera->streamConfiguration(streams); + *config = camera->streamConfiguration({ Video() }); Stream *stream = config->begin()->first; if (options.isSet(OptFormat)) { diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 8ee9cc0866167ae1..5a3c8ef6aad691bd 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -345,33 +345,23 @@ 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 + * \brief Retrieve a group of stream configurations according to usage hints + * \param[in] hints A list of stream usage hints * - * 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. + * Retrieve configuration for a set of desired usages. The caller specifies a + * list of usage hints and the camera returns a map of suitable streams and + * a suggested default configuration. * - * 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. - * - * \return A map of successfully retrieved stream IDs and configurations or an - * empty list on error. + * \return A map of stream IDs to configuration if requested usage can be + * satisfied, if the request is impossible or on error an empty map is returned. */ std::map -Camera::streamConfiguration(std::set &streams) +Camera::streamConfiguration(const std::vector &hints) { - if (disconnected_ || !streams.size()) + if (disconnected_ || !hints.size() || hints.size() > streams_.size()) return std::map{}; - for (Stream *stream : streams) { - if (streams_.find(stream) == streams_.end()) - return std::map{}; - } - - return pipe_->streamConfiguration(this, streams); + return pipe_->streamConfiguration(this, hints); } /** diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index acb376e07030ae03..fbc439cec61832a6 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -53,7 +53,7 @@ public: virtual bool match(DeviceEnumerator *enumerator) = 0; virtual std::map - streamConfiguration(Camera *camera, std::set &streams) = 0; + streamConfiguration(Camera *camera, const std::vector &hints) = 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 55489c31df2d0382..a59cfd9aabff69ae 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -32,7 +32,7 @@ public: std::map streamConfiguration(Camera *camera, - std::set &streams) override; + const std::vector &hints) override; int configureStreams(Camera *camera, std::map &config) override; @@ -100,7 +100,7 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3() std::map PipelineHandlerIPU3::streamConfiguration(Camera *camera, - std::set &streams) + const std::vector &hints) { IPU3CameraData *data = cameraData(camera); std::map configs; diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index cc3e0cd9afab38b9..700e9f2730caae9c 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; + const std::vector &hints) override; int configureStreams(Camera *camera, std::map &config) override; @@ -84,14 +84,12 @@ PipelineHandlerUVC::~PipelineHandlerUVC() std::map PipelineHandlerUVC::streamConfiguration(Camera *camera, - std::set &streams) + const std::vector &hints) { UVCCameraData *data = cameraData(camera); - std::map configs; StreamConfiguration config{}; - LOG(UVC, Debug) << "Retrieving default format"; config.width = 640; config.height = 480; config.pixelFormat = V4L2_PIX_FMT_YUYV; diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 2e8c26fb7c0b2708..f6517c5217766176 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; + const std::vector &hints) override; int configureStreams(Camera *camera, std::map &config) override; @@ -84,14 +84,12 @@ PipelineHandlerVimc::~PipelineHandlerVimc() std::map PipelineHandlerVimc::streamConfiguration(Camera *camera, - std::set &streams) + const std::vector &hints) { VimcCameraData *data = cameraData(camera); std::map configs; - StreamConfiguration config{}; - LOG(VIMC, Debug) << "Retrieving default format"; config.width = 640; config.height = 480; config.pixelFormat = V4L2_PIX_FMT_RGB24; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 1a858f2638ceac5f..fd217eedfec9aee9 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -152,10 +152,10 @@ PipelineHandler::~PipelineHandler() * \fn PipelineHandler::streamConfiguration() * \brief Retrieve a group of stream 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] hints A list of stream usage hints * * 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 + * use-cases. The caller shall populate the \a hints array with the use-cases 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. diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index a148aa4d117fff59..fefcc753b5db45c9 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -97,9 +97,8 @@ int MainWindow::startCapture() { int ret; - Stream *stream = *camera_->streams().begin(); - std::set streams{ stream }; - config_ = camera_->streamConfiguration(streams); + config_ = camera_->streamConfiguration({ Video() }); + Stream *stream = config_.begin()->first; ret = camera_->configureStreams(config_); if (ret < 0) { std::cout << "Failed to configure camera" << std::endl; diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index f6932b7505571712..61489902915291f9 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -42,10 +42,9 @@ protected: int run() { - Stream *stream = *camera_->streams().begin(); - std::set streams = { stream }; std::map conf = - camera_->streamConfiguration(streams); + camera_->streamConfiguration({ Video() }); + Stream *stream = conf.begin()->first; StreamConfiguration *sconf = &conf.begin()->second; if (!configurationValid(conf)) { diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp index 856cd415f7a6aec1..6feb1e435192e6f6 100644 --- a/test/camera/configuration_default.cpp +++ b/test/camera/configuration_default.cpp @@ -20,14 +20,10 @@ protected: { std::map conf; - /* - * Test that asking for default configuration for a valid - * array of streams returns something valid. - */ - std::set streams = { *camera_->streams().begin() }; - conf = camera_->streamConfiguration(streams); + /* Test asking for configuration for a video stream. */ + conf = camera_->streamConfiguration({ Video() }); if (conf.empty()) { - cout << "Failed to retrieve configuration for valid streams" + cout << "Failed to retrieve configuration for video streams" << endl; return TestFail; } @@ -39,12 +35,11 @@ protected: /* * Test that asking for configuration for an empty array of - * streams returns an empty list of configurations. + * stream usage hints returns an empty list of configurations. */ - std::set streams_empty = {}; - conf = camera_->streamConfiguration(streams_empty); + conf = camera_->streamConfiguration({}); if (!conf.empty()) { - cout << "Failed to retrieve configuration for empty streams" + cout << "Failed to retrieve configuration for empty usage list" << endl; return TestFail; } diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp index cac1da959f241bc5..383113f2133e6fd3 100644 --- a/test/camera/configuration_set.cpp +++ b/test/camera/configuration_set.cpp @@ -18,9 +18,8 @@ class ConfigurationSet : public CameraTest protected: int run() { - std::set streams = { *camera_->streams().begin() }; std::map conf = - camera_->streamConfiguration(streams); + camera_->streamConfiguration({ Video() }); StreamConfiguration *sconf = &conf.begin()->second; if (!configurationValid(conf)) { diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp index f4395f2b1bfed698..e92d9b7992545b5b 100644 --- a/test/camera/statemachine.cpp +++ b/test/camera/statemachine.cpp @@ -235,9 +235,7 @@ protected: int run() { - Stream *stream = *camera_->streams().begin(); - std::set streams = { stream }; - defconf_ = camera_->streamConfiguration(streams); + defconf_ = camera_->streamConfiguration({ Video() }); if (testAvailable() != TestPass) { cout << "State machine in Available state failed" << endl;