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>
This commit is contained in:
Laurent Pinchart
2020-03-13 22:58:52 +02:00
parent 49a35da2ce
commit ad0e195411
2 changed files with 8 additions and 0 deletions

View File

@@ -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();

View File

@@ -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]");