X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=resample_filter.c;h=1699ed2c03afcc84cc7b8b3e2e8a7f91aca13cc5;hp=ed9945aecf30492b296d004d732cc23b5cc4ba86;hb=fc8dfbb416ff07cca08fbf4e13efcaa25e17cc54;hpb=c5e38315901ea63efd169af5d4ba3f3c66db7de9 diff --git a/resample_filter.c b/resample_filter.c index ed9945ae..1699ed2c 100644 --- a/resample_filter.c +++ b/resample_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 Andre Noll + * Copyright (C) 2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -65,9 +65,9 @@ static void resample_open(struct filter_node *fn) btr_log_tree(btr_parent(btr_parent(btrn)), LL_INFO); } -static void resample_pre_select(struct sched *s, struct task *t) +static void resample_pre_select(struct sched *s, void *context) { - struct filter_node *fn = container_of(t, struct filter_node, task); + struct filter_node *fn = context; struct resample_context *ctx = fn->private_data; int ret = btr_node_status(fn->btrn, fn->min_iqs, BTR_NT_INTERNAL); @@ -128,13 +128,7 @@ static int resample_init(struct filter_node *fn) int ret, converter; struct resample_context *ctx = fn->private_data; struct resample_filter_args_info *conf = fn->conf; - struct btr_node *btrn = fn->btrn; - ret = -E_RESAMPLE_EOF; - if (btr_no_parent(btrn)) - return ret; - if (btr_get_input_queue_size(btrn) == 0) - return 0; ret = resample_set_params(fn); if (ret < 0) return ret; @@ -202,10 +196,10 @@ static int resample_frames(int16_t *in, size_t num_frames, bool have_more, return data.input_frames_used; } -static void resample_post_select(__a_unused struct sched *s, struct task *t) +static int resample_post_select(__a_unused struct sched *s, void *context) { int ret; - struct filter_node *fn = container_of(t, struct filter_node, task); + struct filter_node *fn = context; struct resample_context *ctx = fn->private_data; struct resample_filter_args_info *conf = fn->conf; struct btr_node *btrn = fn->btrn; @@ -216,14 +210,14 @@ static void resample_post_select(__a_unused struct sched *s, struct task *t) ret = check_wav_post_select(ctx->cwc); if (ret < 0) goto out; + ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); + if (ret <= 0) + goto out; if (!ctx->src_state) { ret = resample_init(fn); if (ret <= 0) goto out; } - ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); - if (ret <= 0) - goto out; if (ctx->source_sample_rate == conf->dest_sample_rate_arg) { /* * No resampling necessary. We do not splice ourselves out @@ -231,7 +225,8 @@ static void resample_post_select(__a_unused struct sched *s, struct task *t) * btr exec mechanism for the destination samplerate and the * channel count. */ - return btr_pushdown(btrn); + btr_pushdown(btrn); + return 0; } btr_merge(btrn, fn->min_iqs); in_bytes = btr_next_buffer(btrn, (char **)&in); @@ -246,14 +241,14 @@ static void resample_post_select(__a_unused struct sched *s, struct task *t) goto out; btr_consume(btrn, ret * 2 * ctx->channels); btr_add_output((char *)out, num_frames * 2 * ctx->channels, btrn); - return; + return 0; out: if (ret < 0) { - t->error = ret; btr_remove_node(&fn->btrn); /* This releases the check_wav btr node */ check_wav_post_select(ctx->cwc); } + return ret; } static int resample_parse_config(int argc, char **argv, void **config) @@ -309,8 +304,5 @@ void resample_filter_init(struct filter *f) f->parse_config = resample_parse_config; f->free_config = resample_free_config; f->execute = resample_execute; - f->help = (struct ggo_help) { - .short_help = resample_filter_args_info_help, - .detailed_help = resample_filter_args_info_detailed_help - }; + f->help = (struct ggo_help)DEFINE_GGO_HELP(resample_filter); }