From 7c70a152ffdbeae114ed71c4e7d10528198642bc Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 3 Jan 2010 03:27:40 +0100 Subject: [PATCH] Simplify prepare_filter_node(). --- aacdec_filter.c | 2 +- filter.h | 2 +- filter_common.c | 7 ++++--- mp3dec_filter.c | 2 +- oggdec_filter.c | 2 +- wmadec_filter.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/aacdec_filter.c b/aacdec_filter.c index b9149ef2..80e49a0e 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -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) diff --git a/filter.h b/filter.h index 8ef0f27f..8b5e8bc9 100644 --- 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) { diff --git a/filter_common.c b/filter_common.c index 7ffc50a7..988c3576 100644 --- a/filter_common.c +++ b/filter_common.c @@ -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; } diff --git a/mp3dec_filter.c b/mp3dec_filter.c index c3f21f12..7fe8562d 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -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) diff --git a/oggdec_filter.c b/oggdec_filter.c index 274d0c2a..13472442 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -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) diff --git a/wmadec_filter.c b/wmadec_filter.c index 87de6b44..803ef59f 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -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) -- 2.39.5