2 * module-murphy-ivi -- PulseAudio module for providing audio routing support
3 * Copyright (c) 2012, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 2.1, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
24 #include <pulsecore/pulsecore-config.h>
33 mir_rtgroup_accept_t accept;
34 mir_rtgroup_compare_t compare;
48 static rtgroup_def rtgroups[] = {
49 {"default" , mir_router_default_accept, mir_router_default_compare},
50 {"phone" , mir_router_phone_accept , mir_router_phone_compare },
51 { NULL , NULL , NULL }
54 static classmap_def classmap[] = {
55 {mir_radio , "default"},
56 {mir_player , "default"},
57 {mir_navigator, "default"},
58 {mir_game , "default"},
59 {mir_browser , "default"},
60 {mir_phone , "phone" },
61 {mir_event , "default"},
62 {mir_node_type_unknown, NULL}
65 static prior_def priormap[] = {
73 {mir_node_type_unknown, 0}
76 static double speedvol;
77 static int exception_classes[] = {mir_phone, mir_navigator};
78 static mir_volume_suppress_arg suppress = {
79 -20.0, {DIM(exception_classes), exception_classes}
83 static pa_bool_t use_default_configuration(struct userdata *);
84 static pa_bool_t parse_config_file(struct userdata *, FILE *);
87 pa_mir_config *pa_mir_config_init(struct userdata *u)
89 pa_mir_config *config;
93 config = pa_xnew0(pa_mir_config, 1);
98 void pa_mir_config_done(struct userdata *u)
100 pa_mir_config *config;
102 if (u && (config = u->config)) {
109 pa_bool_t pa_mir_config_parse_file(struct userdata *u, const char *path)
111 pa_mir_config *config;
116 pa_assert_se((config = u->config));
119 if ((f = fopen(path, "r"))) {
120 success = parse_config_file(u, f);
125 pa_log_info("%s: failed to open config file '%s': %s",
126 __FILE__, path, strerror(errno));
130 pa_log_debug("%s: default config values will apply", __FILE__);
132 success = use_default_configuration(u);
137 static pa_bool_t use_default_configuration(struct userdata *u)
145 for (r = rtgroups; r->name; r++)
146 mir_router_create_rtgroup(u, r->name, r->accept, r->compare);
148 for (c = classmap; c->rtgroup; c++)
149 mir_router_assign_class_to_rtgroup(u, c->class, c->rtgroup);
151 for (p = priormap; p->class; p++)
152 mir_router_assign_class_priority(u, p->class, p->priority);
155 mir_volume_add_generic_limit(u, mir_volume_correction, &speedvol);
157 mir_volume_add_class_limit(u, mir_phone,mir_volume_suppress, &suppress);
158 mir_volume_add_class_limit(u, mir_navigator,mir_volume_suppress,&suppress);
164 static pa_bool_t parse_config_file(struct userdata *u, FILE *f)
172 * indent-tabs-mode: nil