X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mp3dec_filter.c;h=b053aaa8f3fd33171aca682fe53dd85906bcca11;hp=5f6935d1a5be70c7fa89dd0368bca48e34664422;hb=e79198e9851faddfd64e47654b5bc66fbc574255;hpb=9d8fdf8898418711558f70a9630b2444036d8285 diff --git a/mp3dec_filter.c b/mp3dec_filter.c index 5f6935d1..b053aaa8 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -8,12 +8,12 @@ #include #include +#include +#include "filter_cmd.lsg.h" #include "para.h" -#include "mp3dec_filter.cmdline.h" #include "list.h" #include "sched.h" -#include "ggo.h" #include "buffer_tree.h" #include "filter.h" #include "error.h" @@ -171,25 +171,15 @@ err: static void mp3dec_open(struct filter_node *fn) { struct private_mp3dec_data *pmd = para_calloc(sizeof(*pmd)); - struct mp3dec_filter_args_info *mp3_conf = fn->conf; fn->private_data = pmd; mad_stream_init(&pmd->stream); mad_frame_init(&pmd->frame); mad_synth_init(&pmd->synth); - if (mp3_conf->ignore_crc_given) + if (FILTER_CMD_OPT_GIVEN(MP3DEC, IGNORE_CRC, fn->lpr)) mad_stream_options(&pmd->stream, MAD_OPTION_IGNORECRC); } -static int mp3dec_parse_config(int argc, char **argv, void **config) -{ - struct mp3dec_filter_args_info *conf = para_calloc(sizeof(*conf)); - - mp3dec_filter_cmdline_parser(argc, argv, conf); - *config = conf; - return 1; -} - static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result) { struct filter_node *fn = btr_context(btrn); @@ -198,28 +188,10 @@ static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result) return decoder_execute(cmd, pmd->sample_rate, pmd->channels, result); } -static void mp3dec_free_config(void *conf) -{ - mp3dec_filter_cmdline_parser_free(conf); -} -/** - * The init function of the mp3dec filter. - * - * \param f Pointer to the filter struct to initialize. - * - * \sa filter::init. - */ -void mp3dec_filter_init(struct filter *f) -{ - struct mp3dec_filter_args_info dummy; - - mp3dec_filter_cmdline_parser_init(&dummy); - f->open = mp3dec_open; - f->close = mp3dec_close; - f->parse_config = mp3dec_parse_config; - f->free_config = mp3dec_free_config; - f->pre_select = generic_filter_pre_select; - f->post_select = mp3dec_post_select; - f->execute = mp3dec_execute; - f->help = (struct ggo_help)DEFINE_GGO_HELP(mp3dec_filter); -} +const struct filter lsg_filter_cmd_com_mp3dec_user_data = { + .open = mp3dec_open, + .close = mp3dec_close, + .pre_select = generic_filter_pre_select, + .post_select = mp3dec_post_select, + .execute = mp3dec_execute, +};