build: Convert alsa detection to new macros.
[paraslash.git] / prebuffer_filter.c
index c849424..6078da0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2013 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -28,9 +28,9 @@ struct private_prebuffer_data {
        struct timeval barrier;
 };
 
-static void prebuffer_pre_select(struct sched *s, struct task *t)
+static void prebuffer_pre_select(struct sched *s, void *context)
 {
-       struct filter_node *fn = container_of(t, struct filter_node, task);
+       struct filter_node *fn = context;
        struct btr_node *btrn = fn->btrn;
        size_t iqs = btr_get_input_queue_size(btrn);
        struct private_prebuffer_data *ppd = fn->private_data;
@@ -56,9 +56,9 @@ static void prebuffer_close(struct filter_node *fn)
        free(fn->private_data);
 }
 
-static int prebuffer_post_select(__a_unused struct sched *s, struct task *t)
+static int prebuffer_post_select(__a_unused struct sched *s, void *context)
 {
-       struct filter_node *fn = container_of(t, struct filter_node, task);
+       struct filter_node *fn = context;
        struct btr_node *btrn = fn->btrn;
        size_t iqs = btr_get_input_queue_size(btrn);
        struct private_prebuffer_data *ppd = fn->private_data;
@@ -70,14 +70,14 @@ static int prebuffer_post_select(__a_unused struct sched *s, struct task *t)
                return 0;
        if (iqs < conf->size_arg)
                return 0;
-       btr_splice_out_node(fn->btrn);
+       btr_splice_out_node(&fn->btrn);
        return -E_PREBUFFER_SUCCESS;
 }
 
 static int prebuffer_parse_config(int argc, char **argv, void **config)
 {
        struct prebuffer_filter_args_info *conf = para_calloc(sizeof(*conf));
-       int ret = -E_PREBUFFER_SYNTAX;
+       int ret;
 
        prebuffer_filter_cmdline_parser(argc, argv, conf);
        ret = -ERRNO_TO_PARA_ERROR(EINVAL);
@@ -122,10 +122,6 @@ void prebuffer_filter_init(struct filter *f)
        f->parse_config = prebuffer_parse_config;
        f->free_config = prebuffer_free_config;
        f->pre_select = prebuffer_pre_select;
-       f->new_post_select = prebuffer_post_select;
-       f->post_select = NULL;
-       f->help = (struct ggo_help) {
-               .short_help = prebuffer_filter_args_info_help,
-               .detailed_help = prebuffer_filter_args_info_detailed_help
-       };
+       f->post_select = prebuffer_post_select;
+       f->help = (struct ggo_help)DEFINE_GGO_HELP(prebuffer_filter);
 }