51a18b62e9aadad8fcd3bc31281e51e731f4163d
[profile/ivi/pulseaudio-panda.git] / src / pulsecore / core.h
1 #ifndef foocorehfoo
2 #define foocorehfoo
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 <pulse/mainloop-api.h>
28 #include <pulse/sample.h>
29
30 #include <pulsecore/idxset.h>
31 #include <pulsecore/hashmap.h>
32 #include <pulsecore/memblock.h>
33 #include <pulsecore/resampler.h>
34 #include <pulsecore/queue.h>
35 #include <pulsecore/llist.h>
36 #include <pulsecore/hook-list.h>
37
38 typedef struct pa_core pa_core;
39
40 #include <pulsecore/core-subscribe.h>
41 #include <pulsecore/sink-input.h>
42
43 /* The core structure of PulseAudio. Every PulseAudio daemon contains
44  * exactly one of these. It is used for storing kind of global
45  * variables for the daemon. */
46
47 struct pa_core {
48     /* A random value which may be used to identify this instance of
49      * PulseAudio. Not cryptographically secure in any way. */
50     uint32_t cookie;
51
52     pa_mainloop_api *mainloop;
53
54     /* idxset of all kinds of entities */
55     pa_idxset *clients, *sinks, *sources, *sink_inputs, *source_outputs, *modules, *scache, *autoload_idxset;
56
57     /* Some hashmaps for all sorts of entities */
58     pa_hashmap *namereg, *autoload_hashmap, *properties;
59
60     /* The name of the default sink/source */
61     char *default_source_name, *default_sink_name;
62
63     pa_sample_spec default_sample_spec;
64     pa_time_event *module_auto_unload_event;
65     pa_defer_event *module_defer_unload_event;
66
67     pa_defer_event *subscription_defer_event;
68     PA_LLIST_HEAD(pa_subscription, subscriptions);
69     PA_LLIST_HEAD(pa_subscription_event, subscription_event_queue);
70     pa_subscription_event *subscription_event_last;
71
72     pa_mempool *mempool;
73
74     int disallow_module_loading, running_as_daemon;
75     int exit_idle_time, module_idle_time, scache_idle_time;
76
77     pa_time_event *quit_event;
78
79     pa_time_event *scache_auto_unload_event;
80
81     pa_resample_method_t resample_method;
82
83     int is_system_instance;
84
85     /* hooks */
86     pa_hook
87         hook_sink_input_new,
88         hook_sink_disconnect,
89         hook_source_output_new,
90         hook_source_disconnect;
91 };
92
93 pa_core* pa_core_new(pa_mainloop_api *m, int shared);
94 void pa_core_free(pa_core*c);
95
96 /* Check whether noone is connected to this core */
97 void pa_core_check_quit(pa_core *c);
98
99 #endif