X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=56014cad0e832931613abc6ac879dcde5c67c9b7;hp=d635fbfc334316b9dd78ab2b67e266dd757c828c;hb=a95093cd8b62d411b9448aa77768774e1bdd81e5;hpb=b23afbb1d859a79a2682a80420a7f3c693b210e6 diff --git a/audiod.c b/audiod.c index d635fbfc..56014cad 100644 --- a/audiod.c +++ b/audiod.c @@ -680,7 +680,10 @@ static void open_writers(int slot_num) s->wng->buf = s->fc->outbuf; s->wng->loaded = s->fc->out_loaded; s->wng->input_eof = &s->fc->eof; + s->wng->channels = &s->fc->channels; + s->wng->samplerate = &s->fc->samplerate; s->fc->output_eof = &s->wng->eof; + PARA_INFO_LOG("samplerate: %d\n", *s->wng->samplerate); } else { s->wng->buf = s->receiver_node->buf; s->wng->loaded = &s->receiver_node->loaded; @@ -692,7 +695,7 @@ static void open_writers(int slot_num) s->wng->writer_nodes[i].writer = a->writers[i]; sprintf(s->wng->writer_nodes[i].task.status, "writer_node"); } - ret = wng_open(s->wng); + ret = wng_open(s->wng); /* FIXME */ s->wstime = *now; current_decoder = slot_num; activate_inactive_grab_clients(slot_num, s->format, &s->fc->filters); @@ -892,22 +895,33 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t) { int i; + t->ret = 1; now = &s->now; if (audiod_status != AUDIOD_ON) kill_all_decoders(); else if (playing) open_current_receiver(); FOR_EACH_SLOT(i) { - struct receiver_node *rn; + struct slot_info *s = &slot[i]; + struct audio_format_info *a; try_to_close_slot(i); - if (slot[i].format < 0) + if (s->format < 0) + continue; + a = &afi[s->format]; + if (!s->receiver_node) continue; - rn = slot[i].receiver_node; - if (rn && rn->loaded && !slot[i].wng) { + if (!a->num_filters) { + if (s->receiver_node->loaded && !s->wng) + open_writers(i); + continue; + } + if (s->receiver_node->loaded && !s->fc) { open_filters(i); - open_writers(i); + continue; } + if (s->fc && *s->fc->out_loaded && !s->wng) + open_writers(i); } } @@ -915,6 +929,7 @@ static void audiod_post_select(struct sched *s, __a_unused struct task *t) { /* only save away the current time for other users */ now = &s->now; + t->ret = 1; } static void init_audiod_task(struct task *t) @@ -1483,6 +1498,7 @@ void signal_setup_default(struct signal_task *st) static void command_pre_select(struct sched *s, struct task *t) { struct command_task *ct = t->private_data; + t->ret = 1; para_fd_set(ct->fd, &s->rfds, &s->max_fileno); } @@ -1492,9 +1508,9 @@ static void command_post_select(struct sched *s, struct task *t) int ret; struct command_task *ct = t->private_data; + t->ret = 1; /* always successful */ if (audiod_status != AUDIOD_OFF) audiod_status_dump(); - t->ret = 1; /* always successful */ if (!FD_ISSET(ct->fd, &s->rfds)) return; ret = handle_connect(ct->fd);