[libcamera-devel] [PATCH 12/17] libcamera: stream: StreamConfiguration: Add StreamFormats information

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon May 27 02:15:38 CEST 2019


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 <niklas.soderlund at ragnatech.se>
---
 include/libcamera/stream.h |  8 ++++----
 src/libcamera/stream.cpp   | 19 +++++++++++++++++++
 2 files changed, 23 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 a2931902fda2baa5..4452b6ff010cfbdf 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -260,6 +260,19 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
  * configured for a single video stream.
  */
 
+StreamConfiguration::StreamConfiguration()
+	: stream_(nullptr)
+{
+}
+
+/**
+ * \brief Create with stream format description
+ */
+StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
+	: stream_(nullptr), formats_(formats)
+{
+}
+
 /**
  * \var StreamConfiguration::size
  * \brief Stream size in pixels
@@ -300,6 +313,12 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
  * \param[in] stream The stream
  */
 
+/**
+ * \fn StreamConfiguration::formats()
+ * \brief Retrieve the advisory stream formats description
+ * \return A stream formats description
+ */
+
 /**
  * \brief Assemble and return a string describing the configuration
  *
-- 
2.21.0



More information about the libcamera-devel mailing list