X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=write.c;h=f79daf237e286dfc6821d06ad93dfdaa49bab84a;hp=c3848946c8b124e1a0ba0f0672fbbf475d6de2a4;hb=aa234b7afe223879a7bd7274ce05a3a315a2ec49;hpb=885700289d2c7ab64c3bc5a5ab8f6aba14e27632 diff --git a/write.c b/write.c index c3848946..f79daf23 100644 --- a/write.c +++ b/write.c @@ -176,28 +176,25 @@ static void check_wav_post_select_btr(__a_unused struct sched *s, struct task *t PARA_NOTICE_LOG("wav header not found\n"); cwt->state = CWS_NO_HEADER; sprintf(t->status, "check wav: no header"); - goto consume; + goto out; } PARA_INFO_LOG("found wav header\n"); cwt->state = CWS_HAVE_HEADER; sprintf(t->status, "check wav: have header"); cwt->channels = (unsigned) a[22]; cwt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24); -consume: PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->samplerate); btr_consume(cwt->btrn, WAV_HEADER_LEN); out: - if (sz) { + if (sz) btr_pushdown(cwt->btrn); - s->timeout.tv_sec = 0; - s->timeout.tv_usec = 1; - } else { + else { if (btr_no_parent(cwt->btrn)) t->error = -E_WRITE_EOF; } err: if (t->error < 0) - btr_del_node(cwt->btrn); + btr_remove_node(cwt->btrn); } static void initial_delay_pre_select(struct sched *s, struct task *t) @@ -308,6 +305,7 @@ static int main_btr(struct sched *s) wns[0] = setup_writer_node(NULL, cwt->btrn); if (!wns[0]) goto out; + i = 1; } else { wns = para_malloc(conf.writer_given * sizeof(*wns)); for (i = 0; i < conf.writer_given; i++) { @@ -326,8 +324,10 @@ out: for (i--; i >= 0; i--) { struct writer_node *wn = wns[i]; struct writer *w = writers + wn->writer_num; + w->close(wn); - free(wn->conf); /* FIXME should call gengetopt cleanup funtion */ + btr_free_node(wn->btrn); + free(wn->conf); free(wn); } free(wns);