Compare commits
2 Commits
af40e8a0e5
...
a47730d09d
Author | SHA1 | Date | |
---|---|---|---|
a47730d09d | |||
4a0941f76b |
@ -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 $< ../libfloatimg.a funcs.o v4l2_pr_structs.o -o $@
|
gcc -Wall -g $< funcs.o v4l2_pr_structs.o -o $@
|
||||||
|
|
||||||
|
|
||||||
# ---------------
|
# ---------------
|
||||||
|
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);
|
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
|
||||||
|
|
||||||
vfd = open_device(dev);
|
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));
|
memset(&fmt, 0, sizeof(fmt));
|
||||||
pr_v4l2_format("after 0", &fmt);
|
|
||||||
|
|
||||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
fmt.fmt.pix.width = 640;
|
// pr_v4l2_format("before ioctl", &fmt);
|
||||||
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_G_FMT, &fmt);
|
||||||
|
|
||||||
foo = ioctl(vfd, VIDIOC_S_FMT, &fmt);
|
|
||||||
fprintf(stderr, "ioctl -> %d\n", foo);
|
fprintf(stderr, "ioctl -> %d\n", foo);
|
||||||
if (foo < 0) {
|
if (0 != foo) {
|
||||||
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 1: return "video capture";
|
case V4L2_BUF_TYPE_VIDEO_CAPTURE: return "video capture";
|
||||||
case 2: return "video output";
|
case V4L2_BUF_TYPE_VIDEO_OUTPUT: return "video output";
|
||||||
|
|
||||||
case 13: return "META capture";
|
case 13: return "META capture";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "???";
|
return "XXX";
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
static void pr_capabilities(uint32_t caps)
|
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) {
|
switch(ptr->type) {
|
||||||
|
|
||||||
case 1: // fputs(" Capture\n", FP);
|
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
|
||||||
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, "type is %d\n", ptr->type);
|
default: fprintf(FP, "XXX type %d unknow\n", ptr->type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,7 @@ 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;
|
||||||
@ -191,11 +192,13 @@ 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);
|
||||||
}
|
}
|
||||||
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);
|
foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
|
||||||
|
|
||||||
@ -226,8 +229,6 @@ 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);
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
@ -248,8 +249,6 @@ 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