X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=amp_filter.c;h=22784955513ead8b5ba21db76af799e5fadbf66a;hp=392fff6547c12cb7aa6c1abd62260526171be23b;hb=b779fcfc62bca2e728348c70bab3c50df3fe63b8;hpb=2b8ac364a9ad11f67bfc1cdd01c113bde30baaf7 diff --git a/amp_filter.c b/amp_filter.c index 392fff65..22784955 100644 --- a/amp_filter.c +++ b/amp_filter.c @@ -4,7 +4,7 @@ * Licensed under the GPL v2. For licencing details see COPYING. */ -/** \file amp.c Paraslash's amplify filter. */ +/** \file amp_filter.c Paraslash's amplify filter. */ #include "para.h" #include "amp_filter.cmdline.h" @@ -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)