From patchwork Wed Jun 19 02:51:24 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: 1461 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 B611261A2C for ; Wed, 19 Jun 2019 04:52:30 +0200 (CEST) X-Halon-ID: 3f65d020-923d-11e9-8ab4-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 3f65d020-923d-11e9-8ab4-005056917a89; Wed, 19 Jun 2019 04:52:17 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Jun 2019 04:51:24 +0200 Message-Id: <20190619025129.21164-12-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190619025129.21164-1-niklas.soderlund@ragnatech.se> References: <20190619025129.21164-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 11/16] libcamera: stream: StreamConfiguration: Add StreamFormats information 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: Wed, 19 Jun 2019 02:52:30 -0000 Allow StreamFormats to be associated to a StreamConfiguration. The intention is that pipeline handlers should associate formats to a StreamConfiguration when it's created in generateConfiguration(). Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/stream.h | 8 ++++---- src/libcamera/stream.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 48daf5ac23f55d85..5b4fea324ce449b1 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -35,10 +35,8 @@ private: }; struct StreamConfiguration { - StreamConfiguration() - : stream_(nullptr) - { - } + StreamConfiguration(); + StreamConfiguration(const StreamFormats &formats); unsigned int pixelFormat; Size size; @@ -47,11 +45,13 @@ struct StreamConfiguration { Stream *stream() const { return stream_; } void setStream(Stream *stream) { stream_ = stream; } + const StreamFormats &formats() const { return formats_; } std::string toString() const; private: Stream *stream_; + StreamFormats formats_; }; enum StreamRole { diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index bfb072d691ae0e25..cfa7a327fdd0f1a8 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -270,6 +270,19 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const * configured for a single video stream. */ +StreamConfiguration::StreamConfiguration() + : stream_(nullptr) +{ +} + +/** + * \brief Construct a configuration with stream formats + */ +StreamConfiguration::StreamConfiguration(const StreamFormats &formats) + : stream_(nullptr), formats_(formats) +{ +} + /** * \var StreamConfiguration::size * \brief Stream size in pixels @@ -310,6 +323,18 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const * \param[in] stream The stream */ +/** + * \fn StreamConfiguration::formats() + * \brief Retrieve advisory stream format information + * + * This method retrieves information about the pixel formats and sizes supported + * by the stream configuration. The sizes are advisory and not all of them are + * guaranteed to be supported by the stream. Users shall always inspect the size + * in the stream configuration after calling CameraConfiguration::validate(). + * + * \return Stream formats information + */ + /** * \brief Assemble and return a string describing the configuration *