X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=ca8cd13b01358e13fe06ecc1c751a98800402b7b;hp=5f4acb4364abe09ecc77923d37e378bbd6b57791;hb=aa7b5a65bed03d62285102cefd11d67804d492cf;hpb=4adde8dae3317fa83b81e7a860c9ed9133e99bb0 diff --git a/audiod.c b/audiod.c index 5f4acb43..ca8cd13b 100644 --- a/audiod.c +++ b/audiod.c @@ -37,7 +37,6 @@ #include "string.h" #include "fd.h" #include "write.h" -#include "write_common.h" #include "signal.h" #include "version.h" @@ -64,10 +63,10 @@ struct audio_format_info { struct lls_parse_result **filter_lpr; /** the number of filters that should be activated for this audio format */ unsigned int num_writers; - /** Array of writer numbers to be activated. */ - int *writer_nums; - /** pointer to the array of writer configurations */ - void **writer_conf; + /** Array of writer IDs to be activated. */ + int *wids; + /** Parsed writer command line(s) */ + struct lls_parse_result **writer_lpr; /** do not start receiver/filters/writer before this time */ struct timeval restart_barrier; }; @@ -493,13 +492,10 @@ static void close_receiver(int slot_num) static void writer_cleanup(struct writer_node *wn) { - struct writer *w; - if (!wn) return; - w = writers + wn->writer_num; - PARA_INFO_LOG("closing %s\n", writer_names[wn->writer_num]); - w->close(wn); + PARA_INFO_LOG("closing %s\n", writer_name(wn->wid)); + writer_get(wn->wid)->close(wn); btr_remove_node(&wn->btrn); task_reap(&wn->task); } @@ -632,11 +628,11 @@ static void open_writers(struct slot_info *s) * sizeof(struct writer_node)); for (i = 0; i < a->num_writers; i++) { wn = s->wns + i; - wn->conf = a->writer_conf[i]; - wn->writer_num = a->writer_nums[i]; + wn->wid = a->wids[i]; + wn->lpr = a->writer_lpr[i]; register_writer_node(wn, parent, &sched); PARA_NOTICE_LOG("%s writer started in slot %d\n", - writer_names[a->writer_nums[i]], (int)(s - slot)); + writer_name(a->wids[i]), (int)(s - slot)); } } @@ -883,8 +879,7 @@ static int parse_writer_args(void) struct audio_format_info *a; for (i = 0; i < conf.writer_given; i++) { - void *wconf; - int j, nw, writer_num, af_mask; + int j, nw, af_mask; ret = parse_stream_command(conf.writer_arg[i], &cmd); if (ret < 0) @@ -894,32 +889,28 @@ static int parse_writer_args(void) a = afi + j; if ((af_mask & (1 << j)) == 0) /* no match */ continue; - wconf = check_writer_arg_or_die(cmd, &writer_num); nw = a->num_writers; - a->writer_nums = para_realloc(a->writer_nums, (nw + 1) * sizeof(int)); - a->writer_conf = para_realloc(a->writer_conf, (nw + 1) * sizeof(void *)); - a->writer_nums[nw] = writer_num; - a->writer_conf[nw] = wconf; + a->wids = para_realloc(a->wids, (nw + 1) * sizeof(int)); + a->writer_lpr = para_realloc(a->writer_lpr, + (nw + 1) * sizeof(struct lls_parse_result *)); + a->wids[nw] = check_writer_arg_or_die(cmd, + a->writer_lpr + nw); PARA_INFO_LOG("%s writer #%d: %s\n", audio_formats[j], - nw, writer_names[writer_num]); + nw, writer_name(a->wids[nw])); a->num_writers++; } } /* Use default writer for audio formats which are not yet set up. */ FOR_EACH_AUDIO_FORMAT(i) { - void *writer_conf; - int writer_num; a = afi + i; if (a->num_writers > 0) continue; /* already set up */ - writer_conf = check_writer_arg_or_die(NULL, &writer_num); - a->writer_nums = para_malloc(sizeof(int)); - a->writer_nums[0] = writer_num; - a->writer_conf = para_malloc(sizeof(void *)); - a->writer_conf[0] = writer_conf; a->num_writers = 1; + a->wids = para_malloc(sizeof(int)); + a->writer_lpr = para_malloc(sizeof(struct lls_parse_result *)); + a->wids[0] = check_writer_arg_or_die(NULL, a->writer_lpr); PARA_INFO_LOG("%s writer: %s (default)\n", audio_formats[i], - writer_names[writer_num]); + writer_name(a->wids[0])); } return 1; } @@ -1504,7 +1495,6 @@ int main(int argc, char *argv[]) version_handle_flag("audiod", conf.version_given); /* init receivers/filters/writers early to make help work */ recv_init(); - writer_init(); if (conf.help_given || conf.detailed_help_given) print_help_and_die(); daemon_set_priority(conf.priority_arg);