]> code.delx.au - pulseaudio/blob - src/pulsecore/autoload.h
8a3522a7a8a0dd605c7dfda26dac6c360a04b3fd
[pulseaudio] / src / pulsecore / autoload.h
1 #ifndef fooautoloadhfoo
2 #define fooautoloadhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of PulseAudio.
8
9 Copyright 2004-2006 Lennart Poettering
10
11 PulseAudio is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation; either version 2 of the License,
14 or (at your option) any later version.
15
16 PulseAudio is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with PulseAudio; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 USA.
25 ***/
26
27 #include <pulsecore/namereg.h>
28
29 /* Using the autoloading facility, modules by be loaded on-demand and
30 * synchronously. The user may register a "ghost sink" or "ghost
31 * source". Whenever this sink/source is requested but not available a
32 * specified module is loaded. */
33
34 /* An autoload entry, or "ghost" sink/source */
35 typedef struct pa_autoload_entry {
36 pa_core *core;
37 uint32_t index;
38 char *name;
39 pa_namereg_type_t type; /* Type of the autoload entry */
40 int in_action; /* The module is currently being loaded */
41 char *module, *argument;
42 } pa_autoload_entry;
43
44 /* Add a new autoload entry of the given time, with the speicified
45 * sink/source name, module name and argument. Return the entry's
46 * index in *index */
47 int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx);
48
49 /* Free all autoload entries */
50 void pa_autoload_free(pa_core *c);
51 int pa_autoload_remove_by_name(pa_core *c, const char*name, pa_namereg_type_t type);
52 int pa_autoload_remove_by_index(pa_core *c, uint32_t idx);
53
54 /* Request an autoload entry by its name, effectively causing a module to be loaded */
55 void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type);
56
57 const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type);
58 const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx);
59
60 #endif