]> git.tue.mpg.de Git - paraslash.git/commitdiff
Grab cleanups and fixes.
authorAndre Noll <maan@systemlinux.org>
Wed, 2 Apr 2008 21:08:09 +0000 (23:08 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 2 Apr 2008 21:08:09 +0000 (23:08 +0200)
Change semantics of the filter number to zero-based.

audiod.c
audiod_command.c
grab_client.c
grab_client.ggo

index 295c37553be11c9b72f2e9052f8fd77ab08e2296..3c737226c8bf57b94be0716ae019e2961d488c99 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -294,7 +294,7 @@ static void open_filters(int slot_num)
                INIT_LIST_HEAD(&fn->callbacks);
                f->open(fn);
                PARA_NOTICE_LOG("%s filter %d/%d (%s) started in slot %d\n",
-                       audio_formats[s->format], i + 1,  nf, f->name, slot_num);
+                       audio_formats[s->format], i,  nf, f->name, slot_num);
                s->fc->outbuf = fn->buf;
                s->fc->out_loaded = &fn->loaded;
        }
@@ -539,7 +539,7 @@ static int add_filter(int format, char *cmdline)
                return filter_num;
        a->filter_nums[nf] = filter_num;
        a->num_filters++;
-       PARA_INFO_LOG("%s filter %d: %s\n", audio_formats[format], nf + 1,
+       PARA_INFO_LOG("%s filter %d: %s\n", audio_formats[format], nf,
                filters[filter_num].name);
        return filter_num;
 }
index 0428bea16b891d64a488e8f322f49287154d2e1d..b4c50dc86118a6d9f3c756f7d6b2c40a87c34ca9 100644 (file)
@@ -279,8 +279,7 @@ out:
 
 static struct filter_node *find_filter_node(int slot_num, int format, int filternum)
 {
-       struct filter_node *fn;
-       int i, j;
+       int i;
 
        FOR_EACH_SLOT(i) {
                struct slot_info *s = &slot[i];
@@ -290,15 +289,10 @@ static struct filter_node *find_filter_node(int slot_num, int format, int filter
                        continue;
                if (format >= 0 && s->format != format)
                        continue;
-               if (num_filters(i) < filternum)
+               if (num_filters(i) <= filternum)
                        continue;
                /* success */
-               j = 1;
-               FOR_EACH_FILTER_NODE(fn, s->fc, j) {
-                       if (filternum <= 0 || j++ == filternum)
-                               break;
-               }
-               return fn;
+               return  s->fc->filter_nodes + filternum;
        }
        return NULL;
 }
index 4be23d7807ad7e34f5a8cece9c58f0ae7971b536..77d3616d2c2e41b3caf32f5fea13d54cf778642b 100644 (file)
@@ -97,15 +97,15 @@ static int check_gc_args(struct grab_client *gc)
                if (gc->audio_format_num < 0)
                        return gc->audio_format_num;
        }
-       if (c->slot_arg > MAX_STREAM_SLOTS)
+       if (c->slot_arg >= MAX_STREAM_SLOTS)
                return -E_BAD_GC_SLOT;
-       if (c->filter_num_arg <= 0)
+       if (c->filter_num_arg < 0)
                return -E_BAD_GC_FILTER_NUM;
        if (c->audio_format_given) {
-               if (num_filters(gc->audio_format_num) < c->filter_num_arg)
+               if (num_filters(gc->audio_format_num) <= c->filter_num_arg)
                        return -E_BAD_GC_FILTER_NUM;
        } else
-               if (c->filter_num_arg > max_num_filters())
+               if (c->filter_num_arg >= max_num_filters())
                        return -E_BAD_GC_FILTER_NUM;
 
        return 1;
@@ -190,10 +190,8 @@ void activate_inactive_grab_clients(int slot_num, int audio_format_num,
                                audio_format_num)
                        continue;
                filter_num = gc->conf->filter_num_arg;
-               if (filter_num >= 0 && filter_num >= num_filters(gc->audio_format_num))
+               if (filter_num >= num_filters(gc->audio_format_num))
                        continue;
-               if (filter_num < 0)
-                       filter_num = 0;
                fn = fc->filter_nodes + filter_num;
                activate_grab_client(gc, fn);
        }
index 263259dd87ab385a7a105442c2d8116154e9e2aa..5527143b1b6a61dc0ac1015124336e4137df5cf4 100644 (file)
@@ -1,7 +1,7 @@
 option "filter_num" f
        "point of filter chain to grab"
        int typestr="num"
-       default="1"
+       default="0"
        optional
 
 option "slot" s