gui: Get rid of do_select()'s mode parameter and call it only once.
[paraslash.git] / aacdec_filter.c
index 95c13305519e39a86eff3cbe5cdf06b280ef8d04..d63236da5112d2ea9a9ac52d80c31abdc0ad78f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2014 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -11,7 +11,6 @@
 /** \file aacdec_filter.c paraslash's aac (m4a) decoder. */
 
 #include <regex.h>
-#include <stdbool.h>
 
 #include "para.h"
 #include "list.h"
@@ -81,7 +80,7 @@ static void aacdec_close(struct filter_node *fn)
        fn->private_data = NULL;
 }
 
-static void aacdec_post_select(__a_unused struct sched *s, struct task *t)
+static int aacdec_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct filter_node *fn = container_of(t, struct filter_node, task);
        struct btr_node *btrn = fn->btrn;
@@ -92,12 +91,11 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t)
        size_t len, skip, consumed, loaded;
 
 next_buffer:
-       t->error = 0;
        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, (char **)&inbuf);
        len = PARA_MIN(len, (size_t)8192);
@@ -124,7 +122,7 @@ next_buffer:
                        ret = -E_AACDEC_INIT;
                        if (NeAACDecInit2(padd->handle, p,
                                        padd->decoder_length, &rate,
-                                       &channels) < 0)
+                                       &channels) != 0)
                                goto out;
                }
                padd->sample_rate = rate;
@@ -204,8 +202,8 @@ out:
        }
 err:
        assert(ret < 0);
-       t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
+       return ret;
 }
 
 /**