string: Clean up for_each_line() and related functions.
[paraslash.git] / mp3dec_filter.c
index 5c4b16119d969d984b3eadba5a8654e1ea2ea690..bd1f0d35dbc0fe54a75c25e59beae3bc07cd5f3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -8,7 +8,6 @@
 
 #include <mad.h>
 #include <regex.h>
-#include <stdbool.h>
 
 #include "para.h"
 #include "mp3dec_filter.cmdline.h"
@@ -131,7 +130,7 @@ decode:
                ret = handle_decode_error(pmd);
                if (ret < 0)
                        goto err;
-               ret = mad_stream_sync(&pmd->stream);
+               mad_stream_sync(&pmd->stream);
                if (pmd->stream.error == MAD_ERROR_BUFLEN) {
                        ret = -E_MP3DEC_EOF;
                        if (len == iqs && btr_no_parent(btrn))
@@ -167,7 +166,7 @@ decode:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 static void mp3dec_open(struct filter_node *fn)
@@ -185,18 +184,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)
@@ -209,7 +201,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.
@@ -222,7 +214,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;