forked from tTh/FloatImg
we can select the output directory
This commit is contained in:
parent
862ab2a30e
commit
503c40f6df
@ -58,6 +58,7 @@ void help(int v)
|
|||||||
puts("options :");
|
puts("options :");
|
||||||
puts("\t-d /dev/?\tselect video device");
|
puts("\t-d /dev/?\tselect video device");
|
||||||
puts("\t-n NNN\t\thow many frames ?");
|
puts("\t-n NNN\t\thow many frames ?");
|
||||||
|
puts("\t-O ./\t\tset Output dir");
|
||||||
puts("\t-p NNN\t\tperiod in seconds");
|
puts("\t-p NNN\t\tperiod in seconds");
|
||||||
puts("\t-v\t\tincrease verbosity");
|
puts("\t-v\t\tincrease verbosity");
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -83,12 +84,14 @@ 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;
|
||||||
double t_debut, t_final;
|
double t_debut, t_final;
|
||||||
|
char dest_dir = ""; /* must have the trailing slash */
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "d:hn:p:v")) != -1) {
|
while ((opt = getopt(argc, argv, "d:hn:O:p:v")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'd': dev_name = optarg; break;
|
case 'd': dev_name = optarg; break;
|
||||||
case 'h': help(0); break;
|
case 'h': help(0); break;
|
||||||
case 'n': nbre_capt = atoi(optarg); break;
|
case 'n': nbre_capt = atoi(optarg); break;
|
||||||
|
case 'O': dest_dir = optarg; break;
|
||||||
case 'p': period = atoi(optarg); break;
|
case 'p': period = atoi(optarg); break;
|
||||||
case 'v': verbosity++; break;
|
case 'v': verbosity++; break;
|
||||||
}
|
}
|
||||||
@ -179,7 +182,7 @@ for (i = 0; i < nbre_capt; i++) {
|
|||||||
buf.memory = V4L2_MEMORY_MMAP;
|
buf.memory = V4L2_MEMORY_MMAP;
|
||||||
xioctl(fd, VIDIOC_DQBUF, &buf);
|
xioctl(fd, VIDIOC_DQBUF, &buf);
|
||||||
|
|
||||||
sprintf(out_name, "out%03d.ppm", i);
|
sprintf(out_name, "%s/%05d.ppm", dest_dir, i);
|
||||||
if (verbosity) fprintf(stderr, "--> %s\n", out_name);
|
if (verbosity) fprintf(stderr, "--> %s\n", out_name);
|
||||||
|
|
||||||
fout = fopen(out_name, "w");
|
fout = fopen(out_name, "w");
|
||||||
@ -199,7 +202,7 @@ for (i = 0; i < nbre_capt; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t_final = fimg_timer_get(0);
|
t_final = fimg_timer_get(0);
|
||||||
fprintf(stderr, "elapsed time %g s.\n", t_final);
|
fprintf(stderr, "elapsed time %g s\n", t_final);
|
||||||
|
|
||||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
xioctl(fd, VIDIOC_STREAMOFF, &type);
|
xioctl(fd, VIDIOC_STREAMOFF, &type);
|
||||||
|
Loading…
Reference in New Issue
Block a user