forked from tTh/FloatImg
more precision, please
This commit is contained in:
parent
4a0941f76b
commit
a47730d09d
19
v4l2/t.c
19
v4l2/t.c
|
@ -29,32 +29,21 @@ struct v4l2_requestbuffers reqbuf;
|
|||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
|
||||
|
||||
vfd = open_device(dev);
|
||||
fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
|
||||
if (verbosity) fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
|
||||
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
pr_v4l2_format("after 0", &fmt);
|
||||
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
fmt.fmt.pix.width = 640;
|
||||
fmt.fmt.pix.height = 480;
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
|
||||
// pr_v4l2_format("before ioctl", &fmt);
|
||||
|
||||
pr_v4l2_format("before ioctl", &fmt);
|
||||
|
||||
foo = ioctl(vfd, VIDIOC_S_FMT, &fmt);
|
||||
foo = ioctl(vfd, VIDIOC_G_FMT, &fmt);
|
||||
fprintf(stderr, "ioctl -> %d\n", foo);
|
||||
if (foo < 0) {
|
||||
if (0 != foo) {
|
||||
perror("ioctl S_FMT");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pr_v4l2_format("after ioctl", &fmt);
|
||||
|
||||
/* todo V4L2_BUF_TYPE_VIDEO_CAPTURE */
|
||||
memset(&reqbuf, 0, sizeof(reqbuf));
|
||||
pr_v4l2_requestbuffers("after 0", &reqbuf);
|
||||
|
||||
|
||||
return k;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ static char *fmttype2str(int type)
|
|||
|
||||
switch(type) {
|
||||
case 0: return "[zero]";
|
||||
case 1: return "video capture";
|
||||
case 2: return "video output";
|
||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE: return "video capture";
|
||||
case V4L2_BUF_TYPE_VIDEO_OUTPUT: return "video output";
|
||||
|
||||
case 13: return "META capture";
|
||||
}
|
||||
|
||||
return "???";
|
||||
return "XXX";
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
static void pr_capabilities(uint32_t caps)
|
||||
|
@ -203,13 +203,20 @@ fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */
|
|||
|
||||
switch(ptr->type) {
|
||||
|
||||
case 1: // fputs(" Capture\n", FP);
|
||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
|
||||
fprintf(FP, " dims %dx%d\n",
|
||||
ptr->fmt.pix.width,
|
||||
ptr->fmt.pix.height);
|
||||
fprintf(FP, " pixformat %s\n",
|
||||
str_fourcc(ptr->fmt.pix.pixelformat));
|
||||
fprintf(FP, " field %d\n",
|
||||
ptr->fmt.pix.field); /* enum v4l2_field */
|
||||
fprintf(FP, " padding %d\n",
|
||||
ptr->fmt.pix.bytesperline);
|
||||
|
||||
break;
|
||||
|
||||
default: fprintf(FP, "type is %d\n", ptr->type);
|
||||
default: fprintf(FP, "XXX type %d unknow\n", ptr->type);
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ return -1;
|
|||
int show_webcam_infos(char *devname, char *title, int k)
|
||||
{
|
||||
int vfd, foo;
|
||||
char ligne[100];
|
||||
|
||||
struct v4l2_capability cap;
|
||||
// struct v4l2_format fmt;
|
||||
|
@ -191,11 +192,13 @@ if (foo < 0) {
|
|||
pr_v4l2_capability(devname, &cap);
|
||||
|
||||
memset(&input, 0, sizeof(input));
|
||||
input.index = 1;
|
||||
if (-1 == ioctl(vfd, VIDIOC_ENUMINPUT, &input)) {
|
||||
perror("VIDIOC_ENUMINPUT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
pr_v4l2_input("input 0", &input);
|
||||
sprintf(ligne, "input %d", input.index);
|
||||
pr_v4l2_input(ligne, &input);
|
||||
|
||||
foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue