11 #include <sys/types.h>
12 #include <sys/socket.h>
14 #include <pulsecore/pulsecore-config.h>
16 #include <pulse/timeval.h>
17 #include <pulse/xmalloc.h>
19 #include <pulsecore/macro.h>
20 #include <pulsecore/module.h>
21 #include <pulsecore/idxset.h>
22 #include <pulsecore/client.h>
23 #include <pulsecore/core-util.h>
24 #include <pulsecore/core-error.h>
25 #include <pulsecore/modargs.h>
26 #include <pulsecore/log.h>
28 #include "module-murphy-ivi-symdef.h"
34 #include "multiplex.h"
40 #ifndef DEFAULT_CONFIG_FILE
41 #define DEFAULT_CONFIG_FILE "murphy-ivi.conf"
45 PA_MODULE_AUTHOR("Janos Kovacs");
46 PA_MODULE_DESCRIPTION("Murphy and GenIVI compliant audio policy module");
47 PA_MODULE_VERSION(PACKAGE_VERSION);
48 PA_MODULE_LOAD_ONCE(TRUE);
50 "config_dir=<configuration directory>"
51 "config_file=<policy configuration file> "
52 "dbus_bus_type=<system|session> "
53 "dbus_if_name=<policy dbus interface> "
54 "dbus_murphy_path=<policy daemon's path> "
55 "dbus_murphy_name=<policy daemon's name> "
56 "dbus_audiomgr_path=<GenIVI audio manager's path> "
57 "dbus_audiomgr_name=<GenIVI audio manager's name> "
58 "null_sink_name=<name of the null sink> "
61 static const char* const valid_modargs[] = {
75 int pa__init(pa_module *m) {
76 struct userdata *u = NULL;
77 pa_modargs *ma = NULL;
92 if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
93 pa_log("Failed to parse module arguments.");
97 cfgdir = pa_modargs_get_value(ma, "config_dir", NULL);
98 cfgfile = pa_modargs_get_value(ma, "config_file", DEFAULT_CONFIG_FILE);
99 dbustype = pa_modargs_get_value(ma, "dbus_bus_type", NULL);
100 ifnam = pa_modargs_get_value(ma, "dbus_if_name", NULL);
101 mrppath = pa_modargs_get_value(ma, "dbus_murphy_path", NULL);
102 mrpnam = pa_modargs_get_value(ma, "dbus_murphy_name", NULL);
103 ampath = pa_modargs_get_value(ma, "dbus_audiomgr_path", NULL);
104 amnam = pa_modargs_get_value(ma, "dbus_audiomgr_name", NULL);
105 nsnam = pa_modargs_get_value(ma, "null_sink_name", NULL);
107 u = pa_xnew0(struct userdata, 1);
110 u->nullsink = pa_utils_create_null_sink(u, nsnam);
111 u->nodeset = pa_nodeset_init(u);
112 u->audiomgr = pa_audiomgr_init(u);
113 u->dbusif = pa_policy_dbusif_init(u, dbustype, ifnam, mrppath, mrpnam,
115 u->discover = pa_discover_init(u);
116 u->tracker = pa_tracker_init(u);
117 u->router = pa_router_init(u);
118 u->multiplex = pa_multiplex_init();
119 u->config = pa_mir_config_init(u);
121 if (u->nullsink == NULL || u->dbusif == NULL ||
122 u->audiomgr == NULL || u->discover == NULL)
127 //cfgpath = pa_utils_file_path(cfgfile, buf, sizeof(buf));
129 pa_mir_config_parse_file(u, cfgpath);
131 pa_tracker_synchronize(u);
133 mir_router_print_rtgroups(u, buf, sizeof(buf));
134 pa_log_debug("%s", buf);
150 void pa__done(pa_module *m) {
155 if ((u = m->userdata)) {
161 pa_policy_dbusif_done(u);
162 pa_mir_config_done(u);
164 pa_utils_destroy_null_sink(u);
166 pa_multiplex_done(u->multiplex, u->core);
178 * indent-tabs-mode: nil