|
From: libvidcap c. <lib...@li...> - 2007-10-25 21:25:47
|
Revision: 56
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=56&view=rev
Author: jpgrayson
Date: 2007-10-25 14:25:46 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
Run with debug logging by default.
Add -q option to run in quiet mode.
Add -h option to print usage info.
Modified Paths:
--------------
trunk/examples/simplegrab.c
Modified: trunk/examples/simplegrab.c
===================================================================
--- trunk/examples/simplegrab.c 2007-10-25 21:23:37 UTC (rev 55)
+++ trunk/examples/simplegrab.c 2007-10-25 21:25:46 UTC (rev 56)
@@ -49,6 +49,7 @@
static int ctrl_c_pressed = 0;
+static int opt_quiet = 0;
static int opt_do_enumeration = 0;
static int opt_do_defaults = 0;
static int opt_do_captures = 0;
@@ -201,6 +202,17 @@
ctrl_c_pressed = 1;
}
+static void usage(void)
+{
+ fprintf(stderr, "Usage: simplegrab [OPTIONS]\n"
+ " -h -- show this help message\n"
+ " -q -- decrease libvidcap verbosity\n"
+ " -e -- do enumeration test\n"
+ " -d -- do defaults test\n"
+ " -c -- do capture test\n"
+ " -n -- do notification test\n");
+}
+
static int process_command_line(int argc, char * argv[])
{
int i;
@@ -223,6 +235,13 @@
opt_do_captures = 1;
else if ( !strcmp(argv[i], "-n") )
opt_do_notifies = 1;
+ else if ( !strcmp(argv[i], "-q") )
+ opt_quiet += 1;
+ else if ( !strcmp(argv[i], "-h") )
+ {
+ usage();
+ exit(0);
+ }
else
{
log_error("unknown option '%s'\n", argv[i]);
@@ -742,8 +761,18 @@
int main(int argc, char * argv[])
{
if ( process_command_line(argc, argv) )
+ {
+ usage();
return 1;
+ }
+ if ( opt_quiet > 1 )
+ vidcap_log_level_set(VIDCAP_LOG_WARN);
+ else if ( opt_quiet > 0 )
+ vidcap_log_level_set(VIDCAP_LOG_INFO);
+ else
+ vidcap_log_level_set(VIDCAP_LOG_DEBUG);
+
if ( opt_do_enumeration && do_enumeration() )
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: libvidcap c. <lib...@li...> - 2007-10-26 01:43:57
|
Revision: 57
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=57&view=rev
Author: jpgrayson
Date: 2007-10-25 18:43:56 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
Add new test to simplegrab that acquires two default sources.
Modified Paths:
--------------
trunk/examples/simplegrab.c
Modified: trunk/examples/simplegrab.c
===================================================================
--- trunk/examples/simplegrab.c 2007-10-25 21:25:46 UTC (rev 56)
+++ trunk/examples/simplegrab.c 2007-10-26 01:43:56 UTC (rev 57)
@@ -52,6 +52,7 @@
static int opt_quiet = 0;
static int opt_do_enumeration = 0;
static int opt_do_defaults = 0;
+static int opt_do_double_default = 0;
static int opt_do_captures = 0;
static int opt_do_notifies = 0;
@@ -221,6 +222,7 @@
{
opt_do_enumeration = 1;
opt_do_defaults = 1;
+ opt_do_double_default = 1;
opt_do_captures = 1;
opt_do_notifies = 1;
}
@@ -231,6 +233,8 @@
opt_do_enumeration = 1;
else if ( !strcmp(argv[i], "-d") )
opt_do_defaults = 1;
+ else if ( !strcmp(argv[i], "-2") )
+ opt_do_double_default = 1;
else if ( !strcmp(argv[i], "-c") )
opt_do_captures = 1;
else if ( !strcmp(argv[i], "-n") )
@@ -503,6 +507,133 @@
}
static int
+do_double_defaults()
+{
+ vidcap_state * vc;
+ vidcap_sapi * sapi;
+ vidcap_src * src;
+ vidcap_src * src2;
+
+ struct vidcap_sapi_info sapi_info;
+ struct vidcap_src_info src_info;
+ struct vidcap_src_info src_info2;
+ struct vidcap_fmt_info fmt_info;
+ struct vidcap_fmt_info fmt_info2;
+
+ char * fmt_str;
+
+ log_info("Starting defaults\n");
+
+ if ( !(vc = vidcap_initialize()) )
+ {
+ log_error("failed vidcap_initialize()\n");
+ return -1;
+ }
+
+ if ( !(sapi = vidcap_sapi_acquire(vc, 0)) )
+ {
+ log_error("failed to acquire default sapi\n");
+ return -1;
+ }
+
+ if ( vidcap_sapi_info_get(sapi, &sapi_info) )
+ {
+ log_error("failed to get default sapi info\n");
+ return -1;
+ }
+
+ log_info("sapi default: %s | %s\n", sapi_info.identifier,
+ sapi_info.description);
+
+ if ( !(src = vidcap_src_acquire(sapi, 0)) )
+ {
+ log_error("failed to acquire default src\n");
+ return -1;
+ }
+
+ if ( vidcap_src_info_get(src, &src_info) )
+ {
+ log_error("failed to get default src info\n");
+ return -1;
+ }
+
+ log_info(" src default: %s | %s\n", src_info.identifier,
+ src_info.description);
+
+ if ( vidcap_format_bind(src, 0) )
+ {
+ log_error("failed to bind default format\n");
+ return -1;
+ }
+
+ if ( vidcap_format_info_get(src, &fmt_info) )
+ {
+ log_error("failed to get default fmt info\n");
+ return -1;
+ }
+
+ fmt_str = my_fmt_info_str(&fmt_info);
+ log_info(" fmt default: %s\n", fmt_str);
+ free(fmt_str);
+
+ /* Acquire a second default (with first still acquired) */
+ if ( !(src2 = vidcap_src_acquire(sapi, 0)) )
+ {
+ log_error("failed to acquire default src 2\n");
+ return -1;
+ }
+
+ if ( vidcap_src_info_get(src2, &src_info2) )
+ {
+ log_error("failed to get default src info 2\n");
+ return -1;
+ }
+
+ log_info(" src default 2: %s | %s\n", src_info2.identifier,
+ src_info2.description);
+
+ if ( vidcap_format_bind(src2, 0) )
+ {
+ log_error("failed to bind default format 2\n");
+ return -1;
+ }
+
+ if ( vidcap_format_info_get(src2, &fmt_info2) )
+ {
+ log_error("failed to get default fmt info 2\n");
+ return -1;
+ }
+
+ fmt_str = my_fmt_info_str(&fmt_info2);
+ log_info(" fmt default 2: %s\n", fmt_str);
+ free(fmt_str);
+
+ if ( vidcap_src_release(src) )
+ {
+ log_error("failed to release src\n");
+ return -1;
+ }
+
+ if ( vidcap_src_release(src2) )
+ {
+ log_error("failed to release src 2\n");
+ return -1;
+ }
+
+ if ( vidcap_sapi_release(sapi) )
+ {
+ log_error("failed to release sapi\n");
+ return -1;
+ }
+
+ vidcap_destroy(vc);
+
+ log_info("Finished defaults\n\n");
+
+ return 0;
+}
+
+static int
do_captures()
{
const int sleep_ms = 10000;
@@ -779,6 +910,9 @@
if ( opt_do_defaults && do_defaults() )
return 1;
+ if ( opt_do_double_default && do_double_defaults() )
+ return 1;
+
if ( opt_do_captures && do_captures() )
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: libvidcap c. <lib...@li...> - 2007-12-12 20:46:24
|
Revision: 83
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=83&view=rev
Author: bcholew
Date: 2007-12-12 12:46:06 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
Fixup help message to include -2 option. Improve command line argument parsing. Thanks Pete Grayson.
Modified Paths:
--------------
trunk/examples/simplegrab.c
Modified: trunk/examples/simplegrab.c
===================================================================
--- trunk/examples/simplegrab.c 2007-12-12 20:43:46 UTC (rev 82)
+++ trunk/examples/simplegrab.c 2007-12-12 20:46:06 UTC (rev 83)
@@ -210,6 +210,7 @@
" -q -- decrease libvidcap verbosity\n"
" -e -- do enumeration test\n"
" -d -- do defaults test\n"
+ " -2 -- do double default test\n"
" -c -- do capture test\n"
" -n -- do notification test\n");
}
@@ -218,15 +219,6 @@
{
int i;
- if ( argc == 1 )
- {
- opt_do_enumeration = 1;
- opt_do_defaults = 1;
- opt_do_double_default = 1;
- opt_do_captures = 1;
- opt_do_notifies = 1;
- }
-
for ( i = 1; i < argc; ++i )
{
if ( !strcmp(argv[i], "-e") )
@@ -253,6 +245,22 @@
}
}
+ /* If none of the tests are explicitly set, then we go ahead
+ * and do all of them.
+ */
+ if ( !(opt_do_enumeration ||
+ opt_do_defaults ||
+ opt_do_double_default ||
+ opt_do_captures ||
+ opt_do_notifies) )
+ {
+ opt_do_enumeration = 1;
+ opt_do_defaults = 1;
+ opt_do_double_default = 1;
+ opt_do_captures = 1;
+ opt_do_notifies = 1;
+ }
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: libvidcap c. <lib...@li...> - 2008-06-25 15:19:58
|
Revision: 95
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=95&view=rev
Author: jpgrayson
Date: 2008-06-25 08:19:55 -0700 (Wed, 25 Jun 2008)
Log Message:
-----------
Fix log message.
Modified Paths:
--------------
trunk/examples/simplegrab.c
Modified: trunk/examples/simplegrab.c
===================================================================
--- trunk/examples/simplegrab.c 2008-04-28 19:16:42 UTC (rev 94)
+++ trunk/examples/simplegrab.c 2008-06-25 15:19:55 UTC (rev 95)
@@ -530,7 +530,7 @@
char * fmt_str;
- log_info("Starting defaults\n");
+ log_info("Starting double defaults\n");
if ( !(vc = vidcap_initialize()) )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|