]> code.delx.au - pulseaudio/blob - src/modules/module-combine.c
Whitespace cleanup: Remove all multiple newlines
[pulseaudio] / src / modules / module-combine.c
1 /***
2 This file is part of PulseAudio.
3
4 Copyright 2009 Lennart Poettering
5 Copyright 2011 Colin Guthrie
6
7 PulseAudio is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation; either version 2.1 of the License,
10 or (at your option) any later version.
11
12 PulseAudio is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with PulseAudio; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA.
21 ***/
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <pulse/xmalloc.h>
28
29 #include <pulsecore/module.h>
30 #include <pulsecore/log.h>
31
32 #include "module-combine-symdef.h"
33
34 PA_MODULE_AUTHOR("Colin Guthrie");
35 PA_MODULE_DESCRIPTION("Compatibility module (module-combine rename)");
36 PA_MODULE_VERSION(PACKAGE_VERSION);
37 PA_MODULE_LOAD_ONCE(FALSE);
38 PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!");
39
40 struct userdata {
41 uint32_t module_index;
42 };
43
44 int pa__init(pa_module*m) {
45 struct userdata *u;
46 pa_module *module;
47
48 pa_assert(m);
49 pa_assert_se(m->userdata = u = pa_xnew0(struct userdata, 1));
50
51 pa_log_warn("We will now load module-combine-sink. Please make sure to remove module-combine from your configuration.");
52
53 module = pa_module_load(m->core, "module-combine-sink", m->argument);
54 u->module_index = module ? module->index : PA_INVALID_INDEX;
55
56 return module ? 0 : -1;
57 }
58
59 void pa__done(pa_module*m) {
60 struct userdata *u;
61
62 pa_assert(m);
63 pa_assert(m->userdata);
64
65 u = m->userdata;
66
67 if (u && PA_INVALID_INDEX != u->module_index)
68 pa_module_unload_by_index(m->core, u->module_index, TRUE);
69
70 pa_xfree(u);
71 }