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:
parent
a22dcaaa78
commit
e5163f54d4
2 changed files with 16 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -49,6 +49,13 @@ LOG_DEFINE_CATEGORY(V4L2)
|
|||
* \return The string containing the device location
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn unsigned int V4L2Capability::device_caps()
|
||||
* \brief Retrieve the capabilities of the device
|
||||
* \return The device specific capabilities if V4L2_CAP_DEVICE_CAPS is set or
|
||||
* driver capabilities otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bool V4L2Capability::isCapture()
|
||||
* \brief Identify if the device is capable of capturing video
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue