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