X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mp3dec_filter.c;h=5f6935d1a5be70c7fa89dd0368bca48e34664422;hp=6955a7423650f3b929b807b6184221d5b5773717;hb=ce9e297eb91a932a11f81890c800d0380b5bc9c9;hpb=c4bfb18b78b3935b8dbf68f70b219cfb2a192979 diff --git a/mp3dec_filter.c b/mp3dec_filter.c index 6955a742..5f6935d1 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2012 Andre Noll + * Copyright (C) 2005 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -77,9 +77,9 @@ static void mp3dec_close(struct filter_node *fn) #define MP3DEC_MAX_FRAME 8192 -static void mp3dec_post_select(__a_unused struct sched *s, struct task *t) +static int mp3dec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = container_of(t, struct filter_node, task); + struct filter_node *fn = context; int i, ret; struct private_mp3dec_data *pmd = fn->private_data; struct btr_node *btrn = fn->btrn; @@ -88,13 +88,12 @@ static void mp3dec_post_select(__a_unused struct sched *s, struct task *t) next_buffer: pmd->stream.error = 0; - t->error = 0; iqs = btr_get_input_queue_size(btrn); ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); if (ret < 0) goto err; if (ret == 0) - return; + return 0; btr_merge(btrn, fn->min_iqs); len = btr_next_buffer(btrn, &inbuffer); /* @@ -120,7 +119,7 @@ next_frame: } if (loaded == 0) goto next_buffer; - return; + return 0; } pmd->sample_rate = pmd->frame.header.samplerate; pmd->channels = MAD_NCHANNELS(&pmd->frame.header); @@ -140,12 +139,12 @@ decode: if (fn->min_iqs > MP3DEC_MAX_FRAME) goto err; mp3dec_consume(btrn, &pmd->stream, len); - return; + return 0; } if (pmd->stream.error != MAD_ERROR_BADDATAPTR) goto decode; mp3dec_consume(btrn, &pmd->stream, len); - return; + return 0; } fn->min_iqs = 0; mad_synth_frame(&pmd->synth, &pmd->frame); @@ -165,8 +164,8 @@ decode: goto next_frame; err: assert(ret < 0); - t->error = ret; - btr_remove_node(btrn); + btr_remove_node(&fn->btrn); + return ret; } static void mp3dec_open(struct filter_node *fn) @@ -184,18 +183,11 @@ static void mp3dec_open(struct filter_node *fn) static int mp3dec_parse_config(int argc, char **argv, void **config) { - int ret; - struct mp3dec_filter_args_info *mp3_conf; + struct mp3dec_filter_args_info *conf = para_calloc(sizeof(*conf)); - mp3_conf = para_calloc(sizeof(*mp3_conf)); - ret = -E_MP3DEC_SYNTAX; - if (mp3dec_cmdline_parser(argc, argv, mp3_conf)) - goto err; - *config = mp3_conf; + mp3dec_filter_cmdline_parser(argc, argv, conf); + *config = conf; return 1; -err: - free(mp3_conf); - return ret; } static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result) @@ -208,7 +200,7 @@ static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result) static void mp3dec_free_config(void *conf) { - mp3dec_cmdline_parser_free(conf); + mp3dec_filter_cmdline_parser_free(conf); } /** * The init function of the mp3dec filter. @@ -221,7 +213,7 @@ void mp3dec_filter_init(struct filter *f) { struct mp3dec_filter_args_info dummy; - mp3dec_cmdline_parser_init(&dummy); + mp3dec_filter_cmdline_parser_init(&dummy); f->open = mp3dec_open; f->close = mp3dec_close; f->parse_config = mp3dec_parse_config; @@ -229,8 +221,5 @@ void mp3dec_filter_init(struct filter *f) f->pre_select = generic_filter_pre_select; f->post_select = mp3dec_post_select; f->execute = mp3dec_execute; - f->help = (struct ggo_help) { - .short_help = mp3dec_filter_args_info_help, - .detailed_help = mp3dec_filter_args_info_detailed_help - }; + f->help = (struct ggo_help)DEFINE_GGO_HELP(mp3dec_filter); }