Change semantics of the filter number to zero-based.
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;
}
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;
}
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];
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;
}
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;
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);
}
option "filter_num" f
"point of filter chain to grab"
int typestr="num"
- default="1"
+ default="0"
optional
option "slot" s