Пример #1
0
int main(int argc, char **args)
{
	fd = open("/dev/video0", O_RDWR);
	if(fd == -1){
		perror("Error opening /dev/video0");
		return -1;
	}



//
//	memset (&queryctrl, 0, sizeof (queryctrl));
//
//	for (queryctrl.id = V4L2_CID_BASE;
//	     queryctrl.id < V4L2_CID_LASTP1;
//	     queryctrl.id++) {
//	        if (0 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) {
//	                if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
//	                        continue;
//
//	                printf ("Control %s\n", queryctrl.name);
//
//	                if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
//	                        enumerate_menu ();
//	        } else {
//	                if (errno == EINVAL)
//	                        continue;
//
//	                perror ("VIDIOC_QUERYCTRL");
//	                return -1;
//	        }
//	}
//
//	for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
//	     queryctrl.id++) {
//	        if (0 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) {
//	                if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
//	                        continue;
//
//	                printf ("Control %s\n", queryctrl.name);
//
//	                if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
//	                        enumerate_menu ();
//	        } else {
//	                if (errno == EINVAL)
//	                        break;
//
//	                perror ("VIDIOC_QUERYCTRL");
//	                return -1;
//	        }
//	}


//
//	struct v4l2_format chan;
//	getCap(chan);
//	return 0;

	struct v4l2_frmivalenum argp2;
	int err = ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &argp2);
	if(err == -1){
		perror("Error VIDIOC_ENUM_FRAMEINTERVALS: ");
	}

	return 0;

	struct v4l2_input input;
	int index;



	if (-1 == ioctl (fd, VIDIOC_G_INPUT, &index)) {
	        perror ("VIDIOC_G_INPUT");
	        return -1;
	}

	memset (&input, 0, sizeof (input));
	input.index = index;

	if (-1 == ioctl (fd, VIDIOC_ENUMINPUT, &input)) {
	        perror ("VIDIOC_ENUMINPUT");
	        return -1;
	}

	printf ("Current input: %s\n", input.name);


	struct v4l2_frmsizeenum argp;
	getResolutions(argp);

	return 0;
}
 int convertIndex(const int i, const int j, const int k)const
 {
     return i + getResolutions().ResolutionX * j + getResolutions().ResolutionX * getResolutions().ResolutionZ * k;
 }