@@ -20,6 +20,26 @@ private:
unsigned int id_;
};
+class StreamConfiguration final
+{
+public:
+ StreamConfiguration(class Stream &stream);
+
+ unsigned int id() const { return id_; };
+ unsigned int width() const { return width_; };
+ unsigned int height() const { return height_; };
+ unsigned int pixelformat() const { return pixelformat_; };
+
+ void setDimension(unsigned int width, unsigned int height);
+ void setPixelFormat(unsigned int pixelformat);
+
+private:
+ unsigned int id_;
+ unsigned int width_;
+ unsigned int height_;
+ unsigned int pixelformat_;
+};
+
} /* namespace libcamera */
#endif /* __LIBCAMERA_STREAM_H__ */
@@ -63,4 +63,68 @@ Stream::Stream(unsigned int id)
* \return The stream ID
*/
+/**
+ * \class StreamConfiguration
+ * \brief Stream configuration object
+ *
+ * The StreamConfiguration class is a model of all information which can be
+ * configured for a single video stream. A application should acquire a all
+ * Stream object from a camera, select the ones it wish to use, create a
+ * StreamConfiguration for each of those streams, set the desired parameter on
+ * the objects and feed them back to the camera object to configure the camera.
+ */
+
+/**
+ * \fn StreamConfiguration::id()
+ * \brief Retrieve the streams ID
+ * \return The stream ID
+ */
+
+/**
+ * \fn StreamConfiguration::width()
+ * \brief Retrieve the Stream width
+ * \return The stream width
+ */
+
+/**
+ * \fn StreamConfiguration::height()
+ * \brief Retrieve the Stream height
+ * \return The stream height
+ */
+
+/**
+ * \fn StreamConfiguration::pixelformat()
+ * \brief Retrieve the Stream pixelformat
+ * \return The stream pixelformat
+ */
+
+/**
+ * \brief Set desired width and height for the stream
+ * \param[in] width The desired width of the stream
+ * \param[in] height The desired height of the stream
+ */
+void StreamConfiguration::setDimension(unsigned int width, unsigned int height)
+{
+ width_ = width;
+ height_ = height;
+}
+
+/**
+ * \brief Set desired pixelformat for the stream
+ * \param[in] pixelformat The desired pixelformat of the stream
+ */
+void StreamConfiguration::setPixelFormat(unsigned int pixelformat)
+{
+ pixelformat_ = pixelformat;
+}
+
+/**
+ * \brief Create a new configuration container for a stream
+ * \param[in] stream The stream object the configuration object should act on
+ */
+StreamConfiguration::StreamConfiguration(class Stream &stream)
+ : id_(stream.id()), width_(0), height_(0), pixelformat_(0)
+{
+}
+
} /* namespace libcamera */
Add a simple StreamConfiguration class to hold configuration data for a single stream of a Camera. In its current form not many configuration parameters are supported but it's expected the number of options will grow over time. At this stage the pixel format is represented as a unsigned int to allow for a easy mapping to the V4L2 API. This might be subject to change in the future as we finalize how libcamera shall represent pixelformats. A StreamConfiguration objected needs to be created from the Stream object it should configure. As the two objects are so closely related I have at this stage opted to implement them in the same stream.{h,cpp} as the Stream class. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- include/libcamera/stream.h | 20 ++++++++++++ src/libcamera/stream.cpp | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+)