v4l2 control querying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi all,

the v4l2 ctrl query struct is as follows:

struct v4l2_queryctrl
{
	__u32	             id;
	enum v4l2_ctrl_type  type;
	__u8		     name[32];	/* Whatever */
	__s32		     minimum;	/* Note signedness */
	__s32		     maximum;
	__s32	             step;
	__s32		     default_value;
	__u32                flags;
	__u32		     reserved[2];
};

This is confusing, imho, since the id field is supposed to provide a CID
macro number, such as V4L2_CID_BRIGHTNESS. Now the problem/question is,
how do I get all the controls provided by the driver? I can't just query
each number:

for (int i=0;;i++) {
  struct v4l2_queryctrl c;
  c.id = i;
  if (ioctl(fd, VIDIOC_QUERYCTRL, &c)==0)
    printf("Control %s detected (%d)\n", c.name, c.id);
  else
    break;
}

That won't work, because the CIDs have fixed numbers. this won't work
either:

for (int i=V4L2_CID_BRIGHTNESS;;i++) {
  struct v4l2_queryctrl c;
  c.id = i;
  if (ioctl(fd, VIDIOC_QUERYCTRL, &c)==0)
    printf("Control %s detected (%d)\n", c.name, c.id);
  else
    break;
}

because some driver might not support brightness, but might still
support other controls.

So the question: is the app actually supposed to loop-query all
available controls and display each of them? Or is an application
supposed to use the controls that are known to it, and omit any
unknown/private controls? Or am I missing something crucial here?

Thanks,

Ronald





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux