7 This file is part of PulseAudio.
9 Copyright 2004-2006 Lennart Poettering
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.
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.
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
27 #include <pulse/mainloop-api.h>
28 #include <pulse/sample.h>
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 #include <pulsecore/asyncmsgq.h>
39 typedef struct pa_core pa_core
;
41 #include <pulsecore/core-subscribe.h>
42 #include <pulsecore/sink-input.h>
43 #include <pulsecore/msgobject.h>
45 typedef enum pa_core_hook
{
46 PA_CORE_HOOK_SINK_NEW_POST
,
47 PA_CORE_HOOK_SINK_DISCONNECT
,
48 PA_CORE_HOOK_SINK_DISCONNECT_POST
,
49 PA_CORE_HOOK_SINK_STATE_CHANGED
,
50 PA_CORE_HOOK_SOURCE_NEW_POST
,
51 PA_CORE_HOOK_SOURCE_DISCONNECT
,
52 PA_CORE_HOOK_SOURCE_DISCONNECT_POST
,
53 PA_CORE_HOOK_SOURCE_STATE_CHANGED
,
54 PA_CORE_HOOK_SINK_INPUT_NEW
,
55 PA_CORE_HOOK_SINK_INPUT_PUT
,
56 PA_CORE_HOOK_SINK_INPUT_DISCONNECT
,
57 PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST
,
58 PA_CORE_HOOK_SOURCE_OUTPUT_NEW
,
59 PA_CORE_HOOK_SOURCE_OUTPUT_PUT
,
60 PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT
,
61 PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST
,
65 /* The core structure of PulseAudio. Every PulseAudio daemon contains
66 * exactly one of these. It is used for storing kind of global
67 * variables for the daemon. */
72 /* A random value which may be used to identify this instance of
73 * PulseAudio. Not cryptographically secure in any way. */
76 pa_mainloop_api
*mainloop
;
78 /* idxset of all kinds of entities */
79 pa_idxset
*clients
, *sinks
, *sources
, *sink_inputs
, *source_outputs
, *modules
, *scache
, *autoload_idxset
;
81 /* Some hashmaps for all sorts of entities */
82 pa_hashmap
*namereg
, *autoload_hashmap
, *properties
;
84 /* The name of the default sink/source */
85 char *default_source_name
, *default_sink_name
;
87 pa_sample_spec default_sample_spec
;
88 unsigned default_n_fragments
, default_fragment_size_msec
;
90 pa_time_event
*module_auto_unload_event
;
91 pa_defer_event
*module_defer_unload_event
;
93 pa_defer_event
*subscription_defer_event
;
94 PA_LLIST_HEAD(pa_subscription
, subscriptions
);
95 PA_LLIST_HEAD(pa_subscription_event
, subscription_event_queue
);
96 pa_subscription_event
*subscription_event_last
;
100 int disallow_module_loading
, running_as_daemon
;
101 int exit_idle_time
, module_idle_time
, scache_idle_time
;
103 pa_time_event
*quit_event
;
105 pa_time_event
*scache_auto_unload_event
;
107 pa_resample_method_t resample_method
;
109 int is_system_instance
;
112 pa_hook hooks
[PA_CORE_HOOK_MAX
];
115 PA_DECLARE_CLASS(pa_core
);
116 #define PA_CORE(o) pa_core_cast(o)
119 PA_CORE_MESSAGE_UNLOAD_MODULE
,
123 pa_core
* pa_core_new(pa_mainloop_api
*m
, int shared
);
125 /* Check whether noone is connected to this core */
126 void pa_core_check_quit(pa_core
*c
);