From ffda756fdea19683cf00f85a0fa79f543e4d5a6e Mon Sep 17 00:00:00 2001 From: tonton th Date: Fri, 15 Jan 2021 13:44:54 +0100 Subject: [PATCH] tracking a non existant bug --- v4l2/grabvidseq.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/v4l2/grabvidseq.c b/v4l2/grabvidseq.c index 024af53e..ef855ae4 100644 --- a/v4l2/grabvidseq.c +++ b/v4l2/grabvidseq.c @@ -106,8 +106,9 @@ char *dev_name = "/dev/video0"; struct buffer *buffers; int foo; -double period = 10.0; /* delai entre les captures */ -int nbre_capt = 1; /* nombre de captures */ +double period = 10.0; /* delai entre les captures + en secondes */ +int nbre_capt = 1; /* nombre de captures */ int opt; int width = 640; int height = 480; @@ -144,7 +145,6 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uv")) != -1) { optarg); exit(1); } - period *= 1e6; break; case 'r': rotfactor = atoi(optarg); break; case 's': parse_WxH(optarg, &width, &height); @@ -162,7 +162,7 @@ if (verbosity > 1) { fprintf(stderr, "*** GrabVidSeq (%s, %s) libv %d, pid=%d\n", __DATE__, __TIME__, FIMG_VERSION, getpid()); fprintf(stderr, "grabing %d picz, ", nbre_capt); - fprintf(stderr, "period is %.3f milliseconds\n", period/1e3); + fprintf(stderr, "period is %.3f seconds\n", period); fprintf(stderr, "framesize is %dx%d\n", width, height); // fprintf(stderr, "destdir is '%s'\n", dest_dir); if (upscaling) fprintf(stderr, "upscaling is on\n"); @@ -277,7 +277,7 @@ for (i = 0; i < nbre_capt; i++) { } if(verbosity > 1) { - fprintf(stderr, "%6d / %6d %9.3f\n", i, nbre_capt, + fprintf(stderr, "%6d / %6d %9.3f\r", i, nbre_capt, fimg_timer_get(0)); fflush(stderr); } @@ -309,15 +309,15 @@ for (i = 0; i < nbre_capt; i++) { out_name); #endif - if (nbre_capt > 1 && period > 1.0) { - usleep(period); + if (nbre_capt > 1 && period > 0.001) { + /* suspend execution for + microsecond intervals */ + usleep((int)(period*1E6)); } xioctl(fd, VIDIOC_QBUF, &buf); } -fflush(stdout); - if (verbosity) { t_final = fimg_timer_get(0); fprintf(stderr, "pid %d : elapsed %.3g s -> %.2f fps\n", getpid(), @@ -398,8 +398,6 @@ switch (foo) { } // free buffers - - fimg_destroy(&cumul); #endif