Add a verbosity flag to getframe
This commit is contained in:
@@ -123,6 +123,9 @@ typedef struct _lmp_aaa {
|
|||||||
EXPORT int
|
EXPORT int
|
||||||
libmegapixels_init(libmegapixels_devconfig **config);
|
libmegapixels_init(libmegapixels_devconfig **config);
|
||||||
|
|
||||||
|
EXPORT void
|
||||||
|
libmegapixels_loglevel(int loglevel);
|
||||||
|
|
||||||
EXPORT int
|
EXPORT int
|
||||||
libmegapixels_load_file(libmegapixels_devconfig *config, const char *file);
|
libmegapixels_load_file(libmegapixels_devconfig *config, const char *file);
|
||||||
|
|
||||||
|
@@ -17,6 +17,12 @@ init_log(int level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
libmegapixels_loglevel(int level)
|
||||||
|
{
|
||||||
|
loglevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
log_error(const char *fmt, ...)
|
log_error(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@@ -37,6 +37,7 @@ usage(char *name)
|
|||||||
fprintf(stderr, " -c camera Use a specific camera number\n");
|
fprintf(stderr, " -c camera Use a specific camera number\n");
|
||||||
fprintf(stderr, " -m modenum Use another camera mode than the first\n");
|
fprintf(stderr, " -m modenum Use another camera mode than the first\n");
|
||||||
fprintf(stderr, " -o file File to store the frame in\n");
|
fprintf(stderr, " -o file File to store the frame in\n");
|
||||||
|
fprintf(stderr, " -v Show verbose debug info\n");
|
||||||
fprintf(stderr, " -h Display this help text\n");
|
fprintf(stderr, " -h Display this help text\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +51,9 @@ main(int argc, char *argv[])
|
|||||||
char *outfile = NULL;
|
char *outfile = NULL;
|
||||||
int count = 5;
|
int count = 5;
|
||||||
int mode_idx = 0;
|
int mode_idx = 0;
|
||||||
|
int verbose = 0;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "hc:n:o:m:")) != -1) {
|
while ((c = getopt(argc, argv, "hvc:n:o:m:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'c':
|
case 'c':
|
||||||
res = strtol(optarg, &end, 10);
|
res = strtol(optarg, &end, 10);
|
||||||
@@ -84,6 +86,9 @@ main(int argc, char *argv[])
|
|||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
verbose = 1;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
if (optopt == 'd' || optopt == 'l') {
|
if (optopt == 'd' || optopt == 'l') {
|
||||||
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
||||||
@@ -104,6 +109,9 @@ main(int argc, char *argv[])
|
|||||||
int ret = libmegapixels_find_config(configpath);
|
int ret = libmegapixels_find_config(configpath);
|
||||||
libmegapixels_devconfig *config = {0};
|
libmegapixels_devconfig *config = {0};
|
||||||
libmegapixels_init(&config);
|
libmegapixels_init(&config);
|
||||||
|
if (verbose) {
|
||||||
|
libmegapixels_loglevel(2);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("Using config: %s\n", configpath);
|
printf("Using config: %s\n", configpath);
|
||||||
|
Reference in New Issue
Block a user