summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_device.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-01-21 13:18:48 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-01-22 14:14:04 +0100
commitd18d25bde3064a537d4b080488941fffd61e1739 (patch)
treecdd7c76dbb588d66974b860973df1518035223dc /src/libcamera/v4l2_device.cpp
parentf5e48ebf447ec15ba653fa3524e9b9de8e5eb736 (diff)
libcamera: v4l2_device: Add MediaEntity contructor
Construct a V4L2Device from a MediaEntity device node path. While at there mark constructor as explicit to avoid copy-construction. 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>
Diffstat (limited to 'src/libcamera/v4l2_device.cpp')
-rw-r--r--src/libcamera/v4l2_device.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 59c5ac98..5809fc62 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -12,6 +12,7 @@
#include <unistd.h>
#include "log.h"
+#include "media_object.h"
#include "v4l2_device.h"
/**
@@ -94,6 +95,17 @@ V4L2Device::V4L2Device(const std::string &devnode)
{
}
+/**
+ * \brief Construct a V4L2Device from a MediaEntity
+ * \param entity The MediaEntity to build the device from
+ *
+ * Construct a V4L2Device from a MediaEntity's device node path.
+ */
+V4L2Device::V4L2Device(const MediaEntity &entity)
+ : V4L2Device(entity.devnode())
+{
+}
+
V4L2Device::~V4L2Device()
{
close();