]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - write_common.c
audio: fix handling of sample_rate and channels count.
[paraslash.git] / write_common.c
index 7fb8d12337b6fdc28a1af741e5a0cd6a74f21ea4..39f124f832dddb169ace064443629bead6be0f7e 100644 (file)
@@ -45,9 +45,10 @@ static void wng_post_select(__a_unused struct sched *s, struct task *t)
                        min_written = PARA_MIN(min_written, t->ret);
        }
        *g->loaded -= min_written;
-       if (!*g->loaded && *g->input_eof)
+       if (!*g->loaded && *g->input_eof) {
+               g->eof = 1;
                t->ret = -E_WNG_EOF;
-       else
+       else
                t->ret = 1;
        if (*g->loaded && min_written)
                memmove(g->buf, g->buf + min_written, *g->loaded);
@@ -57,14 +58,15 @@ int wng_open(struct writer_node_group *g)
 {
        int i, ret = 1;
 
+       PARA_NOTICE_LOG("opening wng %p with %d writer(s)\n", g, g->num_writers);
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
+               wn->wng = g;
                ret = wn->writer->open(wn);
                if (ret < 0)
                        goto out;
                wn->chunk_bytes = ret;
                g->max_chunk_bytes = PARA_MAX(g->max_chunk_bytes, ret);
-               wn->wng = g;
                PARA_DEBUG_LOG("pre_select: %p\n", &wn->writer->pre_select);
                PARA_DEBUG_LOG("post_select: %p\n", &wn->writer->post_select);
                wn->task.pre_select = wn->writer->pre_select;
@@ -92,6 +94,9 @@ void wng_close(struct writer_node_group *g)
 {
        int i;
 
+       if (!g)
+               return;
+       PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
                unregister_task(&wn->task);