X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=amp_filter.c;h=2f05260157de9e7103d1a717812981773489fd59;hb=e9805263600a69a88e60edd1c8b4ba9e01a79322;hp=750205ba69ea5ae747aa37290d57503005b0d49f;hpb=73b0bc66ce2f7b332e855434a393bf28da2ee0f0;p=paraslash.git diff --git a/amp_filter.c b/amp_filter.c index 750205ba..2f052601 100644 --- a/amp_filter.c +++ b/amp_filter.c @@ -50,20 +50,23 @@ static void amp_close(struct filter_node *fn) free(fn->buf); } -static void *amp_parse_config(int argc, char **argv) +static int amp_parse_config(int argc, char **argv, void **config) { - struct amp_filter_args_info *conf = para_calloc(sizeof(*conf)); + struct amp_filter_args_info *amp_conf = para_calloc(sizeof(*amp_conf)); + int ret = -E_AMP_SYNTAX; - if (amp_cmdline_parser(argc, argv, conf)) + if (amp_cmdline_parser(argc, argv, amp_conf)) goto err; - if (conf->amp_arg < 0) + ret = -ERRNO_TO_PARA_ERROR(EINVAL); + if (amp_conf->amp_arg < 0) goto err; - PARA_NOTICE_LOG("amplification: %u (scaling factor: %1.2f)\n", conf->amp_arg, - conf->amp_arg / 64.0 + 1.0); - return conf; + PARA_NOTICE_LOG("amplification: %u (scaling factor: %1.2f)\n", + amp_conf->amp_arg, amp_conf->amp_arg / 64.0 + 1.0); + *config = amp_conf; + return 1; err: - free(conf); - return NULL; + free(amp_conf); + return ret; } static void amp_open(struct filter_node *fn) @@ -87,7 +90,7 @@ static void amp_open(struct filter_node *fn) * * \param f Pointer to the struct to initialize. */ -void amp_init(struct filter *f) +void amp_filter_init(struct filter *f) { f->open = amp_open; f->close = amp_close;