]> git.tue.mpg.de Git - paraslash.git/commitdiff
Introduce prepare_writer_node().
authorAndre Noll <maan@systemlinux.org>
Mon, 4 Jan 2010 22:02:42 +0000 (23:02 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 4 Jan 2010 22:02:42 +0000 (23:02 +0100)
Unused yet.

error.h
write.h
write_common.c
write_common.h

diff --git a/error.h b/error.h
index 1a2b3a4cecb350dbbdcae52c3c5029a7f2458ee8..08d6bd6e13da2ba04c9b2caa1f99f413887837ef 100644 (file)
--- a/error.h
+++ b/error.h
@@ -423,6 +423,7 @@ extern const char **para_errlist[];
 
 #define WRITE_COMMON_ERRORS \
        PARA_ERROR(WRITE_COMMON_SYNTAX, "syntax error in write option"), \
+       PARA_ERROR(WRITE_COMMON_EOF, "write: end of file"), \
 
 
 #define AACDEC_FILTER_ERRORS \
diff --git a/write.h b/write.h
index a88b3537d9545972234613f6f4eccf01b576350c..49e56c38d479f0ef693d9dc91c4894c97867ce7a 100644 (file)
--- a/write.h
+++ b/write.h
@@ -25,6 +25,7 @@ struct writer_node {
        size_t written;
        struct btr_node *btrn;
        struct task task;
+       size_t min_iqs;
 };
 
 /** Describes one supported writer. */
index 7c0d952108cdec23a43c3c01cfe33b9b6f37b77b..ff8999f63eb8b67312db89d07688c93b404d05d0 100644 (file)
@@ -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;
+}
+
index f34ad3fe7f9da8834e99645b9f15d35b21a00f21..34e21cee15ee1a06aaf490f2e80985fa456ca523 100644 (file)
@@ -14,3 +14,4 @@ void *check_writer_arg(const char *wa, int *writer_num);
 struct writer_node_group *setup_default_wng(void);
 void print_writer_helps(int detailed);
 struct writer_node *setup_writer_node(const char *arg, struct btr_node *parent);
+int prepare_writer_node(struct writer_node *wn);