X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=play.c;h=9204792d0f5607a17d05a812dc83b0ff62bec49c;hb=75feacbafa2a1fe258f85963205b8c28a976badc;hp=047c959bf2868bf018c169c57d64110825e332de;hpb=83ab4b5d38bb63cf4724022c3804d3eaa2ac51d3;p=paraslash.git diff --git a/play.c b/play.c index 047c959b..9204792d 100644 --- a/play.c +++ b/play.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Andre Noll + * Copyright (C) 2012-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -7,7 +7,6 @@ /** \file play.c Paraslash's standalone player. */ #include -#include #include #include @@ -154,9 +153,7 @@ __noreturn static void print_help_and_die(void) const char **p = d? play_args_info_detailed_help : play_args_info_help; -// printf_or_die("%s\n\n", PLAY_CMDLINE_PARSER_PACKAGE "-" -// PLAY_CMDLINE_PARSER_VERSION); - + printf_or_die("%s\n\n", VERSION_SINGLE_LINE("play")); printf_or_die("%s\n\n", play_args_info_usage); if (d) printf_or_die("%s\n", PP_DESC); @@ -177,12 +174,11 @@ static void parse_config_or_die(int argc, char *argv[]) .print_errors = 1 }; - if (play_cmdline_parser_ext(argc, argv, &conf, ¶ms)) - exit(EXIT_FAILURE); + play_cmdline_parser_ext(argc, argv, &conf, ¶ms); HANDLE_VERSION_FLAG("play", conf); + loglevel = get_loglevel_by_name(conf.loglevel_arg); if (conf.help_given || conf.detailed_help_given) print_help_and_die(); - loglevel = get_loglevel_by_name(conf.loglevel_arg); if (conf.config_file_given) config_file = para_strdup(conf.config_file_arg); else { @@ -199,6 +195,7 @@ static void parse_config_or_die(int argc, char *argv[]) params.initialize = 0; params.check_required = 1; play_cmdline_parser_config_file(config_file, &conf, ¶ms); + loglevel = get_loglevel_by_name(conf.loglevel_arg); } for (i = 0; i < conf.key_map_given; i++) { char *s = strchr(conf.key_map_arg[i] + 1, ':'); @@ -1196,7 +1193,7 @@ static unsigned get_time_string(struct play_task *pt, char **result) ); } -static void play_post_select(struct sched *s, struct task *t) +static int play_post_select(struct sched *s, struct task *t) { struct play_task *pt = container_of(t, struct play_task, task); int ret; @@ -1204,7 +1201,7 @@ static void play_post_select(struct sched *s, struct task *t) ret = eof_cleanup(pt); if (ret < 0) { pt->rq = CRT_TERM_RQ; - return; + return 0; } ret = session_post_select(s, t); if (ret < 0) @@ -1234,7 +1231,7 @@ static void play_post_select(struct sched *s, struct task *t) } ret = 1; out: - t->error = ret; + return ret; } /** @@ -1255,7 +1252,7 @@ int main(int argc, char *argv[]) filter_init(); writer_init(); - gettimeofday(now, NULL); + clock_get_realtime(now); sched.default_timeout.tv_sec = 5; parse_config_or_die(argc, argv);