diff options
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/options.c b/src/options.c index f4a101b..eddf914 100644 --- a/src/options.c +++ b/src/options.c @@ -197,10 +197,17 @@ int options_parse(options_t* opt, int argc, char* argv[]) PARSE_STRING_LIST("-L","--log", opt->log_targets_) PARSE_BOOL_PARAM("-U", "--debug", opt->debug_) PARSE_STRING_PARAM("-s","--source", opt->src_bin_desc_) - else + PARSE_STRING_PARAM("-d","--output-dir", opt->output_dir_) + PARSE_STRING_PARAM("-f","--name-format", opt->name_format_) + PARSE_INT_PARAM("-l","--length", opt->length_) + PARSE_INT_PARAM("-o","--offset", opt->offset_) + else return i; } + if(opt->length_ <= 0) + return -4; + if(opt->debug_) { string_list_add(&opt->log_targets_, "stdout:5"); opt->daemonize_ = 0; @@ -235,6 +242,10 @@ void options_default(options_t* opt) 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->length_ = 3600; + opt->offset_ = 0; } void options_clear(options_t* opt) @@ -255,6 +266,10 @@ void options_clear(options_t* opt) 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_); } void options_print_usage() @@ -272,6 +287,10 @@ void options_print_usage() 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 date for the syntax\n"); + printf(" [-l|--length] <value> length of one file in seconds\n"); + printf(" [-o|--offset] <value> time offset for recordings in 0.1s\n"); } void options_print_version() @@ -295,4 +314,8 @@ void options_print(options_t* opt) 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("length: %d\n", opt->length_); + printf("offset: %d\n", opt->offset_); } |