diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-10 18:21:34 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-10 18:21:34 -0200 |
commit | ec7319f671797ad96fdf275577a162c7789e73f9 (patch) | |
tree | ad989d787aa5f87ded5f9b9ff1e4e3cdc6ea3959 /v4l2-apps | |
parent | 2c0b6e88d3a926ef7a9e118642f1aedf091c29f8 (diff) | |
download | mediapointer-dvb-s2-ec7319f671797ad96fdf275577a162c7789e73f9.tar.gz mediapointer-dvb-s2-ec7319f671797ad96fdf275577a162c7789e73f9.tar.bz2 |
command line: added --frames, touched up
From: Carl Karsten <carl@personnelware.com>
1. Added command line option -f --frames for number of frames to grab
2. changed the default -f from 1000 to 70
3. show defaults in --help
4. added a Version, picked 1.3 as the current ver because I consider the
original to be 1.0 and at least 2 changes have been made.
Signed-off-by: Carl Karsten <carl@personnelware.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l2-apps')
-rw-r--r-- | v4l2-apps/test/capture_example.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/v4l2-apps/test/capture_example.c b/v4l2-apps/test/capture_example.c index a15ef3c09..0cd129885 100644 --- a/v4l2-apps/test/capture_example.c +++ b/v4l2-apps/test/capture_example.c @@ -47,6 +47,7 @@ struct buffer *buffers; static unsigned int n_buffers; static int out_buf; static int force_format; +static int frame_count = 70; static void errno_exit(const char *s) { @@ -171,7 +172,7 @@ static void mainloop(void) { unsigned int count; - count = 1000; + count = frame_count; while (count-- > 0) { for (;;) { @@ -558,19 +559,21 @@ static void usage(FILE *fp, int argc, char **argv) { fprintf(fp, "Usage: %s [options]\n\n" + "Version 1.3\n" "Options:\n" - "-d | --device name Video device name [/dev/video0]\n" + "-d | --device name Video device name [%s]\n" "-h | --help Print this message\n" - "-m | --mmap Use memory mapped buffers\n" + "-m | --mmap Use memory mapped buffers [default]\n" "-r | --read Use read() calls\n" "-u | --userp Use application allocated buffers\n" "-o | --output Outputs stream to stdout\n" "-f | --format Force format to 640x480 YUYV\n" + "-c | --count Number of frames to grab [%i]\n" "", - argv[0]); + argv[0],dev_name,frame_count ); } -static const char short_options[] = "d:hmruof"; +static const char short_options[] = "d:hmruofc:"; static const struct option long_options[] = { @@ -581,6 +584,7 @@ long_options[] = { { "userp", no_argument, NULL, 'u' }, { "output", no_argument, NULL, 'o' }, { "format", no_argument, NULL, 'f' }, + { "count", required_argument, NULL, 'c' }, { 0, 0, 0, 0 } }; @@ -630,6 +634,13 @@ int main(int argc, char **argv) force_format++; break; + case 'c': + errno = 0; + frame_count = strtol(optarg, NULL, 0); + if (errno) + errno_exit(optarg); + break; + default: usage(stderr, argc, argv); exit(EXIT_FAILURE); |