Simplify prepare_filter_node().
authorAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 02:27:40 +0000 (03:27 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 02:27:40 +0000 (03:27 +0100)
aacdec_filter.c
filter.h
filter_common.c
mp3dec_filter.c
oggdec_filter.c
wmadec_filter.c

index b9149ef..80e49a0 100644 (file)
@@ -236,7 +236,7 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t)
 
 next_buffer:
        t->error = 0;
-       ret = prepare_filter_node(btrn, fn->min_iqs);
+       ret = prepare_filter_node(fn);
        if (ret < 0)
                goto err;
        if (ret == 0)
index 8ef0f27..8b5e8bc 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -205,7 +205,7 @@ void filter_init(void);
 int check_filter_arg(char *filter_arg, void **conf);
 void filter_post_select(__a_unused struct sched *s, struct task *t);
 void print_filter_helps(int detailed);
-int prepare_filter_node(struct btr_node *btrn, size_t min_len);
+int prepare_filter_node(struct filter_node *fn);
 
 static inline void write_int16_host_endian(char *buf, int val)
 {
index 7ffc50a..988c357 100644 (file)
@@ -279,8 +279,9 @@ void print_filter_helps(int detailed)
 /** 640K ought to be enough for everybody ;) */
 #define FILTER_MAX_PENDING (640 * 1024)
 
-int prepare_filter_node(struct btr_node *btrn, size_t min_len)
+int prepare_filter_node(struct filter_node *fn)
 {
+       struct btr_node *btrn = fn->btrn;
        size_t iqs;
 
        if (btr_eof(btrn))
@@ -288,10 +289,10 @@ int prepare_filter_node(struct btr_node *btrn, size_t min_len)
        if (btr_bytes_pending(btrn) > FILTER_MAX_PENDING)
                return 0;
        iqs = btr_get_input_queue_size(btrn);
-       if (iqs < min_len && !btr_no_parent(btrn))
+       if (iqs < fn->min_iqs && !btr_no_parent(btrn))
                return 0;
        assert(iqs != 0);
        /* avoid "buffer too small" errors from the decoder */
-       btr_merge(btrn, min_len);
+       btr_merge(btrn, fn->min_iqs);
        return 1;
 }
index c3f21f1..7fe8562 100644 (file)
@@ -215,7 +215,7 @@ next_buffer:
        iqs = btr_get_input_queue_size(btrn);
        if (need_bad_data_delay(pmd, iqs))
                return;
-       ret = prepare_filter_node(btrn, fn->min_iqs);
+       ret = prepare_filter_node(fn);
        if (ret < 0)
                goto err;
        if (ret == 0)
index 274d0c2..1347244 100644 (file)
@@ -207,7 +207,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
        char *in;
 
        t->error = 0;
-       ret = prepare_filter_node(btrn, fn->min_iqs);
+       ret = prepare_filter_node(fn);
        if (ret < 0)
                goto err;
        if (ret == 0)
index 87de6b4..803ef59 100644 (file)
@@ -1254,7 +1254,7 @@ static void wmadec_post_select(__a_unused struct sched *s, struct task *t)
 
 next_buffer:
        t->error = 0;
-       ret = prepare_filter_node(btrn, fn->min_iqs);
+       ret = prepare_filter_node(fn);
        if (ret < 0)
                goto err;
        if (ret == 0)