]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - write.c
Introduce btr_node_status() and add btr support to the file writer.
[paraslash.git] / write.c
diff --git a/write.c b/write.c
index c3848946c8b124e1a0ba0f0672fbbf475d6de2a4..9577f0406b8cf1f0968300591a75e44bec6be75f 100644 (file)
--- a/write.c
+++ b/write.c
@@ -176,22 +176,19 @@ 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;
        }
@@ -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_del_node(wn->btrn);
+               free(wn->conf);
                free(wn);
        }
        free(wns);