[libcamera-devel,v3,06/11] libcamera: v4l2_videodevice: Expose the device capabilities

Message ID 20200320014839.14683-7-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • Simple pipeline handler
Related show

Commit Message

Laurent Pinchart March 20, 2020, 1:48 a.m. UTC
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>
---
 src/libcamera/include/v4l2_videodevice.h | 2 ++
 src/libcamera/v4l2_videodevice.cpp       | 6 ++++++
 2 files changed, 8 insertions(+)

Patch

diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
index 7b011d3b4e87..84d8d433b0ad 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(uint32_t code = 0);
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index c11936fa2d5a..096ebc1bbb88 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -745,6 +745,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]");