From 7ea8cf67faaaa4c71ca1d5fc30d4475effb71c1e Mon Sep 17 00:00:00 2001 From: Philip Heron Date: Wed, 3 Feb 2010 10:45:48 +0000 Subject: [PATCH] FPS option part 2 --- fswebcam.1 | 6 ++++++ fswebcam.c | 8 ++++++++ src_v4l2.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fswebcam.1 b/fswebcam.1 index 440c04d..45d435e 100644 --- a/fswebcam.1 +++ b/fswebcam.1 @@ -161,6 +161,12 @@ Set the image resolution of the source or device. The actual resolution used may Default is "384x288". .TP +\fB\-\-fps\fR \fI\fR +Sets the frame rate of the capture device. This currently only works with certain V4L2 devices. +.IP +Default is "0", let the device decide. + +.TP \fB\-F\fR, \fB\-\-frames\fR \fI\fR Set the number of frames to capture. More frames mean less noise in the final image, however capture times will be longer and moving objects may appear blurred. .IP diff --git a/fswebcam.c b/fswebcam.c index 0c26b0e..068cb21 100644 --- a/fswebcam.c +++ b/fswebcam.c @@ -90,6 +90,7 @@ #define OPT_SAVE (OPTBASE + 46) #define OPT_EXEC (OPTBASE + 47) #define OPT_DUMPFRAME (OPTBASE + 48) +#define OPT_FPS (OPTBASE + 49) typedef struct { @@ -138,6 +139,7 @@ typedef struct { unsigned int width; unsigned int height; unsigned int frames; + unsigned int fps; unsigned int skipframes; int palette; src_option_t **option; @@ -1086,6 +1088,7 @@ int fswc_grab(fswebcam_config_t *config) src.palette = config->palette; src.width = config->width; src.height = config->height; + src.fps = config->fps; src.option = config->option; HEAD("--- Opening %s...", config->device); @@ -1592,6 +1595,7 @@ int fswc_usage() " -p, --palette Selects the palette format to use.\n" " -D, --delay Sets the pre-capture delay time. (seconds)\n" " -r, --resolution Sets the capture resolution.\n" + " --fps Sets the capture frame rate.\n" " -F, --frames Sets the number of frames to capture.\n" " -S, --skip Sets the number of frames to skip.\n" " --dumpframe Dump a raw frame frame to file.\n" @@ -1899,6 +1903,7 @@ int fswc_getopts(fswebcam_config_t *config, int argc, char *argv[]) config->list = 0; config->width = 384; config->height = 288; + config->fps = 0; config->frames = 1; config->skipframes = 0; config->palette = SRC_PAL_ANY; @@ -1987,6 +1992,9 @@ int fswc_getopts(fswebcam_config_t *config, int argc, char *argv[]) config->width = argtol(optarg, "x ", 0, 0, 10); config->height = argtol(optarg, "x ", 1, 0, 10); break; + case OPT_FPS: + config->fps = atoi(optarg); + break; case 'F': config->frames = atoi(optarg); break; diff --git a/src_v4l2.c b/src_v4l2.c index 9d7b1e4..92c8e9c 100644 --- a/src_v4l2.c +++ b/src_v4l2.c @@ -853,7 +853,7 @@ int src_v4l2_open(src_t *src) return(-1); } - /* Set the frame-rate. */ + /* Set the frame-rate if > 0 */ if(src->fps) src_v4l2_set_fps(src); /* Delay to let the image settle down. */ -- 2.11.4.GIT