summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2011-06-08 23:38:42 +0000
committerChristian Pointner <equinox@spreadspace.org>2011-06-08 23:38:42 +0000
commit7d00811baa81fd97088e8d5d24faba1ad705a9ae (patch)
treeed3f961c44fbc0cc21a46f94155233a977112f13
parentimplemened first version for resolving (diff)
added options
-rw-r--r--src/gstdvbbackend.c2
-rw-r--r--src/options.c39
-rw-r--r--src/options.h14
3 files changed, 46 insertions, 9 deletions
diff --git a/src/gstdvbbackend.c b/src/gstdvbbackend.c
index 729c161..db127d1 100644
--- a/src/gstdvbbackend.c
+++ b/src/gstdvbbackend.c
@@ -155,7 +155,7 @@ int main(int argc, char* argv[])
if(ret == -3)
options_print_version();
if(ret == -4)
- fprintf(stderr, "the interval must be bigger than 0\n");
+ fprintf(stderr, "value out of range\n");
if(ret != -2 && ret != -3 && ret != -4)
options_print_usage();
diff --git a/src/options.c b/src/options.c
index 33427ce..491b4f0 100644
--- a/src/options.c
+++ b/src/options.c
@@ -194,11 +194,19 @@ 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_INT_PARAM("-a","--adapter", opt->adapter_, 10)
+ PARSE_INT_PARAM("-F","--frontend", opt->frontend_, 10)
+ PARSE_INT_PARAM("-f","--frequency", opt->frequency_, 10)
+ PARSE_STRING_PARAM("-o","--polarity", opt->polarity_)
+ PARSE_STRING_PARAM("-i","--pids", opt->pids_)
+ PARSE_STRING_PARAM("-H","--host", opt->host_)
+ PARSE_STRING_PARAM("-p","--port", opt->port_)
+
else
return i;
}
- if(opt->interval_ <= 0)
+ if(opt->frequency_ < 0 || opt->adapter_ < 0 || opt->frontend_ < 0)
return -4;
if(opt->debug_) {
@@ -234,6 +242,13 @@ void options_default(options_t* opt)
opt->pid_file_ = NULL;
string_list_init(&opt->log_targets_);
opt->debug_ = 0;
+ opt->adapter_ = 0;
+ opt->frontend_ = 0;
+ opt->frequency_ = 514000000;
+ opt->polarity_ = strdup("H");
+ opt->pids_ = strdup("5010:5011");
+ opt->host_ = NULL;
+ opt->port_ = strdup("80");
}
void options_clear(options_t* opt)
@@ -252,6 +267,14 @@ void options_clear(options_t* opt)
if(opt->pid_file_)
free(opt->pid_file_);
string_list_clear(&opt->log_targets_);
+ if(opt->polarity_)
+ free(opt->polarity_);
+ if(opt->pids_)
+ free(opt->pids_);
+ if(opt->host_)
+ free(opt->host_);
+ if(opt->port_)
+ free(opt->port_);
}
void options_print_usage()
@@ -267,6 +290,13 @@ 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(" [-a|--adapter] <num> the dvb adapter to use (default 0)\n");
+ printf(" [-F|--frontend] <num> the dvb adapter to use (default 0)\n");
+ printf(" [-f|--frequency <hertz> the frequency to tune to (default 514000000)\n");
+ printf(" [-o|--polarity (H,V) polarity of the signal (default H)\n");
+ printf(" [-i|--pids <pid:pid> the pids of the stream (default 5010:5011)\n");
+ printf(" [-H|--host <addr> the local interface to bind to (default any interface)\n");
+ printf(" [-p|--port <port> the port to listen to (default 80)\n");
}
void options_print_version()
@@ -289,4 +319,11 @@ 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("adapter: %d\n", opt->adapter_);
+ printf("frontend: %d\n", opt->frontend_);
+ printf("frequency: %d\n", opt->frequency_);
+ printf("polarity: '%s'\n", opt->polarity_);
+ printf("pids: '%s'\n", opt->pids_);
+ printf("host: '%s'\n", opt->host_);
+ printf("port: '%s'\n", opt->port_);
}
diff --git a/src/options.h b/src/options.h
index 25c5eb4..cb5b962 100644
--- a/src/options.h
+++ b/src/options.h
@@ -39,13 +39,13 @@ 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 interval_;
- int offset_;
- char* post_process_;
+ int adapter_;
+ int frontend_;
+ int frequency_;
+ char* polarity_;
+ char* pids_;
+ char* host_;
+ char* port_;
};
typedef struct options_struct options_t;