• Home
  • Raw
  • Download

Lines Matching +full:core +full:- +full:rules

4   Copyright 2004-2006 Lennart Poettering
39 #include <pulsecore/core-error.h>
41 #include <pulsecore/core-util.h>
44 #include <pulsecore/sink-input.h>
45 #include <pulsecore/core-util.h>
77 struct rule *rules; member
85 int ret = -1; in load_rules()
111 pa_update_mode_t mode = (pa_update_mode_t) -1; in load_rules()
128 pa_log("[%s:%u] failed to parse line - missing regexp", fn, n); in load_rules()
133 pa_log("[%s:%u] failed to parse line - too few words", fn, n); in load_rules()
144 len = token_end - value_str; in load_rules()
145 if (len == (sizeof(UPDATE_REPLACE) - 1) && !strncmp(value_str, UPDATE_REPLACE, len)) in load_rules()
147 else if (len == (sizeof(UPDATE_MERGE) - 1) && !strncmp(value_str, UPDATE_MERGE, len)) in load_rules()
150 if (mode != (pa_update_mode_t) -1) { in load_rules()
154 pa_log("[%s:%u] failed to parse line - too few words", fn, n); in load_rules()
165 pa_log("[%s:%u] failed to parse line - missing role closing quote", fn, n); in load_rules()
186 rule->regex = regex; in load_rules()
187 rule->proplist = proplist; in load_rules()
188 rule->mode = mode; in load_rules()
189 rule->volume = volume; in load_rules()
190 rule->next = NULL; in load_rules()
193 end->next = rule; in load_rules()
195 u->rules = rule; in load_rules()
219 if (!(n = pa_proplist_gets(si->proplist, u->property_key))) in sink_input_fixate_hook_callback()
224 for (r = u->rules; r; r = r->next) { in sink_input_fixate_hook_callback()
225 if (!regexec(&r->regex, n, 0, NULL, 0)) { in sink_input_fixate_hook_callback()
226 if (r->proplist) { in sink_input_fixate_hook_callback()
228 pa_proplist_update(si->proplist, r->mode, r->proplist); in sink_input_fixate_hook_callback()
229 } else if (si->volume_writable) { in sink_input_fixate_hook_callback()
231 pa_log_debug("changing volume of sink input '%s' to 0x%03x", n, r->volume); in sink_input_fixate_hook_callback()
232 pa_cvolume_set(&cv, si->sample_spec.channels, r->volume); in sink_input_fixate_hook_callback()
248 if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { in pa__init()
254 u->rules = NULL; in pa__init()
255 m->userdata = u; in pa__init()
257 u->property_key = pa_xstrdup(pa_modargs_get_value(ma, "key", PA_PROP_MEDIA_NAME)); in pa__init()
262 /* hook EARLY - 1, to match before stream-restore */ in pa__init()
263 …u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], … in pa__init()
273 return -1; in pa__init()
282 if (!(u = m->userdata)) in pa__done()
285 if (u->sink_input_fixate_hook_slot) in pa__done()
286 pa_hook_slot_free(u->sink_input_fixate_hook_slot); in pa__done()
288 if (u->property_key) in pa__done()
289 pa_xfree(u->property_key); in pa__done()
291 for (r = u->rules; r; r = n) { in pa__done()
292 n = r->next; in pa__done()
294 regfree(&r->regex); in pa__done()
295 if (r->proplist) in pa__done()
296 pa_proplist_free(r->proplist); in pa__done()