X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=write_common.c;h=ff8999f63eb8b67312db89d07688c93b404d05d0;hp=7c0d952108cdec23a43c3c01cfe33b9b6f37b77b;hb=03683166610b241183b3cdb311069c96144fa53e;hpb=885700289d2c7ab64c3bc5a5ab8f6aba14e27632 diff --git a/write_common.c b/write_common.c index 7c0d9521..ff8999f6 100644 --- a/write_common.c +++ b/write_common.c @@ -303,3 +303,20 @@ void print_writer_helps(int detailed) ggo_print_help(&w->help, detailed); } } + +int prepare_writer_node(struct writer_node *wn) +{ + struct btr_node *btrn = wn->btrn; + size_t iqs; + + if (btr_eof(btrn)) + return -E_WRITE_COMMON_EOF; + iqs = btr_get_input_queue_size(btrn); + if (iqs < wn->min_iqs && !btr_no_parent(btrn)) + return 0; + assert(iqs != 0); + /* avoid "buffer too small" errors from the decoder */ + btr_merge(btrn, wn->min_iqs); + return 1; +} +