Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin M. Schwartz <bens@alum.mit.edu>2010-07-25 21:23:00 (GMT)
committer Benjamin M. Schwartz <bens@alum.mit.edu>2010-07-25 21:23:00 (GMT)
commitfe53992344e73a3adb5afa0e088bc04a4f0cdd98 (patch)
treec7f91ee305883418fc418eaa5fc1642f2c90c126
parent41f7e177c5d1fedb82890fbb59484f41a5470585 (diff)
Add option to specify the number of frames to capture
-rw-r--r--capture.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/capture.c b/capture.c
index 8d76983..086733f 100644
--- a/capture.c
+++ b/capture.c
@@ -170,11 +170,8 @@ read_frame (void)
}
static void
-mainloop (void)
+mainloop (unsigned int count)
{
- unsigned int count;
-
- count = 100;
while (count-- > 0) {
for (;;) {
@@ -592,11 +589,12 @@ usage (FILE * fp,
"-m | --mmap Use memory mapped buffers\n"
"-r | --read Use read() calls\n"
"-u | --userp Use application allocated buffers\n"
+ "-n | --numframes Number of frames to acquire (default=1)\n"
"",
argv[0]);
}
-static const char short_options [] = "d:hmru";
+static const char short_options [] = "d:hmrun";
static const struct option
long_options [] = {
@@ -605,6 +603,7 @@ long_options [] = {
{ "mmap", no_argument, NULL, 'm' },
{ "read", no_argument, NULL, 'r' },
{ "userp", no_argument, NULL, 'u' },
+ { "numframes", required_argument, NULL, 'n' },
{ 0, 0, 0, 0 }
};
@@ -617,6 +616,7 @@ main (int argc,
for (;;) {
int index;
int c;
+ unsigned int numframes = 1;
c = getopt_long (argc, argv,
short_options, long_options,
@@ -649,6 +649,10 @@ main (int argc,
io = IO_METHOD_USERPTR;
break;
+ case 'n':
+ numframes = atoi(optarg);
+ break;
+
default:
usage (stderr, argc, argv);
exit (EXIT_FAILURE);
@@ -661,7 +665,7 @@ main (int argc,
start_capturing ();
- mainloop ();
+ mainloop (numframes);
stop_capturing ();