forked from marfrit/libva-v4l2-request-fourier
v4l2: Add support for querying capabilities
This adds a helper function to query v4l2 capabilities, returning either the device caps when available or the general device caps otherwise. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
This commit is contained in:
+21
@@ -32,6 +32,27 @@
|
||||
#include "utils.h"
|
||||
#include "v4l2.h"
|
||||
|
||||
int v4l2_query_capabilities(int video_fd, unsigned int *capabilities)
|
||||
{
|
||||
struct v4l2_capability capability;
|
||||
int rc;
|
||||
|
||||
memset(&capability, 0, sizeof(capability));
|
||||
|
||||
rc = ioctl(video_fd, VIDIOC_QUERYCAP, &capability);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
|
||||
if (capabilities != NULL) {
|
||||
if ((capability.capabilities & V4L2_CAP_DEVICE_CAPS) != 0)
|
||||
*capabilities = capability.device_caps;
|
||||
else
|
||||
*capabilities = capability.capabilities;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool v4l2_find_format(int video_fd, unsigned int type, unsigned int pixelformat)
|
||||
{
|
||||
struct v4l2_fmtdesc fmtdesc;
|
||||
|
||||
Reference in New Issue
Block a user