struct writer: kill unused write_pointer and update documentation
authorAndre <maan@ensslin.(none)>
Tue, 6 Jun 2006 00:23:10 +0000 (02:23 +0200)
committerAndre <maan@ensslin.(none)>
Tue, 6 Jun 2006 00:23:10 +0000 (02:23 +0200)
The file writer even had an implementation of the unused write function.

file_writer.c
write.h

index 1ea9503297eb8c8755b56293bfc5aa8b5ade1994..e90647d230cf7f3f797f648892fa0530198941ab 100644 (file)
@@ -59,15 +59,6 @@ static int file_writer_open(struct writer_node *wn)
        return -E_FW_OPEN;
 }
 
        return -E_FW_OPEN;
 }
 
-static int file_writer_write(char *data, size_t nbytes, struct writer_node *wn)
-{
-       struct private_file_writer_data *pfwd = wn->private_data;
-       int ret = write(pfwd->fd, data, nbytes);
-       if (ret < 0)
-               ret = -E_FW_WRITE;
-       return ret;
-}
-
 static int file_writer_pre_select(struct sched *s, struct writer_node *wn)
 {
        struct private_file_writer_data *pfwd = wn->private_data;
 static int file_writer_pre_select(struct sched *s, struct writer_node *wn)
 {
        struct private_file_writer_data *pfwd = wn->private_data;
@@ -128,7 +119,6 @@ __malloc void *file_writer_parse_config(char *options)
 void file_writer_init(struct writer *w)
 {
        w->open = file_writer_open;
 void file_writer_init(struct writer *w)
 {
        w->open = file_writer_open;
-       w->write = file_writer_write;
        w->pre_select = file_writer_pre_select;
        w->post_select = file_writer_post_select;
        w->parse_config = file_writer_parse_config;
        w->pre_select = file_writer_pre_select;
        w->post_select = file_writer_post_select;
        w->parse_config = file_writer_parse_config;
diff --git a/write.h b/write.h
index 79531b508839ea06947873cab38e770be0daba0f..63efbfed4d381a94783bf7749a4547ba7151099e 100644 (file)
--- a/write.h
+++ b/write.h
@@ -74,13 +74,19 @@ struct writer {
         *
         * write a chunk of audio data
         *
         *
         * write a chunk of audio data
         *
-        * This is called from the driving application whenever a data block of \a
-        * chunk_bytes is available. It must return the number of bytes consumed from
-        * \a data on success, and negative on errors.
-        *
+        * This is called from the writer node group task's pre_select(). It
+        * may use the sched pointer to add any file descriptors or to decrease
+        * the select timeout. It must return positive on success and negative
+        * on errors.
         */
         */
-       int (*write)(char *data, size_t nbytes, struct writer_node *);
        int (*pre_select)(struct sched *s, struct writer_node *wn);
        int (*pre_select)(struct sched *s, struct writer_node *wn);
+       /*
+        * Called from the post_select function of the wng task. It must keep
+        * track of the the number of bytes consumed from the wng's buffer via
+        * the wn->written variable (which may be modified by the wng handling
+        * functions). This function must return positive on success and
+        * negative on errors.
+        */
        int (*post_select)(struct sched *s, struct writer_node *wn);
        /**
         * close one instance of the writer
        int (*post_select)(struct sched *s, struct writer_node *wn);
        /**
         * close one instance of the writer
@@ -107,13 +113,19 @@ struct writer_node_group {
        struct writer_node *writer_nodes;
        /** the maximum of the chunk_bytes values of the writer nodes in this group */
        size_t max_chunk_bytes;
        struct writer_node *writer_nodes;
        /** the maximum of the chunk_bytes values of the writer nodes in this group */
        size_t max_chunk_bytes;
-       /** non-zero if end of file was encountered */
+       /** non-zero if end of file was encountered by the feeding task */
        int *input_eof;
        int *input_eof;
+       /** non-zero if end of file was encountered */
        int eof;
        int eof;
+       /** current output buffer */
        char *buf;
        char *buf;
+       /** number of bytes loaded in the output buffer */
+       size_t *loaded;
+       /** number of audio channels of the current stream */
        unsigned int *channels;
        unsigned int *channels;
+       /** sample rate of the current stream */
        unsigned int *samplerate;
        unsigned int *samplerate;
-       size_t *loaded;
+       /** the task associated to this group */
        struct task task;
 };
 
        struct task task;
 };