diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2024-09-11 23:18:13 +0200 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2024-09-12 12:01:29 +0200 |
commit | 6837607ca3f5ef0c516198494c5211cd7be0b165 (patch) | |
tree | 884626e71c9b5ca241aa19179e092e735a00c8bc /src | |
parent | d900ec990debab2fbc26dad12e45736f01d8d646 (diff) |
libcamera: media_object: Add MediaPad string representations
Facilitate easy representations of a MediaPad object by preparing
it as a string and supporting output streams.
A MediaPad will be report in the following style:
'imx283 1-001a'[0]
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/media_object.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp index 1b191a1e..25f16707 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -236,6 +236,31 @@ void MediaPad::addLink(MediaLink *link) } /** + * \brief Generate a string representation of the MediaPad + * \return A string representing the MediaPad + */ +std::string MediaPad::toString() const +{ + std::stringstream ss; + ss << *this; + + return ss.str(); +} + +/** + * \brief Insert a text representation of a MediaPad into an output stream + * \param[in] out The output stream + * \param[in] pad The MediaPad + * \return The output stream \a out + */ +std::ostream &operator<<(std::ostream &out, const MediaPad &pad) +{ + out << "'" << pad.entity()->name() << "'[" << pad.index() << "]"; + + return out; +} + +/** * \class MediaEntity * \brief The MediaEntity represents an entity in the media graph * |