libcamera: stream: Add operator<<(StreamConfiguration)
The StreamConfiguration class only implements toString() but doesn't offer an overload of operator<<() which is more convenient to use. Add an overload for operator<<(StreamConfiguration) and re-implement StreamConfiguration::toString() on top of it. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
229667606e
commit
88456ab55a
2 changed files with 19 additions and 1 deletions
|
@ -61,6 +61,8 @@ private:
|
|||
StreamFormats formats_;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg);
|
||||
|
||||
enum class StreamRole {
|
||||
Raw,
|
||||
StillCapture,
|
||||
|
|
|
@ -392,7 +392,23 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
|
|||
*/
|
||||
std::string StreamConfiguration::toString() const
|
||||
{
|
||||
return size.toString() + "-" + pixelFormat.toString();
|
||||
std::stringstream ss;
|
||||
ss << *this;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Insert a text representation of a StreamConfiguration into an output
|
||||
* stream
|
||||
* \param[in] out The output stream
|
||||
* \param[in] cfg The StreamConfiguration
|
||||
* \return The output stream \a out
|
||||
*/
|
||||
std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
|
||||
{
|
||||
out << cfg.size << "-" << cfg.pixelFormat;
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue