~binli/ubuntu/vivid/pulseaudio/load-extcon-module

« back to all changes in this revision

Viewing changes to src/modules/module-combine.c

  • Committer: Bin Li
  • Date: 2016-01-23 15:04:48 UTC
  • Revision ID: bin.li@canonical.com-20160123150448-5ockvw4p5xxntda4
init the 1:6.0-0ubuntu9.15 from silo 12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, see <http://www.gnu.org/licenses/>.
 
19
***/
 
20
 
 
21
#ifdef HAVE_CONFIG_H
 
22
#include <config.h>
 
23
#endif
 
24
 
 
25
#include <pulse/xmalloc.h>
 
26
 
 
27
#include <pulsecore/module.h>
 
28
#include <pulsecore/log.h>
 
29
 
 
30
#include "module-combine-symdef.h"
 
31
 
 
32
PA_MODULE_AUTHOR("Colin Guthrie");
 
33
PA_MODULE_DESCRIPTION("Compatibility module (module-combine rename)");
 
34
PA_MODULE_VERSION(PACKAGE_VERSION);
 
35
PA_MODULE_LOAD_ONCE(false);
 
36
PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!");
 
37
 
 
38
struct userdata {
 
39
    uint32_t module_index;
 
40
};
 
41
 
 
42
int pa__init(pa_module*m) {
 
43
    struct userdata *u;
 
44
    pa_module *module;
 
45
 
 
46
    pa_assert(m);
 
47
    pa_assert_se(m->userdata = u = pa_xnew0(struct userdata, 1));
 
48
 
 
49
    pa_log_warn("We will now load module-combine-sink. Please make sure to remove module-combine from your configuration.");
 
50
 
 
51
    module = pa_module_load(m->core, "module-combine-sink", m->argument);
 
52
    u->module_index = module ? module->index : PA_INVALID_INDEX;
 
53
 
 
54
    return module ? 0 : -1;
 
55
}
 
56
 
 
57
void pa__done(pa_module*m) {
 
58
    struct userdata *u;
 
59
 
 
60
    pa_assert(m);
 
61
    pa_assert(m->userdata);
 
62
 
 
63
    u = m->userdata;
 
64
 
 
65
    if (u && PA_INVALID_INDEX != u->module_index)
 
66
        pa_module_unload_by_index(m->core, u->module_index, true);
 
67
 
 
68
    pa_xfree(u);
 
69
}