aller chercher de la biere et des patates

This commit is contained in:
Tonton Th 2019-05-25 18:14:01 +02:00
parent bfc600f5a0
commit 6527f5d398
3 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ essai
v4l2/t v4l2/t
v4l2/capture v4l2/capture
v4l2/*.o v4l2/*.o
v4l2/*.ppm
tools/fimg2png tools/fimg2png
tools/fimg2pnm tools/fimg2pnm

5
v4l2/README.txt Normal file
View File

@ -0,0 +1,5 @@
capture video
-------------

View File

@ -117,7 +117,7 @@
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
xioctl(fd, VIDIOC_STREAMON, &type); xioctl(fd, VIDIOC_STREAMON, &type);
for (i = 0; i < 20; i++) { for (i = 0; i < 10; i++) {
do { do {
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(fd, &fds); FD_SET(fd, &fds);
@ -139,6 +139,7 @@
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
sprintf(out_name, "out%03d.ppm", i); sprintf(out_name, "out%03d.ppm", i);
fprintf(stderr, "-- %s\n", out_name);
fout = fopen(out_name, "w"); fout = fopen(out_name, "w");
if (!fout) { if (!fout) {
perror("Cannot open image"); perror("Cannot open image");
@ -148,7 +149,7 @@
fmt.fmt.pix.width, fmt.fmt.pix.height); fmt.fmt.pix.width, fmt.fmt.pix.height);
fwrite(buffers[buf.index].start, buf.bytesused, 1, fout); fwrite(buffers[buf.index].start, buf.bytesused, 1, fout);
fclose(fout); fclose(fout);
sleep(30); sleep(190);
xioctl(fd, VIDIOC_QBUF, &buf); xioctl(fd, VIDIOC_QBUF, &buf);
} }