2 * module-agl-audio -- PulseAudio module for providing audio routing support
3 * (forked from "module-murphy-ivi" - https://github.com/otcshare )
4 * Copyright (c) 2012, Intel Corporation.
5 * Copyright (c) 2016, IoT.bzh
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU Lesser General Public License,
9 * version 2.1, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
25 bool use_default_configuration (struct userdata *);
27 const char *agl_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
33 snprintf (buf, len, "%s/%s", dir, file);
38 bool agl_config_parse_file (struct userdata *u, const char *path)
47 pa_log_info ("parsing configuration file '%s'", path);
48 success = agl_config_dofile (u, path);
52 pa_log_info ("applying builtin default configuration");
53 success = use_default_configuration (u);
59 bool agl_config_dofile (struct userdata *u, const char *path)
66 /* DEFAULT CONFIGURATION PART */
68 static zone_def zones[] = {
78 static rtgroup_def rtgroups[] = {
82 agl_router_phone_accept,
83 agl_router_phone_compare
86 { 0, NULL, NULL, NULL, NULL }
89 static classmap_def classmap[] = {
90 { agl_phone, 0, agl_input, "Phone" },
91 { agl_player, 0, agl_input, "default" },
92 { agl_radio, 0, agl_input, "default" },
93 { agl_navigator,0, agl_input, "default" },
94 { agl_event, 0, agl_input, "default" },
95 { agl_node_type_unknown, 0, agl_direction_unknown, NULL }
98 static typemap_def typemap[] = {
99 { "phone", agl_phone },
100 { "music", agl_player },
101 { "radio", agl_radio },
102 { "navi", agl_navigator },
103 { "event", agl_event },
104 { NULL, agl_node_type_unknown }
107 static prior_def priormap[] = {
110 { agl_navigator, 2 },
113 { agl_node_type_unknown, 0}
116 bool use_default_configuration (struct userdata *u)
126 for (z = zones; z->name; z++)
127 agl_zoneset_add_zone (u, z->name, (uint32_t)(z - zones));
129 for (r = rtgroups; r->name; r++)
130 agl_router_create_rtgroup (u, r->type, r->name, r->node_desc,
131 r->accept, r->compare);
133 for (c = classmap; c->rtgroup; c++)
134 agl_router_assign_class_to_rtgroup (u, c->class, c->zone,
135 c->type, c->rtgroup);
137 for (t = typemap; t->id; t++)
138 agl_nodeset_add_role (u, t->id, t->type, NULL);
140 for (p = priormap; p->class; p++)
141 agl_router_assign_class_priority (u, p->class, p->priority);