summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/options.c62
-rw-r--r--src/options.h12
-rw-r--r--src/sydra.c11
3 files changed, 32 insertions, 53 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_);
}
diff --git a/src/options.h b/src/options.h
index 465291c..a89bb25 100644
--- a/src/options.h
+++ b/src/options.h
@@ -43,14 +43,10 @@ struct options_struct {
char* pid_file_;
string_list_t log_targets_;
int debug_;
- char* src_bin_desc_;
- char* output_dir_;
- char* name_format_;
- mode_t mode_;
- int nocache_;
- int interval_;
- int offset_;
- char* post_process_;
+
+ char* appname_;
+ char* rec_dir_;
+ char* rec_name_format_;
};
typedef struct options_struct options_t;
diff --git a/src/sydra.c b/src/sydra.c
index 2c0816f..ec87af8 100644
--- a/src/sydra.c
+++ b/src/sydra.c
@@ -96,7 +96,7 @@ int main_loop(options_t* opt)
}
GError *error = NULL;
- source = gst_parse_bin_from_description(opt->src_bin_desc_, TRUE, &error);
+ source = gst_parse_bin_from_description("videotestsrc ! xvimagesink", TRUE, &error);
if(!source || error) {
log_printf(ERROR, "Source Bin Description Parser Error: %s", error ? error->message : "unknown");
g_error_free(error);
@@ -173,6 +173,15 @@ int main(int argc, char* argv[])
log_printf(NOTICE, "just started...");
options_parse_post(&opt);
+ if(opt.debug_)
+ options_print(&opt);
+
+
+ if(opt.appname_)
+ g_set_prgname (opt.appname_);
+ else
+ g_set_prgname (opt.progname_);
+
priv_info_t priv;
if(opt.username_)
if(priv_init(&priv, opt.username_, opt.groupname_)) {