libcamera: stream: StreamConfiguration: Add StreamFormats information

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@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-05-26 02:31:39 +02:00
parent 63c578ed99
commit a502896429
2 changed files with 33 additions and 4 deletions

View file

@ -35,10 +35,8 @@ private:
}; };
struct StreamConfiguration { struct StreamConfiguration {
StreamConfiguration() StreamConfiguration();
: stream_(nullptr) StreamConfiguration(const StreamFormats &formats);
{
}
unsigned int pixelFormat; unsigned int pixelFormat;
Size size; Size size;
@ -47,11 +45,13 @@ struct StreamConfiguration {
Stream *stream() const { return stream_; } Stream *stream() const { return stream_; }
void setStream(Stream *stream) { stream_ = stream; } void setStream(Stream *stream) { stream_ = stream; }
const StreamFormats &formats() const { return formats_; }
std::string toString() const; std::string toString() const;
private: private:
Stream *stream_; Stream *stream_;
StreamFormats formats_;
}; };
enum StreamRole { enum StreamRole {

View file

@ -270,6 +270,23 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
* configured for a single video stream. * configured for a single video stream.
*/ */
/**
* \todo This method is deprecated and should be removed once all pipeline
* handlers provied StreamFormats.
*/
StreamConfiguration::StreamConfiguration()
: stream_(nullptr)
{
}
/**
* \brief Construct a configuration with stream formats
*/
StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
: stream_(nullptr), formats_(formats)
{
}
/** /**
* \var StreamConfiguration::size * \var StreamConfiguration::size
* \brief Stream size in pixels * \brief Stream size in pixels
@ -310,6 +327,18 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
* \param[in] stream The stream * \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 * \brief Assemble and return a string describing the configuration
* *