2004-06-08 23:54:24 +00:00
|
|
|
#ifndef foocorehfoo
|
|
|
|
|
#define foocorehfoo
|
|
|
|
|
|
2004-07-16 19:56:36 +00:00
|
|
|
/***
|
2006-06-19 21:53:48 +00:00
|
|
|
This file is part of PulseAudio.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2007-02-13 15:35:19 +00:00
|
|
|
Copyright 2004-2006 Lennart Poettering
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2009-03-03 20:23:02 +00:00
|
|
|
by the Free Software Foundation; either version 2.1 of the License,
|
2004-07-16 19:56:36 +00:00
|
|
|
or (at your option) any later version.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
2004-07-16 19:56:36 +00:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2006-06-19 21:53:48 +00:00
|
|
|
along with PulseAudio; if not, write to the Free Software
|
2004-07-16 19:56:36 +00:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulse/mainloop-api.h>
|
|
|
|
|
#include <pulse/sample.h>
|
2006-08-13 16:19:56 +00:00
|
|
|
|
2009-01-28 01:46:27 +01:00
|
|
|
typedef struct pa_core pa_core;
|
|
|
|
|
|
2009-06-05 19:05:07 +02:00
|
|
|
/* This is a bitmask that encodes the cause why a sink/source is
|
|
|
|
|
* suspended. */
|
|
|
|
|
typedef enum pa_suspend_cause {
|
|
|
|
|
PA_SUSPEND_USER = 1, /* Exposed to the user via some protocol */
|
|
|
|
|
PA_SUSPEND_APPLICATION = 2, /* Used by the device reservation logic */
|
|
|
|
|
PA_SUSPEND_IDLE = 4, /* Used by module-suspend-on-idle */
|
|
|
|
|
PA_SUSPEND_SESSION = 8, /* Used by module-hal for mark inactive sessions */
|
|
|
|
|
PA_SUSPEND_ALL = 0xFFFF /* Magic cause that can be used to resume forcibly */
|
|
|
|
|
} pa_suspend_cause_t;
|
|
|
|
|
|
2006-08-12 02:18:24 +00:00
|
|
|
#include <pulsecore/idxset.h>
|
|
|
|
|
#include <pulsecore/hashmap.h>
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/memblock.h>
|
|
|
|
|
#include <pulsecore/resampler.h>
|
|
|
|
|
#include <pulsecore/queue.h>
|
2006-08-12 02:18:24 +00:00
|
|
|
#include <pulsecore/llist.h>
|
2006-08-13 16:19:56 +00:00
|
|
|
#include <pulsecore/hook-list.h>
|
2007-10-28 19:13:50 +00:00
|
|
|
#include <pulsecore/asyncmsgq.h>
|
2008-05-15 23:34:41 +00:00
|
|
|
#include <pulsecore/sample-util.h>
|
2009-01-28 01:46:27 +01:00
|
|
|
#include <pulsecore/sink.h>
|
|
|
|
|
#include <pulsecore/source.h>
|
2006-08-13 16:19:56 +00:00
|
|
|
#include <pulsecore/core-subscribe.h>
|
|
|
|
|
#include <pulsecore/sink-input.h>
|
2007-10-28 19:13:50 +00:00
|
|
|
#include <pulsecore/msgobject.h>
|
|
|
|
|
|
2009-01-23 22:29:02 +01:00
|
|
|
typedef enum pa_core_state {
|
|
|
|
|
PA_CORE_STARTUP,
|
|
|
|
|
PA_CORE_RUNNING,
|
|
|
|
|
PA_CORE_SHUTDOWN
|
|
|
|
|
} pa_core_state_t;
|
|
|
|
|
|
2007-10-28 19:13:50 +00:00
|
|
|
typedef enum pa_core_hook {
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_CORE_HOOK_SINK_NEW,
|
|
|
|
|
PA_CORE_HOOK_SINK_FIXATE,
|
|
|
|
|
PA_CORE_HOOK_SINK_PUT,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SINK_UNLINK,
|
|
|
|
|
PA_CORE_HOOK_SINK_UNLINK_POST,
|
|
|
|
|
PA_CORE_HOOK_SINK_STATE_CHANGED,
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_CORE_HOOK_SINK_PROPLIST_CHANGED,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_NEW,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_FIXATE,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_PUT,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_UNLINK,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_UNLINK_POST,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_STATE_CHANGED,
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_PROPLIST_CHANGED,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_NEW,
|
2007-11-21 01:30:40 +00:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_FIXATE,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_PUT,
|
|
|
|
|
PA_CORE_HOOK_SINK_INPUT_UNLINK,
|
|
|
|
|
PA_CORE_HOOK_SINK_INPUT_UNLINK_POST,
|
2009-01-23 22:38:30 +01:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_MOVE_START,
|
|
|
|
|
PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH,
|
2009-02-11 19:16:42 +02:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_MOVE_FAIL,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_STATE_CHANGED,
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_PROPLIST_CHANGED,
|
2009-02-12 03:18:05 +01:00
|
|
|
PA_CORE_HOOK_SINK_INPUT_SEND_EVENT,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_NEW,
|
2007-11-21 01:30:40 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_PUT,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST,
|
2009-01-23 22:38:30 +01:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START,
|
|
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH,
|
2009-02-11 19:16:42 +02:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FAIL,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED,
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED,
|
2009-02-12 03:18:05 +01:00
|
|
|
PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT,
|
2009-01-15 17:52:29 +01:00
|
|
|
PA_CORE_HOOK_CLIENT_NEW,
|
|
|
|
|
PA_CORE_HOOK_CLIENT_PUT,
|
|
|
|
|
PA_CORE_HOOK_CLIENT_UNLINK,
|
2009-02-05 04:09:27 +01:00
|
|
|
PA_CORE_HOOK_CLIENT_PROPLIST_CHANGED,
|
2009-02-12 03:18:05 +01:00
|
|
|
PA_CORE_HOOK_CLIENT_SEND_EVENT,
|
2009-01-15 18:29:16 +01:00
|
|
|
PA_CORE_HOOK_CARD_NEW,
|
|
|
|
|
PA_CORE_HOOK_CARD_PUT,
|
|
|
|
|
PA_CORE_HOOK_CARD_UNLINK,
|
2007-10-28 19:13:50 +00:00
|
|
|
PA_CORE_HOOK_MAX
|
|
|
|
|
} pa_core_hook_t;
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2006-06-19 23:51:58 +00:00
|
|
|
/* The core structure of PulseAudio. Every PulseAudio daemon contains
|
2004-11-21 21:31:28 +00:00
|
|
|
* exactly one of these. It is used for storing kind of global
|
|
|
|
|
* variables for the daemon. */
|
|
|
|
|
|
2004-07-03 23:35:12 +00:00
|
|
|
struct pa_core {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_msgobject parent;
|
|
|
|
|
|
2009-01-23 22:29:02 +01:00
|
|
|
pa_core_state_t state;
|
|
|
|
|
|
2004-12-12 22:58:53 +00:00
|
|
|
/* A random value which may be used to identify this instance of
|
2006-06-19 23:51:58 +00:00
|
|
|
* PulseAudio. Not cryptographically secure in any way. */
|
2004-12-12 22:58:53 +00:00
|
|
|
uint32_t cookie;
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_mainloop_api *mainloop;
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2004-11-21 21:31:28 +00:00
|
|
|
/* idxset of all kinds of entities */
|
2009-01-15 20:07:13 +01:00
|
|
|
pa_idxset *clients, *cards, *sinks, *sources, *sink_inputs, *source_outputs, *modules, *scache;
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2004-11-21 21:31:28 +00:00
|
|
|
/* Some hashmaps for all sorts of entities */
|
2009-01-15 20:07:13 +01:00
|
|
|
pa_hashmap *namereg, *shared;
|
2004-08-04 16:39:30 +00:00
|
|
|
|
2009-01-29 16:25:29 +01:00
|
|
|
/* The default sink/source */
|
2009-01-28 01:46:27 +01:00
|
|
|
pa_source *default_source;
|
|
|
|
|
pa_sink *default_sink;
|
2004-07-15 20:12:21 +00:00
|
|
|
|
2009-02-21 16:32:42 +01:00
|
|
|
pa_channel_map default_channel_map;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_sample_spec default_sample_spec;
|
2007-10-28 19:13:50 +00:00
|
|
|
unsigned default_n_fragments, default_fragment_size_msec;
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_defer_event *module_defer_unload_event;
|
2004-08-11 00:11:12 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_defer_event *subscription_defer_event;
|
2006-08-12 02:18:24 +00:00
|
|
|
PA_LLIST_HEAD(pa_subscription, subscriptions);
|
|
|
|
|
PA_LLIST_HEAD(pa_subscription_event, subscription_event_queue);
|
|
|
|
|
pa_subscription_event *subscription_event_last;
|
2004-08-17 19:37:29 +00:00
|
|
|
|
2006-08-18 19:55:18 +00:00
|
|
|
pa_mempool *mempool;
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_silence_cache silence_cache;
|
2004-09-03 22:44:55 +00:00
|
|
|
|
2008-08-06 19:39:12 +02:00
|
|
|
pa_time_event *exit_event;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_time_event *scache_auto_unload_event;
|
2004-09-17 19:45:44 +00:00
|
|
|
|
2009-01-29 16:25:29 +01:00
|
|
|
int exit_idle_time, scache_idle_time;
|
|
|
|
|
|
|
|
|
|
pa_bool_t flat_volumes:1;
|
2008-06-27 21:37:33 +02:00
|
|
|
pa_bool_t disallow_module_loading:1;
|
2008-08-06 19:39:12 +02:00
|
|
|
pa_bool_t disallow_exit:1;
|
2008-06-27 21:37:33 +02:00
|
|
|
pa_bool_t running_as_daemon:1;
|
|
|
|
|
pa_bool_t realtime_scheduling:1;
|
|
|
|
|
pa_bool_t disable_remixing:1;
|
2008-09-05 16:04:42 +03:00
|
|
|
pa_bool_t disable_lfe_remixing:1;
|
2008-06-27 21:37:33 +02:00
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_resample_method_t resample_method;
|
2007-11-01 02:58:26 +00:00
|
|
|
int realtime_priority;
|
2006-08-13 16:19:56 +00:00
|
|
|
|
|
|
|
|
/* hooks */
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_hook hooks[PA_CORE_HOOK_MAX];
|
|
|
|
|
};
|
|
|
|
|
|
2009-08-21 21:27:44 +02:00
|
|
|
PA_DECLARE_PUBLIC_CLASS(pa_core);
|
2007-10-28 19:13:50 +00:00
|
|
|
#define PA_CORE(o) pa_core_cast(o)
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PA_CORE_MESSAGE_UNLOAD_MODULE,
|
|
|
|
|
PA_CORE_MESSAGE_MAX
|
2004-06-08 23:54:24 +00:00
|
|
|
};
|
|
|
|
|
|
2008-10-01 01:14:36 +02:00
|
|
|
pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size);
|
2004-11-21 21:31:28 +00:00
|
|
|
|
|
|
|
|
/* Check whether noone is connected to this core */
|
2008-08-06 19:39:12 +02:00
|
|
|
void pa_core_check_idle(pa_core *c);
|
|
|
|
|
|
|
|
|
|
int pa_core_exit(pa_core *c, pa_bool_t force, int retval);
|
2004-09-04 00:27:36 +00:00
|
|
|
|
2009-02-25 09:13:19 +01:00
|
|
|
void pa_core_maybe_vacuum(pa_core *c);
|
|
|
|
|
|
2009-04-05 02:13:43 +03:00
|
|
|
/* wrapper for c->mainloop->time_*() RT time events */
|
|
|
|
|
pa_time_event* pa_core_rttime_new(pa_core *c, pa_usec_t usec, pa_time_event_cb_t cb, void *userdata);
|
|
|
|
|
void pa_core_rttime_restart(pa_core *c, pa_time_event *e, pa_usec_t usec);
|
|
|
|
|
|
2004-06-08 23:54:24 +00:00
|
|
|
#endif
|