#include "stream-manager-priv.h"
#include "stream-manager-filter-priv.h"
-#define MODULE_FILTER_APPLY "module-filter-apply"
+#define MODULE_FILTER_APPLY "module-filter-apply"
+#define PA_PROP_FILTER_APPLY_GROUP PA_PROP_FILTER_APPLY".%s.group"
+#define PA_PROP_FILTER_APPLY_PARAMETERS PA_PROP_FILTER_APPLY".%s.parameters"
/* Based on parse_control_parameters() of module-ladspa-sink.c */
static int32_t parse_filter_control_parameters(const char *cdata, double *read_values, bool *use_default,
/* Invoked from dbus method call or hook fire */
int32_t apply_filter_to_sink_input(pa_sink_input *si, filter_info *f, bool need_to_hook) {
+ const char *filter_apply = NULL;
+ char *prop_group;
+ char *prop_parameters;
+
pa_assert(si);
if (!f) {
/* Unload filter using module-filter-apply */
- pa_proplist_unset(si->proplist, PA_PROP_FILTER_APPLY);
- pa_proplist_unset(si->proplist, PA_PROP_FILTER_APPLY_EXTRA_PARAMETERS);
- pa_proplist_unset(si->proplist, PA_PROP_FILTER_APPLY_EXTRA_GROUP);
+ if ((filter_apply = pa_proplist_gets(si->proplist, PA_PROP_FILTER_APPLY))) {
+ prop_group = pa_sprintf_malloc(PA_PROP_FILTER_APPLY_GROUP, filter_apply);
+ pa_proplist_unset(si->proplist, prop_group);
+ pa_xfree(prop_group);
+
+ prop_parameters = pa_sprintf_malloc(PA_PROP_FILTER_APPLY_PARAMETERS, filter_apply);
+ pa_proplist_unset(si->proplist, prop_parameters);
+ pa_xfree(prop_parameters);
+
+ pa_proplist_unset(si->proplist, PA_PROP_FILTER_APPLY);
+ }
} else {
if (!f->filter_apply || pa_streq(f->filter_apply, "")) {
pa_log_error("Try to applying empty filter module");
pa_proplist_sets(si->proplist, PA_PROP_FILTER_APPLY, f->filter_apply);
/* Optional properties */
- if (f->extra_parameters)
- pa_proplist_sets(si->proplist, PA_PROP_FILTER_APPLY_EXTRA_PARAMETERS, f->extra_parameters);
- if (f->extra_group)
- pa_proplist_sets(si->proplist, PA_PROP_FILTER_APPLY_EXTRA_GROUP, f->extra_group);
+ if (f->group) {
+ prop_group = pa_sprintf_malloc(PA_PROP_FILTER_APPLY_GROUP, f->filter_apply);
+ pa_proplist_sets(si->proplist, prop_group, f->group);
+ pa_xfree(prop_group);
+ }
+ if (f->parameters) {
+ prop_parameters = pa_sprintf_malloc(PA_PROP_FILTER_APPLY_PARAMETERS, f->filter_apply);
+ pa_proplist_sets(si->proplist, prop_parameters, f->parameters);
+ pa_xfree(prop_parameters);
+ }
}
if (need_to_hook)
f_key = pa_xstrdup(stream_type);
f_new = pa_xmalloc0(sizeof(filter_info));
f_new->filter_apply = pa_xstrdup(filter_name);
- f_new->extra_parameters = pa_xstrdup(filter_parameters);
- f_new->extra_group = pa_xstrdup(filter_group);
+ f_new->group = pa_xstrdup(filter_group);
+ f_new->parameters = pa_xstrdup(filter_parameters);
pa_hashmap_put(m->filter_infos, (void*)f_key, f_new);
pa_log_debug("Apply filter(module-%s) to streams of %s type", f_new->filter_apply, stream_type);
} else {
pa_assert(f);
pa_xfree((void *)f->filter_apply);
- pa_xfree((void *)f->extra_parameters);
- pa_xfree((void *)f->extra_group);
+ pa_xfree((void *)f->group);
+ pa_xfree((void *)f->parameters);
pa_xfree(f);
}