more pretty formating

This commit is contained in:
Tonton Th 2019-05-28 11:56:02 +02:00
parent b97c24befe
commit cd0aaf45ca
1 changed files with 36 additions and 33 deletions

View File

@ -1,4 +1,7 @@
/* V4L2 video picture grabber /* V4L2 video picture grabber
Origin :V4L2GRAB.C - patched by tTh
Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -11,24 +14,24 @@
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <libv4l2.h> #include <libv4l2.h>
#define CLEAR(x) memset(&(x), 0, sizeof(x)) #define CLEAR(x) memset(&(x), 0, sizeof(x))
struct buffer { struct buffer {
void *start; void *start;
size_t length; size_t length;
}; };
int verbosity; int verbosity;
@ -59,24 +62,24 @@ exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct v4l2_format fmt; struct v4l2_format fmt;
struct v4l2_buffer buf; struct v4l2_buffer buf;
struct v4l2_requestbuffers req; struct v4l2_requestbuffers req;
enum v4l2_buf_type type; enum v4l2_buf_type type;
fd_set fds; fd_set fds;
struct timeval tv; struct timeval tv;
int r, fd = -1; int r, fd = -1;
unsigned int i, n_buffers; unsigned int i, n_buffers;
char *dev_name = "/dev/video0"; char *dev_name = "/dev/video0";
char out_name[256]; char out_name[256];
FILE *fout; FILE *fout;
struct buffer *buffers; struct buffer *buffers;
int period = 10; /* delai entre les captures */ int period = 10; /* delai entre les captures */
int nbre_capt = 1; /* nombre de captures */ int nbre_capt = 1; /* nombre de captures */
int opt; int opt;
while ((opt = getopt(argc, argv, "d:hn:p:v")) != -1) { while ((opt = getopt(argc, argv, "d:hn:p:v")) != -1) {
switch(opt) { switch(opt) {