Message ID | 20190616133402.21934-12-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Niklas, Thank you for the patch. On Sun, Jun 16, 2019 at 03:33:57PM +0200, Niklas Söderlund wrote: > 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> > --- > 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 27fde5fe29eeb340..a0d77348d418917a 100644 > --- a/src/libcamera/stream.cpp > +++ b/src/libcamera/stream.cpp > @@ -266,6 +266,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 > @@ -306,6 +319,18 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const > * \param[in] stream The stream > */ > > +/** > + * \fn StreamConfiguration::formats() > + * \brief Retrieve advisory stream format information > + * > + * Retrieve information about pixel formats and sizes for possible stream > + * configuration. The size information is advisory and not guaranteed to > + * be supported by the hardware, users should always inspect the actual > + * size applied on the device after a camera has been configured. 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(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + * > + * \return Stream formats information > + */ > + > /** > * \brief Assemble and return a string describing the configuration > *
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 27fde5fe29eeb340..a0d77348d418917a 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -266,6 +266,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 @@ -306,6 +319,18 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const * \param[in] stream The stream */ +/** + * \fn StreamConfiguration::formats() + * \brief Retrieve advisory stream format information + * + * Retrieve information about pixel formats and sizes for possible stream + * configuration. The size information is advisory and not guaranteed to + * be supported by the hardware, users should always inspect the actual + * size applied on the device after a camera has been configured. + * + * \return Stream formats information + */ + /** * \brief Assemble and return a string describing the configuration *