summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-03 23:57:59 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-03 23:57:59 +0200
commit84f7ba47c32bfe5f31ee733f911c3a158ad774bb (patch)
treeeb072341b3afd6fb5fef58bfc005ca069a63d6aa /src/options.c
parentadded git ignore file (diff)
updated options parser
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c62
1 files changed, 18 insertions, 44 deletions
diff --git a/src/options.c b/src/options.c
index 1273542..afe9a37 100644
--- a/src/options.c
+++ b/src/options.c
@@ -198,21 +198,13 @@ int options_parse(options_t* opt, int argc, char* argv[])
PARSE_STRING_PARAM("-P","--write-pid", opt->pid_file_)
PARSE_STRING_LIST("-L","--log", opt->log_targets_)
PARSE_BOOL_PARAM("-U", "--debug", opt->debug_)
- PARSE_STRING_PARAM("-s","--source", opt->src_bin_desc_)
- PARSE_STRING_PARAM("-d","--output-dir", opt->output_dir_)
- PARSE_STRING_PARAM("-f","--name-format", opt->name_format_)
- PARSE_INT_PARAM("-m","--mode", opt->mode_, 8)
- PARSE_BOOL_PARAM("-n", "--nocache", opt->nocache_)
- PARSE_INT_PARAM("-i","--interval", opt->interval_, 10)
- PARSE_INT_PARAM("-o","--offset", opt->offset_, 10)
- PARSE_STRING_PARAM("-x","--post-process", opt->post_process_)
+ PARSE_STRING_PARAM("-n","--appname", opt->appname_)
+ PARSE_STRING_PARAM("-R","--rec-dir", opt->rec_dir_)
+ PARSE_STRING_PARAM("-r","--rec-name-format", opt->rec_name_format_)
else
return i;
}
- if(opt->interval_ <= 0)
- return -4;
-
if(opt->debug_) {
string_list_add(&opt->log_targets_, "stdout:5");
opt->daemonize_ = 0;
@@ -246,14 +238,9 @@ void options_default(options_t* opt)
opt->pid_file_ = NULL;
string_list_init(&opt->log_targets_);
opt->debug_ = 0;
- opt->src_bin_desc_ = NULL;
- opt->output_dir_ = strdup("/srv/archiv");
- opt->name_format_ = strdup("%Y-%m-%d-%H00.ogg");
- opt->mode_ = 0644;
- opt->nocache_ = 0;
- opt->interval_ = 50;
- opt->offset_ = 0;
- opt->post_process_ = NULL;
+ opt->appname_ = NULL;
+ opt->rec_dir_ = strdup("./recordings/");
+ opt->rec_name_format_ = strdup("%Y-%m-%d_%H-%M-$S");
}
void options_clear(options_t* opt)
@@ -272,14 +259,12 @@ void options_clear(options_t* opt)
if(opt->pid_file_)
free(opt->pid_file_);
string_list_clear(&opt->log_targets_);
- if(opt->src_bin_desc_)
- free(opt->src_bin_desc_);
- if(opt->output_dir_)
- free(opt->output_dir_);
- if(opt->name_format_)
- free(opt->name_format_);
- if(opt->post_process_)
- free(opt->post_process_);
+ if(opt->appname_)
+ free(opt->appname_);
+ if(opt->rec_dir_)
+ free(opt->rec_dir_);
+ if(opt->rec_name_format_)
+ free(opt->rec_name_format_);
}
void options_print_usage()
@@ -295,15 +280,9 @@ void options_print_usage()
printf(" [-L|--log] <target>:<level>[,<param1>[,<param2>..]]\n");
printf(" add a log target, can be invoked several times\n");
printf(" [-U|--debug] don't daemonize and log to stdout with maximum log level\n");
- printf(" [-s|--source] <description> a gstreamer pipeline-style description which will be used\n");
- printf(" as data source, see gst-launch man-page for syntax\n");
- printf(" [-d|--output-dir] <path> path to the output directory\n");
- printf(" [-f|--name-format] <format> the file name format, see manpage of strftime for the syntax\n");
- printf(" [-m|--mode] <value> octal representation of the file permission mode\n");
- printf(" [-n|--nocache] Use O_DIRECT for recorded files\n");
- printf(" [-i|--interval] <value> interval for time checks in ms\n");
- printf(" [-o|--offset] <value> time offset for recordings in ms\n");
- printf(" [-x|--post-process] <script> call script when file is finished\n");
+ printf(" [-n|--appname] <name> set the application name (will be used by xvimagesink for window title\n");
+ printf(" [-R|--rec-dir] <path> path to the recording directory\n");
+ printf(" [-r|--rec-name-format] <format> the recording file name format, see manpage of strftime for the syntax\n");
}
void options_print_version()
@@ -326,12 +305,7 @@ void options_print(options_t* opt)
printf("log_targets: \n");
string_list_print(&opt->log_targets_, " '", "'\n");
printf("debug: %s\n", !opt->debug_ ? "false" : "true");
- printf("src_bin_desc: >>%s<<\n", opt->src_bin_desc_);
- printf("output_dir: '%s'\n", opt->output_dir_);
- printf("name_format: '%s'\n", opt->name_format_);
- printf("mode: %04o\n", (int)opt->mode_);
- printf("nocache: %s\n", !opt->nocache_ ? "false" : "true");
- printf("interval: %d\n", opt->interval_);
- printf("offset: %d\n", opt->offset_);
- printf("post_process: '%s'\n", opt->post_process_);
+ printf("appname: >>%s<<\n", opt->appname_);
+ printf("rec_output_dir: '%s'\n", opt->rec_dir_);
+ printf("rec_name_format: '%s'\n", opt->rec_name_format_);
}