stdout: Try to write as much as possible in one go.
[paraslash.git] / write.h
diff --git a/write.h b/write.h
index 365c237bf2b41e92e7ae14129d460d95396576ca..8e244517c12f0203db5049ab5c09f8d8b82d84a4 100644 (file)
--- a/write.h
+++ b/write.h
@@ -13,8 +13,8 @@ enum writer_enum {WRITER_ENUM};
  * Describes one running instance of a writer.
  */
 struct writer_node {
-       /** Points to the writer structure associated with this node. */
-       struct writer *writer; /* FIXME: Should better be only the number. */
+       /** The number of this writer. */
+       int writer_num;
        /** Writer-specific data. */
        void *private_data;
        /** Pointer to the group this node belongs to. */
@@ -23,6 +23,9 @@ struct writer_node {
        void *conf;
        /** How much of the wng's buffer is already written. */
        size_t written;
+       struct btr_node *btrn;
+       struct task task;
+       size_t min_iqs;
 };
 
 /** Describes one supported writer. */
@@ -43,6 +46,7 @@ struct writer {
         * more than once with different values of \a options.
         */
        void *(*parse_config)(const char *options);
+       void (*free_config)(void *conf);
        /**
         * Open one instance of this writer.
         *
@@ -60,6 +64,7 @@ struct writer {
         * on errors.
         */
        int (*pre_select)(struct sched *s, struct writer_node *wn);
+       void (*pre_select_btr)(struct sched *s, struct task *t);
        /**
         * Write audio data.
         *
@@ -70,6 +75,7 @@ struct writer {
         * negative on errors.
         */
        int (*post_select)(struct sched *s, struct writer_node *wn);
+       void (*post_select_btr)(struct sched *s, struct task *t);
        /**
         * Close one instance of the writer.
         *
@@ -83,6 +89,7 @@ struct writer {
         */
        void (*shutdown)(struct writer_node *);
        struct ggo_help help;
+       btr_command_handler execute;
 };
 
 /**
@@ -107,6 +114,8 @@ struct writer_node_group {
        struct task task;
        /** Whether the group is open, i.e. wng_open() was called. */
        int open;
+       /** Max number of bytes written in the previous post_select() call. */
+       int last_written;
 };
 
 /** Loop over each writer node in a writer group. */