[libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add a const version of dev()
Jacopo Mondi
jacopo at jmondi.org
Tue Jan 5 13:31:26 CET 2021
Add a const version of the MediaObject::dev() method to be able to
retrieve a pointer to a const MediaDevice from a constant instance of
a MediaObject sub-class.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
include/libcamera/internal/media_object.h | 1 +
src/libcamera/media_object.cpp | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
index 43a35bef8f35..2b336961f98d 100644
--- a/include/libcamera/internal/media_object.h
+++ b/include/libcamera/internal/media_object.h
@@ -22,6 +22,7 @@ class MediaObject
{
public:
MediaDevice *device() { return dev_; }
+ const MediaDevice *device() const { return dev_; }
unsigned int id() const { return id_; }
protected:
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
index 056036635902..cd3cd8ac17a4 100644
--- a/src/libcamera/media_object.cpp
+++ b/src/libcamera/media_object.cpp
@@ -71,6 +71,12 @@ LOG_DECLARE_CATEGORY(MediaDevice)
* \return The MediaDevice
*/
+/**
+ * \fn const MediaObject::device() const
+ * \brief Retrieve the const media device the media object belongs to
+ * \return The const MediaDevice
+ */
+
/**
* \fn MediaObject::id()
* \brief Retrieve the media object id
--
2.29.2
More information about the libcamera-devel
mailing list