{
struct audio_format_info *a = &afi[format];
int filter_num, nf = a->num_filters;
+ void *cfg;
- filter_num = check_filter_arg(cmdline, &a->filter_conf[nf]);
+ filter_num = check_filter_arg(cmdline, &cfg);
if (filter_num < 0)
return filter_num;
+ a->filter_conf = para_realloc(a->filter_conf,
+ (nf + 1) * sizeof(void *));
+ a->filter_nums = para_realloc(a->filter_nums,
+ (nf + 1) * sizeof(unsigned));
a->filter_nums[nf] = filter_num;
+ a->filter_conf[nf] = cfg;
a->num_filters++;
PARA_INFO_LOG("%s filter %d: %s\n", audio_formats[format], nf,
filters[filter_num].name);
if (a->num_filters)
continue; /* no default -- nothing to to */
/*
- * If udp is used to receive this audiod format, add fecdec as
- * the first filter.
+ * udp and dccp streams are fec-encoded, so add fecdec as the
+ * first filter.
*/
if (strcmp(afi[i].receiver->name, "udp") == 0 ||
strcmp(afi[i].receiver->name, "dccp") == 0) {
static int parse_filter_args(void)
{
- int i, ret, nf;
+ int i, j, ret, af_mask;
- nf = PARA_MAX(2U, conf.filter_given);
- PARA_INFO_LOG("maximal number of filters: %d\n", nf);
- FOR_EACH_AUDIO_FORMAT(i) {
- afi[i].filter_conf = para_malloc(nf * sizeof(void *));
- afi[i].filter_nums = para_malloc(nf * sizeof(unsigned));
- }
if (!conf.no_default_filters_given)
return init_default_filters();
for (i = 0; i < conf.filter_given; i++) {
- char *arg = conf.filter_arg[i];
- char *filter_name = strchr(arg, ':');
- ret = -E_MISSING_COLON;
- if (!filter_name)
- goto out;
- *filter_name = '\0';
- filter_name++;
- ret = get_audio_format_num(arg);
- if (ret < 0)
- goto out;
- ret = add_filter(ret, filter_name);
+ char *arg;
+ ret = parse_stream_command(conf.filter_arg[i], &arg);
if (ret < 0)
goto out;
+ af_mask = ret;
+ FOR_EACH_AUDIO_FORMAT(j) {
+ if ((af_mask & (1 << j)) == 0) /* no match */
+ continue;
+ ret = add_filter(j, arg);
+ if (ret < 0)
+ goto out;
+ }
}
ret = init_default_filters(); /* use default values for the rest */
out: