summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-13 22:58:52 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-15 01:07:37 +0300
commitad0e1954117fe4a9f3758409b6ee9c1662961384 (patch)
tree2b02c5519e8d2b285e6b39b80198d2d357a779d7
parent49a35da2ceaee33a296f9e30b1cf784a656e0224 (diff)
libcamera: v4l2_videodevice: Expose the device capabilities
Add a caps() function that exposes the V4L2 capabilities for the device. This is useful for generic code that can't hardcode any a priori knowledge of the device, such as in a simple pipeline handler. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/include/v4l2_videodevice.h2
-rw-r--r--src/libcamera/v4l2_videodevice.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
index 7d7c4a9e..f21b9264 100644
--- a/src/libcamera/include/v4l2_videodevice.h
+++ b/src/libcamera/include/v4l2_videodevice.h
@@ -205,6 +205,8 @@ public:
const char *deviceName() const { return caps_.card(); }
const char *busName() const { return caps_.bus_info(); }
+ const V4L2Capability &caps() const { return caps_; }
+
int getFormat(V4L2DeviceFormat *format);
int setFormat(V4L2DeviceFormat *format);
std::map<V4L2PixelFormat, std::vector<SizeRange>> formats();
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index eb33a68e..e764268e 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -759,6 +759,12 @@ void V4L2VideoDevice::close()
* \return The string containing the device location
*/
+/**
+ * \fn V4L2VideoDevice::caps()
+ * \brief Retrieve the device V4L2 capabilities
+ * \return The device V4L2 capabilities
+ */
+
std::string V4L2VideoDevice::logPrefix() const
{
return deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]");