summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-01-05 13:11:16 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-01-18 10:39:14 +0100
commita1a20998aca365a5835d534c49fc3cd4de7246ec (patch)
tree5246335c750f81d157366a7a4207425bd7f011b3
parent89b495c054e5704bb68a1cbc876e575c91499b47 (diff)
libcamera: media_object: Add a const version of dev()
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. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--include/libcamera/internal/media_object.h1
-rw-r--r--src/libcamera/media_object.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
index 43a35bef..2b336961 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 05603663..94aeb504 100644
--- a/src/libcamera/media_object.cpp
+++ b/src/libcamera/media_object.cpp
@@ -67,6 +67,11 @@ LOG_DECLARE_CATEGORY(MediaDevice)
/**
* \fn MediaObject::device()
+ * \copydoc MediaObject::device() const
+ */
+
+/**
+ * \fn MediaObject::device() const
* \brief Retrieve the media device the media object belongs to
* \return The MediaDevice
*/