X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=recv.c;h=6f05c47fecf1cfb4ac20f8370e9d66b570984d0b;hp=52935a8840462af33589ed1378b481c593c405a1;hb=1e012cf40238883621692051a22fb9c7cad5e944;hpb=5b4b082e7c37b46d5fa1729dff6496da8840085f diff --git a/recv.c b/recv.c index 52935a88..6f05c47f 100644 --- a/recv.c +++ b/recv.c @@ -1,13 +1,15 @@ /* - * Copyright (C) 2005-2008 Andre Noll + * Copyright (C) 2005-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file recv.c the stand-alone audio stream receiver */ +#include #include #include +#include #include "para.h" #include "list.h" @@ -16,14 +18,17 @@ #include "recv.h" #include "recv.cmdline.h" #include "fd.h" +#include "string.h" #include "error.h" #include "stdout.h" +#include "buffer_tree.h" -/** the gengetopt args info struct */ -struct recv_args_info conf; +/** The gengetopt args info struct. */ +static struct recv_args_info conf; -/** always log to stderr */ -INIT_STDERR_LOGGING(conf.loglevel_arg); +static int loglevel; +/** Always log to stderr. */ +INIT_STDERR_LOGGING(loglevel); /** init array of error codes used by para_recv */ INIT_RECV_ERRLISTS; @@ -50,6 +55,7 @@ static void *parse_config(int argc, char *argv[], int *receiver_num) HANDLE_VERSION_FLAG("recv", conf); if (conf.help_given || conf.detailed_help_given) print_help_and_die(); + loglevel = get_loglevel_by_name(conf.loglevel_arg); return check_receiver_arg(conf.receiver_arg, receiver_num); } @@ -77,8 +83,7 @@ int main(int argc, char *argv[]) memset(&sot, 0, sizeof(struct stdout_task)); memset(&rn, 0, sizeof(struct receiver_node)); - FOR_EACH_RECEIVER(ret) - receivers[ret].init(&receivers[ret]); + recv_init(); ret = -E_RECV_SYNTAX; rn.conf = parse_config(argc, argv, &receiver_num); if (!rn.conf) { @@ -92,8 +97,11 @@ int main(int argc, char *argv[]) goto out; r_opened = 1; + if (conf.buffer_tree_given) + sot.btrn = btr_new_node("stdout", rn.btrn, NULL, NULL); + stdout_set_defaults(&sot); - sot.buf = rn.buf; + sot.bufp = &rn.buf; sot.loaded = &rn.loaded; sot.input_error = &rn.task.error; register_task(&sot.task);