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 const char *agl_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
31 snprintf (buf, len, "%s/%s", dir, file);
36 bool agl_config_parse_file (struct userdata *u, const char *path)
45 pa_log_info ("parsing configuration file '%s'", path);
46 success = agl_config_dofile (u, path);
50 pa_log_info ("applying builtin default configuration");
51 //success = use_default_configuration (u);
57 bool agl_config_dofile (struct userdata *u, const char *path)
64 /* DEFAULT CONFIGURATION PART */
66 static zone_def zones[] = {
76 static rtgroup_def rtgroups[] = {
79 agl_router_phone_accept,
80 agl_router_phone_compare
83 { 0, NULL, NULL, NULL }
86 static classmap_def classmap[] = {
87 { agl_phone, 0, agl_output, "phone" },
88 { agl_player, 0, agl_output, "default" },
89 { agl_radio, 0, agl_output, "default" },
90 { agl_navigator,0, agl_output, "default" },
91 { agl_event, 0, agl_output, "default" },
92 { agl_node_type_unknown, 0, agl_direction_unknown, NULL }
95 static typemap_def typemap[] = {
96 { "phone", agl_phone },
97 { "music", agl_player },
98 { "radio", agl_radio },
99 { "navi", agl_navigator },
100 { "event", agl_event },
101 { NULL, agl_node_type_unknown }
104 static prior_def priormap[] = {
107 { agl_navigator, 2 },
110 { agl_node_type_unknown, 0}
113 bool use_default_configuration (struct userdata *u)
123 for (z = zones; z->name; z++)
124 agl_zoneset_add_zone (u, z->name, (uint32_t)(z - zones));
126 for (r = rtgroups; r->name; r++)
127 agl_router_create_rtgroup (u, r->type, r->name, r->accept, r->compare);
129 for (c = classmap; c->rtgroup; c++)
130 agl_router_assign_class_to_rtgroup (u, c->class, c->zone,
131 c->type, c->rtgroup);
133 for (t = typemap; t->id; t++)
134 agl_nodeset_add_role (u, t->id, t->type, NULL);
136 for (p = priormap; p->class; p++)
137 agl_router_assign_class_priority (u, p->class, p->priority);