Compare commits
No commits in common. "a47730d09d89767b475e387949fbb93265fec0d1" and "af40e8a0e59c5fee3fb8b2c2d1ff2a86d0891ab2" have entirely different histories.
a47730d09d
...
af40e8a0e5
@ -18,7 +18,7 @@ grabvidseq: grabvidseq.c Makefile
|
|||||||
gcc -Wall -g $< ../libfloatimg.a -lv4l2 -o $@
|
gcc -Wall -g $< ../libfloatimg.a -lv4l2 -o $@
|
||||||
|
|
||||||
video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o
|
video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o
|
||||||
gcc -Wall -g $< funcs.o v4l2_pr_structs.o -o $@
|
gcc -Wall -g $< ../libfloatimg.a funcs.o v4l2_pr_structs.o -o $@
|
||||||
|
|
||||||
|
|
||||||
# ---------------
|
# ---------------
|
||||||
|
21
v4l2/t.c
21
v4l2/t.c
@ -29,21 +29,32 @@ struct v4l2_requestbuffers reqbuf;
|
|||||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
|
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
|
||||||
|
|
||||||
vfd = open_device(dev);
|
vfd = open_device(dev);
|
||||||
if (verbosity) fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
|
fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
|
||||||
|
|
||||||
memset(&fmt, 0, sizeof(fmt));
|
memset(&fmt, 0, sizeof(fmt));
|
||||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
pr_v4l2_format("after 0", &fmt);
|
||||||
// pr_v4l2_format("before ioctl", &fmt);
|
|
||||||
|
|
||||||
foo = ioctl(vfd, VIDIOC_G_FMT, &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);
|
||||||
|
|
||||||
|
foo = ioctl(vfd, VIDIOC_S_FMT, &fmt);
|
||||||
fprintf(stderr, "ioctl -> %d\n", foo);
|
fprintf(stderr, "ioctl -> %d\n", foo);
|
||||||
if (0 != foo) {
|
if (foo < 0) {
|
||||||
perror("ioctl S_FMT");
|
perror("ioctl S_FMT");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_v4l2_format("after ioctl", &fmt);
|
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;
|
return k;
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@ static char *fmttype2str(int type)
|
|||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 0: return "[zero]";
|
case 0: return "[zero]";
|
||||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE: return "video capture";
|
case 1: return "video capture";
|
||||||
case V4L2_BUF_TYPE_VIDEO_OUTPUT: return "video output";
|
case 2: return "video output";
|
||||||
|
|
||||||
case 13: return "META capture";
|
case 13: return "META capture";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "XXX";
|
return "???";
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
static void pr_capabilities(uint32_t caps)
|
static void pr_capabilities(uint32_t caps)
|
||||||
@ -203,20 +203,13 @@ fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */
|
|||||||
|
|
||||||
switch(ptr->type) {
|
switch(ptr->type) {
|
||||||
|
|
||||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
|
case 1: // fputs(" Capture\n", FP);
|
||||||
fprintf(FP, " dims %dx%d\n",
|
fprintf(FP, " dims %dx%d\n",
|
||||||
ptr->fmt.pix.width,
|
ptr->fmt.pix.width,
|
||||||
ptr->fmt.pix.height);
|
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;
|
break;
|
||||||
|
|
||||||
default: fprintf(FP, "XXX type %d unknow\n", ptr->type);
|
default: fprintf(FP, "type is %d\n", ptr->type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,6 @@ return -1;
|
|||||||
int show_webcam_infos(char *devname, char *title, int k)
|
int show_webcam_infos(char *devname, char *title, int k)
|
||||||
{
|
{
|
||||||
int vfd, foo;
|
int vfd, foo;
|
||||||
char ligne[100];
|
|
||||||
|
|
||||||
struct v4l2_capability cap;
|
struct v4l2_capability cap;
|
||||||
// struct v4l2_format fmt;
|
// struct v4l2_format fmt;
|
||||||
@ -192,13 +191,11 @@ if (foo < 0) {
|
|||||||
pr_v4l2_capability(devname, &cap);
|
pr_v4l2_capability(devname, &cap);
|
||||||
|
|
||||||
memset(&input, 0, sizeof(input));
|
memset(&input, 0, sizeof(input));
|
||||||
input.index = 1;
|
|
||||||
if (-1 == ioctl(vfd, VIDIOC_ENUMINPUT, &input)) {
|
if (-1 == ioctl(vfd, VIDIOC_ENUMINPUT, &input)) {
|
||||||
perror("VIDIOC_ENUMINPUT");
|
perror("VIDIOC_ENUMINPUT");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sprintf(ligne, "input %d", input.index);
|
pr_v4l2_input("input 0", &input);
|
||||||
pr_v4l2_input(ligne, &input);
|
|
||||||
|
|
||||||
foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
|
foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
|
||||||
|
|
||||||
@ -229,6 +226,8 @@ puts("\t-K\tset the K parameter");
|
|||||||
puts("\t-l\tlist video devices");
|
puts("\t-l\tlist video devices");
|
||||||
puts("\t-v\tincrease verbosity");
|
puts("\t-v\tincrease verbosity");
|
||||||
|
|
||||||
|
if (verbosity) { puts(""); fimg_print_version(1); }
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
@ -249,6 +248,8 @@ while ((opt = getopt(argc, argv, "d:hK:lv")) != -1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verbosity) fimg_print_version(0);
|
||||||
|
|
||||||
foo = show_webcam_infos(device, "", K);
|
foo = show_webcam_infos(device, "", K);
|
||||||
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
|
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user