提交 96b994af 编写于 作者: F fryshorts

linux-v4l2: Add helper function to get input caps

Add a helper function to get the capabilities of a specific or the
currently selected input of the device.
上级 ff8ac210
......@@ -133,6 +133,27 @@ int_fast32_t v4l2_set_input(int_fast32_t dev, int *input)
: v4l2_ioctl(dev, VIDIOC_S_INPUT, input);
}
int_fast32_t v4l2_get_input_caps(int_fast32_t dev, int input, uint32_t *caps)
{
if (!dev || !caps)
return -1;
if (input == -1) {
if (v4l2_ioctl(dev, VIDIOC_G_INPUT, &input) < 0)
return -1;
}
struct v4l2_input in;
memset(&in, 0, sizeof(in));
in.index = input;
if (v4l2_ioctl(dev, VIDIOC_ENUMINPUT, &in) < 0)
return -1;
*caps = in.capabilities;
return 0;
}
int_fast32_t v4l2_set_format(int_fast32_t dev, int *resolution,
int *pixelformat, int *bytesperline)
{
......
......@@ -219,6 +219,17 @@ int_fast32_t v4l2_destroy_mmap(struct v4l2_buffer_data *buf);
*/
int_fast32_t v4l2_set_input(int_fast32_t dev, int *input);
/**
* Get capabilities for an input.
*
* @param dev handle for the v4l2 device
* @param input index of the input or -1 to use the currently selected
* @param caps capabilities for the input
*
* @return negative on failure
*/
int_fast32_t v4l2_get_input_caps(int_fast32_t dev, int input, uint32_t *caps);
/**
* Set the video format on the device.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册