fecdec_filter: Avoid potentially expensive pointer subtraction.
[paraslash.git] / audiod.c
index ce5bc551f8767349a41fe0974f52fa1975d2a1f8..d39f0f57620b80f8791bd7eeca015df2af566ea7 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -49,8 +49,8 @@ struct audio_format_info {
        void **filter_conf;
        /** the number of filters that should be activated for this audio format */
        unsigned int num_writers;
-       /** pointer to the array of writers to be activated */
-       struct writer **writers;
+       /** Array of writer numbers to be activated. */
+       int *writer_nums;
        /** pointer to the array of writer configurations */
        void **writer_conf;
        /** do not start receiver/filters/writer before this time */
@@ -385,8 +385,8 @@ static void open_filters(int slot_num)
        s->fc->inbufp = &s->receiver_node->buf;
        s->fc->in_loaded = &s->receiver_node->loaded;
        s->fc->input_error = &s->receiver_node->task.error;
-       s->fc->task.pre_select = filter_pre_select;
-       s->fc->task.post_select = NULL;
+       s->fc->task.pre_select = NULL;
+       s->fc->task.post_select = filter_post_select;
        s->fc->task.error = 0;
        s->fc->num_filters = nf;
 
@@ -434,7 +434,7 @@ static void open_writers(int slot_num)
        }
        for (i = 0; i < a->num_writers; i++) {
                s->wng->writer_nodes[i].conf = a->writer_conf[i];
-               s->wng->writer_nodes[i].writer = a->writers[i];
+               s->wng->writer_nodes[i].writer_num = a->writer_nums[i];
        }
        ret = wng_open(s->wng);
        if (ret < 0)
@@ -689,7 +689,7 @@ static int parse_writer_args(void)
        FOR_EACH_AUDIO_FORMAT(i) {
                a = &afi[i];
                a->writer_conf = para_malloc(nw * sizeof(void *));
-               a->writers = para_malloc(nw * sizeof(struct writer *));
+               a->writer_nums = para_malloc(nw * sizeof(int));
                a->num_writers = 0;
        }
        for (i = 0; i < conf.writer_given; i++) {
@@ -705,7 +705,7 @@ static int parse_writer_args(void)
                        ret = writer_num;
                        goto out;
                }
-               a->writers[nw] = &writers[writer_num];
+               a->writer_nums[nw] = writer_num;
                a->writer_conf[nw] = wconf;
                PARA_INFO_LOG("%s writer #%d: %s\n", audio_formats[ret],
                        nw, writer_names[writer_num]);