libcamera: v4l2device: Obtain device capabilities
The capabilities structure from the kernel can return capabilities of the driver, or potentially more specific device capabilities. Handle this with an inline function 'device_caps()' to return the device specific capabilities when available, or fall back to the driver capabilities otherwise. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -26,10 +26,16 @@ struct V4L2Capability final : v4l2_capability {
|
||||
{
|
||||
return reinterpret_cast<const char *>(v4l2_capability::bus_info);
|
||||
}
|
||||
unsigned int device_caps() const
|
||||
{
|
||||
return capabilities & V4L2_CAP_DEVICE_CAPS
|
||||
? v4l2_capability::device_caps
|
||||
: v4l2_capability::capabilities;
|
||||
}
|
||||
|
||||
bool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; }
|
||||
bool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; }
|
||||
bool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }
|
||||
bool isCapture() const { return device_caps() & V4L2_CAP_VIDEO_CAPTURE; }
|
||||
bool isOutput() const { return device_caps() & V4L2_CAP_VIDEO_OUTPUT; }
|
||||
bool hasStreaming() const { return device_caps() & V4L2_CAP_STREAMING; }
|
||||
};
|
||||
|
||||
class MediaEntity;
|
||||
|
||||
Reference in New Issue
Block a user