diff options
Diffstat (limited to 'src')
45 files changed, 166 insertions, 944 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e570a6d2..4b36f6f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -712,7 +712,6 @@ libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES = \ pulsecore/asyncmsgq.c pulsecore/asyncmsgq.h \ pulsecore/asyncq.c pulsecore/asyncq.h \ pulsecore/auth-cookie.c pulsecore/auth-cookie.h \ - pulsecore/autoload.c pulsecore/autoload.h \ pulsecore/cli-command.c pulsecore/cli-command.h \ pulsecore/cli-text.c pulsecore/cli-text.h \ pulsecore/client.c pulsecore/client.h \ diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index cc3d714b..43a4a326 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -52,7 +52,6 @@ enum { ARG_DISALLOW_MODULE_LOADING, ARG_DISALLOW_EXIT, ARG_EXIT_IDLE_TIME, - ARG_MODULE_IDLE_TIME, ARG_SCACHE_IDLE_TIME, ARG_LOG_TARGET, ARG_LOG_META, @@ -88,7 +87,6 @@ static const struct option long_options[] = { {"disallow-module-loading", 2, 0, ARG_DISALLOW_MODULE_LOADING}, {"disallow-exit", 2, 0, ARG_DISALLOW_EXIT}, {"exit-idle-time", 2, 0, ARG_EXIT_IDLE_TIME}, - {"module-idle-time", 2, 0, ARG_MODULE_IDLE_TIME}, {"scache-idle-time", 2, 0, ARG_SCACHE_IDLE_TIME}, {"log-target", 1, 0, ARG_LOG_TARGET}, {"log-meta", 2, 0, ARG_LOG_META}, @@ -352,10 +350,6 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d conf->exit_idle_time = atoi(optarg); break; - case ARG_MODULE_IDLE_TIME: - conf->module_idle_time = atoi(optarg); - break; - case ARG_SCACHE_IDLE_TIME: conf->scache_idle_time = atoi(optarg); break; diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index d7ffc105..c3abc092 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -65,7 +65,6 @@ static const pa_daemon_conf default_conf = { .disallow_module_loading = FALSE, .disallow_exit = FALSE, .exit_idle_time = 20, - .module_idle_time = 20, .scache_idle_time = 20, .auto_log_target = 1, .script_commands = NULL, @@ -416,7 +415,6 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "no-cpu-limit", pa_config_parse_bool, NULL }, { "disable-shm", pa_config_parse_bool, NULL }, { "exit-idle-time", pa_config_parse_int, NULL }, - { "module-idle-time", pa_config_parse_int, NULL }, { "scache-idle-time", pa_config_parse_int, NULL }, { "realtime-priority", parse_rtprio, NULL }, { "dl-search-path", pa_config_parse_string, NULL }, @@ -485,7 +483,6 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { table[i++].data = &c->no_cpu_limit; table[i++].data = &c->disable_shm; table[i++].data = &c->exit_idle_time; - table[i++].data = &c->module_idle_time; table[i++].data = &c->scache_idle_time; table[i++].data = c; table[i++].data = &c->dl_search_path; @@ -642,7 +639,6 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { pa_strbuf_printf(s, "no-cpu-limit = %s\n", pa_yes_no(c->no_cpu_limit)); pa_strbuf_printf(s, "disable-shm = %s\n", pa_yes_no(c->disable_shm)); pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time); - pa_strbuf_printf(s, "module-idle-time = %i\n", c->module_idle_time); pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time); pa_strbuf_printf(s, "dl-search-path = %s\n", pa_strempty(c->dl_search_path)); pa_strbuf_printf(s, "default-script-file = %s\n", pa_strempty(pa_daemon_conf_get_default_script_file(c))); diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 04a4ebe7..fffa35e0 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -72,7 +72,6 @@ typedef struct pa_daemon_conf { log_meta, log_time; int exit_idle_time, - module_idle_time, scache_idle_time, auto_log_target, realtime_priority, diff --git a/src/daemon/main.c b/src/daemon/main.c index 9c419efc..08f65e6c 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -901,7 +901,6 @@ int main(int argc, char *argv[]) { c->default_n_fragments = conf->default_n_fragments; c->default_fragment_size_msec = conf->default_fragment_size_msec; c->exit_idle_time = conf->exit_idle_time; - c->module_idle_time = conf->module_idle_time; c->scache_idle_time = conf->scache_idle_time; c->resample_method = conf->resample_method; c->realtime_priority = conf->realtime_priority; @@ -963,7 +962,7 @@ int main(int argc, char *argv[]) { goto finish; } - if (c->default_sink_name && !pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, TRUE) && conf->fail) { + if (c->default_sink_name && !pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK) && conf->fail) { pa_log_error(_("Default sink name (%s) does not exist in name register."), c->default_sink_name); goto finish; } diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index 4cfaaf5b..f30d39fe 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -103,7 +103,7 @@ static void update_volume(struct userdata *u) { u->muted = FALSE; - if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, FALSE))) { + if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) { pa_log_warn("Sink device '%s' not available for unmuting.", pa_strnull(u->sink_name)); return; } @@ -116,7 +116,7 @@ static void update_volume(struct userdata *u) { u->muted = TRUE; - if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, FALSE))) { + if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) { pa_log_warn("Sink device '%s' not available for muting.", pa_strnull(u->sink_name)); return; } diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index fa807815..b1dc8201 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -1103,7 +1103,7 @@ int pa__init(pa_module*m) { while ((n = pa_split(slaves, ",", &split_state))) { pa_sink *slave_sink; - if (!(slave_sink = pa_namereg_get(m->core, n, PA_NAMEREG_SINK, TRUE)) || slave_sink == u->sink) { + if (!(slave_sink = pa_namereg_get(m->core, n, PA_NAMEREG_SINK)) || slave_sink == u->sink) { pa_log("Invalid slave sink '%s'", n); pa_xfree(n); goto fail; diff --git a/src/modules/module-default-device-restore.c b/src/modules/module-default-device-restore.c index d2cc24f3..97d3fb2c 100644 --- a/src/modules/module-default-device-restore.c +++ b/src/modules/module-default-device-restore.c @@ -68,7 +68,7 @@ static void load(struct userdata *u) { if (!ln[0]) pa_log_info("No previous default sink setting, ignoring."); - else if (pa_namereg_get(u->core, ln, PA_NAMEREG_SINK, TRUE)) { + else if (pa_namereg_get(u->core, ln, PA_NAMEREG_SINK)) { pa_namereg_set_default(u->core, ln, PA_NAMEREG_SINK); pa_log_info("Restored default sink '%s'.", ln); } else @@ -88,7 +88,7 @@ static void load(struct userdata *u) { if (!ln[0]) pa_log_info("No previous default source setting, ignoring."); - else if (pa_namereg_get(u->core, ln, PA_NAMEREG_SOURCE, TRUE)) { + else if (pa_namereg_get(u->core, ln, PA_NAMEREG_SOURCE)) { pa_namereg_set_default(u->core, ln, PA_NAMEREG_SOURCE); pa_log_info("Restored default source '%s'.", ln); } else diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c index 8c1ab329..e287a5db 100644 --- a/src/modules/module-hal-detect.c +++ b/src/modules/module-hal-detect.c @@ -378,7 +378,7 @@ static int hal_device_add_all(struct userdata *u, const char *capability) { pa_log_debug("Not loaded device %s", udis[i]); else { if (d->sink_name) - pa_scache_play_item_by_name(u->core, "pulse-coldplug", d->sink_name, FALSE, PA_VOLUME_NORM, NULL, NULL); + pa_scache_play_item_by_name(u->core, "pulse-coldplug", d->sink_name, PA_VOLUME_NORM, NULL, NULL); count++; } } @@ -418,7 +418,7 @@ static void device_added_time_cb(pa_mainloop_api *ea, pa_time_event *ev, const s pa_log_debug("Not loaded device %s", td->udi); else { if (d->sink_name) - pa_scache_play_item_by_name(td->u->core, "pulse-hotplug", d->sink_name, FALSE, PA_VOLUME_NORM, NULL, NULL); + pa_scache_play_item_by_name(td->u->core, "pulse-hotplug", d->sink_name, PA_VOLUME_NORM, NULL, NULL); } } } @@ -575,13 +575,13 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *message, vo if (d->sink_name) { pa_sink *sink; - if ((sink = pa_namereg_get(u->core, d->sink_name, PA_NAMEREG_SINK, 0))) { + if ((sink = pa_namereg_get(u->core, d->sink_name, PA_NAMEREG_SINK))) { int prev_suspended = pa_sink_get_state(sink) == PA_SINK_SUSPENDED; if (prev_suspended && !suspend) { /* resume */ if (pa_sink_suspend(sink, 0) >= 0) - pa_scache_play_item_by_name(u->core, "pulse-access", d->sink_name, FALSE, PA_VOLUME_NORM, NULL, NULL); + pa_scache_play_item_by_name(u->core, "pulse-access", d->sink_name, PA_VOLUME_NORM, NULL, NULL); else d->acl_race_fix = TRUE; @@ -596,7 +596,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *message, vo if (d->source_name) { pa_source *source; - if ((source = pa_namereg_get(u->core, d->source_name, PA_NAMEREG_SOURCE, 0))) { + if ((source = pa_namereg_get(u->core, d->source_name, PA_NAMEREG_SOURCE))) { int prev_suspended = pa_source_get_state(source) == PA_SOURCE_SUSPENDED; if (prev_suspended && !suspend) { @@ -644,14 +644,14 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *message, vo if (d->sink_name) { pa_sink *sink; - if ((sink = pa_namereg_get(u->core, d->sink_name, PA_NAMEREG_SINK, 0))) { + if ((sink = pa_namereg_get(u->core, d->sink_name, PA_NAMEREG_SINK))) { int prev_suspended = pa_sink_get_state(sink) == PA_SINK_SUSPENDED; if (prev_suspended) { /* resume */ if (pa_sink_suspend(sink, 0) >= 0) - pa_scache_play_item_by_name(u->core, "pulse-access", d->sink_name, FALSE, PA_VOLUME_NORM, NULL, NULL); + pa_scache_play_item_by_name(u->core, "pulse-access", d->sink_name, PA_VOLUME_NORM, NULL, NULL); } } } @@ -659,7 +659,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *message, vo if (d->source_name) { pa_source *source; - if ((source = pa_namereg_get(u->core, d->source_name, PA_NAMEREG_SOURCE, 0))) { + if ((source = pa_namereg_get(u->core, d->source_name, PA_NAMEREG_SOURCE))) { int prev_suspended = pa_source_get_state(source) == PA_SOURCE_SUSPENDED; diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 4209e991..496e9ea5 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -396,7 +396,7 @@ int pa__init(pa_module*m) { goto fail; } - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK, 1))) { + if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) { pa_log("Master sink not found"); goto fail; } diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index 97e97dc7..bbe4f7c0 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -118,7 +118,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event else { pa_sink *s; - if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1))) + if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) pa_log("Failed to get sink '%s'", u->sink_name); else { int i; diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c index 21f176a4..aa6832bf 100644 --- a/src/modules/module-mmkbd-evdev.c +++ b/src/modules/module-mmkbd-evdev.c @@ -109,7 +109,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event if (volchange != INVALID) { pa_sink *s; - if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1))) + if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) pa_log("Failed to get sink '%s'", u->sink_name); else { int i; diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c index ae05f078..aa914066 100644 --- a/src/modules/module-remap-sink.c +++ b/src/modules/module-remap-sink.c @@ -302,7 +302,7 @@ int pa__init(pa_module*m) { goto fail; } - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK, 1))) { + if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) { pa_log("Master sink not found"); goto fail; } diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c index cc6717cb..de07225d 100644 --- a/src/modules/module-rescue-streams.c +++ b/src/modules/module-rescue-streams.c @@ -59,7 +59,7 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user return PA_HOOK_OK; } - if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, 0)) || target == sink) { + if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SINK)) || target == sink) { uint32_t idx; for (target = pa_idxset_first(c->sinks, &idx); target; target = pa_idxset_next(c->sinks, &idx)) @@ -97,7 +97,7 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void return PA_HOOK_OK; } - if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SOURCE, 0)) || target == source) { + if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SOURCE)) || target == source) { uint32_t idx; for (target = pa_idxset_first(c->sources, &idx); target; target = pa_idxset_next(c->sources, &idx)) diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c index 2ea78da2..b0782c3c 100644 --- a/src/modules/module-sine.c +++ b/src/modules/module-sine.c @@ -131,7 +131,7 @@ int pa__init(pa_module*m) { goto fail; } - if (!(sink = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink", NULL), PA_NAMEREG_SINK, TRUE))) { + if (!(sink = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink", NULL), PA_NAMEREG_SINK))) { pa_log("No such sink."); goto fail; } diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c index fdf69a20..dd54a796 100644 --- a/src/modules/module-stream-restore.c +++ b/src/modules/module-stream-restore.c @@ -304,7 +304,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n pa_sink *s; if (u->restore_device && - (s = pa_namereg_get(c, e->device, PA_NAMEREG_SINK, TRUE))) { + (s = pa_namereg_get(c, e->device, PA_NAMEREG_SINK))) { if (!new_data->sink) { pa_log_info("Restoring device for stream %s.", name); @@ -371,7 +371,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou if (u->restore_device && !new_data->direct_on_input && - (s = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE, TRUE))) { + (s = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE))) { if (!new_data->source) { pa_log_info("Restoring device for stream %s.", name); @@ -442,7 +442,7 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) { } if (u->restore_device && - (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE, TRUE))) { + (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) { pa_log_info("Restoring device for stream %s.", name); pa_sink_input_move_to(si, s); @@ -462,7 +462,7 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) { } if (u->restore_device && - (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE, TRUE))) { + (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) { pa_log_info("Restoring device for stream %s.", name); pa_source_output_move_to(so, s); diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c index aac0d046..bdfd3816 100644 --- a/src/modules/module-volume-restore.c +++ b/src/modules/module-volume-restore.c @@ -417,7 +417,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n if ((r = pa_hashmap_get(u->hashmap, name))) { if (!data->sink && r->sink) { - if ((data->sink = pa_namereg_get(c, r->sink, PA_NAMEREG_SINK, 1))) + if ((data->sink = pa_namereg_get(c, r->sink, PA_NAMEREG_SINK))) pa_log_info("Restoring sink for <%s>", r->name); } } @@ -463,7 +463,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou if ((r = pa_hashmap_get(u->hashmap, name))) { if (!data->source && r->source) { - if ((data->source = pa_namereg_get(c, r->source, PA_NAMEREG_SOURCE, 1))) + if ((data->source = pa_namereg_get(c, r->source, PA_NAMEREG_SOURCE))) pa_log_info("Restoring source for <%s>", r->name); } } diff --git a/src/modules/module-x11-bell.c b/src/modules/module-x11-bell.c index e93721c1..bef02536 100644 --- a/src/modules/module-x11-bell.c +++ b/src/modules/module-x11-bell.c @@ -82,7 +82,7 @@ static int x11_event_cb(pa_x11_wrapper *w, XEvent *e, void *userdata) { bne = (XkbBellNotifyEvent*) e; - if (pa_scache_play_item_by_name(u->core, u->scache_item, u->sink_name, TRUE, ((pa_volume_t) bne->percent*PA_VOLUME_NORM)/100U, NULL, NULL) < 0) { + if (pa_scache_play_item_by_name(u->core, u->scache_item, u->sink_name, ((pa_volume_t) bne->percent*PA_VOLUME_NORM)/100U, NULL, NULL) < 0) { pa_log_info("Ringing bell failed, reverting to X11 device bell."); XkbForceDeviceBell(pa_x11_wrapper_get_display(w), bne->device, bne->bell_class, bne->bell_id, bne->percent); } diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c index 478e0a32..00d21255 100644 --- a/src/modules/rtp/module-rtp-recv.c +++ b/src/modules/rtp/module-rtp-recv.c @@ -415,7 +415,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in goto fail; } - if (!(sink = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, TRUE))) { + if (!(sink = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) { pa_log("Sink does not exist."); goto fail; } diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c index 9c0f07f1..a6d682bb 100644 --- a/src/modules/rtp/module-rtp-send.c +++ b/src/modules/rtp/module-rtp-send.c @@ -196,7 +196,7 @@ int pa__init(pa_module*m) { goto fail; } - if (!(s = pa_namereg_get(m->core, pa_modargs_get_value(ma, "source", NULL), PA_NAMEREG_SOURCE, 1))) { + if (!(s = pa_namereg_get(m->core, pa_modargs_get_value(ma, "source", NULL), PA_NAMEREG_SOURCE))) { pa_log("Source does not exist."); goto fail; } diff --git a/src/pulse/def.h b/src/pulse/def.h index 03e8416e..9e424d46 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -356,6 +356,7 @@ enum { PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */ PA_ERR_UNKNOWN, /**< The error code was unknown to the client */ PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */ + PA_ERR_OBSOLETE, /**< Obsolete functionality. \since 0.9.15 */ PA_ERR_MAX /**< Not really an error but the first invalid error code */ }; @@ -388,13 +389,15 @@ typedef enum pa_subscription_mask { PA_SUBSCRIPTION_MASK_SERVER = 0x0080U, /**< Other global server changes. */ +/** \cond fulldocs */ PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U, - /**< Autoload table events. */ + /**< \deprecated Autoload table events. */ +/** \endcond */ PA_SUBSCRIPTION_MASK_CARD = 0x0200U, /**< Card events. \since 0.9.15 */ - PA_SUBSCRIPTION_MASK_ALL = 0x03ffU + PA_SUBSCRIPTION_MASK_ALL = 0x02ffU /**< Catch all events */ } pa_subscription_mask_t; @@ -424,8 +427,10 @@ typedef enum pa_subscription_event_type { PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U, /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */ +/** \cond fulldocs */ PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U, - /**< Event type: Autoload table changes. */ + /**< \deprecated Event type: Autoload table changes. */ +/** \endcond */ PA_SUBSCRIPTION_EVENT_CARD = 0x0009U, /**< Event type: Card \since 0.9.15 */ diff --git a/src/pulse/internal.h b/src/pulse/internal.h index 5fe4210e..9a2d6457 100644 --- a/src/pulse/internal.h +++ b/src/pulse/internal.h @@ -225,20 +225,37 @@ void pa_stream_set_state(pa_stream *s, pa_stream_state_t st); pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *tag); -#define PA_CHECK_VALIDITY(context, expression, error) do { \ - if (!(expression)) \ +#define PA_CHECK_VALIDITY(context, expression, error) \ + do { \ + if (!(expression)) \ return -pa_context_set_error((context), (error)); \ -} while(0) + } while(FALSE) -#define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) do { \ - if (!(expression)) { \ - pa_context_set_error((context), (error)); \ - return value; \ - } \ -} while(0) +#define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) \ + do { \ + if (!(expression)) { \ + pa_context_set_error((context), (error)); \ + return value; \ + } \ + } while(FALSE) -#define PA_CHECK_VALIDITY_RETURN_NULL(context, expression, error) PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, NULL) +#define PA_CHECK_VALIDITY_RETURN_NULL(context, expression, error) \ + PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, NULL) + +#define PA_FAIL(context, error) \ + do { \ + return -pa_context_set_error((context), (error)); \ + } while(FALSE) + +#define PA_FAIL_RETURN_ANY(context, error, value) \ + do { \ + pa_context_set_error((context), (error)); \ + return value; \ + } while(FALSE) + +#define PA_FAIL_RETURN_NULL(context, error) \ + PA_FAIL_RETURN_ANY(context, error, NULL) void pa_ext_stream_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t); diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c index 8056a5a1..bdc50e29 100644 --- a/src/pulse/introspect.c +++ b/src/pulse/introspect.c @@ -1167,186 +1167,59 @@ pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_s /*** Autoload stuff ***/ -static void context_get_autoload_info_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_operation *o = userdata; - int eol = 1; - - pa_assert(pd); - pa_assert(o); - pa_assert(PA_REFCNT_VALUE(o) >= 1); - - if (!o->context) - goto finish; - - if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) - goto finish; - - eol = -1; - } else { - - while (!pa_tagstruct_eof(t)) { - pa_autoload_info i; - - memset(&i, 0, sizeof(i)); - - if (pa_tagstruct_getu32(t, &i.index) < 0 || - pa_tagstruct_gets(t, &i.name) < 0 || - pa_tagstruct_getu32(t, &i.type) < 0 || - pa_tagstruct_gets(t, &i.module) < 0 || - pa_tagstruct_gets(t, &i.argument) < 0) { - pa_context_fail(o->context, PA_ERR_PROTOCOL); - goto finish; - } - - if (o->callback) { - pa_autoload_info_cb_t cb = (pa_autoload_info_cb_t) o->callback; - cb(o->context, &i, 0, o->userdata); - } - } - } - - if (o->callback) { - pa_autoload_info_cb_t cb = (pa_autoload_info_cb_t) o->callback; - cb(o->context, NULL, eol, o->userdata); - } - -finish: - pa_operation_done(o); - pa_operation_unref(o); -} - -PA_WARN_REFERENCE(pa_context_get_autoload_info_by_name, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_get_autoload_info_by_name, "Module auto-loading no longer supported."); pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_autoload_info_cb_t cb, void *userdata) { - pa_tagstruct *t; - pa_operation *o; - uint32_t tag; pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); - pa_assert(cb); - - PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); - PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); - PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID); - - o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata); - t = pa_tagstruct_command(c, PA_COMMAND_GET_AUTOLOAD_INFO, &tag); - pa_tagstruct_puts(t, name); - pa_tagstruct_putu32(t, type); - pa_pstream_send_tagstruct(c->pstream, t); - pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - - return o; + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } -PA_WARN_REFERENCE(pa_context_get_autoload_info_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_get_autoload_info_by_index, "Module auto-loading no longer supported."); pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata) { - pa_tagstruct *t; - pa_operation *o; - uint32_t tag; - pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); - pa_assert(cb); - - PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); - PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID); - - o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata); - t = pa_tagstruct_command(c, PA_COMMAND_GET_AUTOLOAD_INFO, &tag); - pa_tagstruct_putu32(t, idx); - pa_pstream_send_tagstruct(c->pstream, t); - pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - - return o; + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } - -PA_WARN_REFERENCE(pa_context_get_autoload_info_list, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_get_autoload_info_list, "Module auto-loading no longer supported."); pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) { - return pa_context_send_simple_command(c, PA_COMMAND_GET_AUTOLOAD_INFO_LIST, context_get_autoload_info_callback, (pa_operation_cb_t) cb, userdata); + pa_assert(c); + pa_assert(PA_REFCNT_VALUE(c) >= 1); + + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } -PA_WARN_REFERENCE(pa_context_add_autoload, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_add_autoload, "Module auto-loading no longer supported."); pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autoload_type_t type, const char *module, const char*argument, pa_context_index_cb_t cb, void* userdata) { - pa_operation *o; - pa_tagstruct *t; - uint32_t tag; - pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); - PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); - PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); - PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID); - PA_CHECK_VALIDITY_RETURN_NULL(c, module && *module, PA_ERR_INVALID); - - o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata); - - t = pa_tagstruct_command(c, PA_COMMAND_ADD_AUTOLOAD, &tag); - pa_tagstruct_puts(t, name); - pa_tagstruct_putu32(t, type); - pa_tagstruct_puts(t, module); - pa_tagstruct_puts(t, argument); - pa_pstream_send_tagstruct(c->pstream, t); - pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - - return o; + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } -PA_WARN_REFERENCE(pa_context_remove_autoload_by_name, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_remove_autoload_by_name, "Module auto-loading no longer supported."); pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_context_success_cb_t cb, void* userdata) { - pa_operation *o; - pa_tagstruct *t; - uint32_t tag; - pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); - PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); - PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); - PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID); - - o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata); - - t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_AUTOLOAD, &tag); - pa_tagstruct_puts(t, name); - pa_tagstruct_putu32(t, type); - pa_pstream_send_tagstruct(c->pstream, t); - pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - - return o; + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } -PA_WARN_REFERENCE(pa_context_remove_autoload_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server."); +PA_WARN_REFERENCE(pa_context_remove_autoload_by_index, "Module auto-loading no longer supported."); pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) { - pa_operation *o; - pa_tagstruct *t; - uint32_t tag; - pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); - PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); - PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID); - - o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata); - - t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_AUTOLOAD, &tag); - pa_tagstruct_putu32(t, idx); - pa_pstream_send_tagstruct(c->pstream, t); - pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - - return o; + PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE); } pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, const char *sink_name, pa_context_success_cb_t cb, void* userdata) { diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h index b409cadb..ae9bd5bc 100644 --- a/src/pulse/introspect.h +++ b/src/pulse/introspect.h @@ -128,18 +128,6 @@ * pa_context_get_module_info() or pa_context_get_module_info_list(). The * information structure is called pa_module_info. * - * \subsection autoload_subsec Autoload Entries - * - * Modules can be autoloaded as a result of a client requesting a - * certain sink or source. Please note that autoloading is deprecated - * in 0.9.11. and is likely to be removed from the API in a later - * version. This mapping between sink/source names and modules can be - * queried from the server: - * - * \li By index - pa_context_get_autoload_info_by_index() - * \li By sink/source name - pa_context_get_autoload_info_by_name() - * \li All - pa_context_get_autoload_info_list() - * * \subsection client_subsec Clients * * PulseAudio clients are also identified by index and are retrieved using @@ -189,14 +177,6 @@ * Server modules can be remotely loaded and unloaded using * pa_context_load_module() and pa_context_unload_module(). * - * \subsection autoload_subsec Autoload Entries - * - * New module autoloading rules can be added, and existing can be removed - * using pa_context_add_autoload() and pa_context_remove_autoload_by_index() - * / pa_context_remove_autoload_by_name(). Please note that autoloading is deprecated - * in 0.9.11. and is likely to be removed from the API in a later - * version. - * * \subsection client_subsec Clients * * The only operation supported on clients, is the possibility of kicking @@ -350,7 +330,9 @@ typedef struct pa_module_info { const char*name, /**< Name of the module */ *argument; /**< Argument string of the module */ uint32_t n_used; /**< Usage counter or PA_INVALID_INDEX */ - int auto_unload; /**< Non-zero if this is an autoloaded module */ +/** \cond fulldocs */ + int auto_unload; /**< \deprecated Non-zero if this is an autoloaded module */ +/** \endcond */ } pa_module_info; /** Callback prototype for pa_context_get_module_info() and firends*/ @@ -551,13 +533,13 @@ pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t /** @{ \name Autoload Entries */ -/** Type of an autoload entry. */ +/** \deprecated Type of an autoload entry. */ typedef enum pa_autoload_type { PA_AUTOLOAD_SINK = 0, PA_AUTOLOAD_SOURCE = 1 } pa_autoload_type_t; -/** Stores information about autoload entries. Please note that this structure +/** \deprecated Stores information about autoload entries. Please note that this structure * can be extended as part of evolutionary API updates at any time in * any new release. */ typedef struct pa_autoload_info { @@ -568,25 +550,25 @@ typedef struct pa_autoload_info { const char *argument; /**< Argument string for module */ } pa_autoload_info; -/** Callback prototype for pa_context_get_autoload_info_by_name() and firends */ +/** \deprecated Callback prototype for pa_context_get_autoload_info_by_name() and firends */ typedef void (*pa_autoload_info_cb_t)(pa_context *c, const pa_autoload_info *i, int eol, void *userdata); -/** Get info about a specific autoload entry. */ +/** \deprecated Get info about a specific autoload entry. */ pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED; -/** Get info about a specific autoload entry. */ +/** \deprecated Get info about a specific autoload entry. */ pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED; -/** Get the complete list of autoload entries. */ +/** \deprecated Get the complete list of autoload entries. */ pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED; -/** Add a new autoload entry. */ +/** \deprecated Add a new autoload entry. */ pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autoload_type_t type, const char *module, const char*argument, pa_context_index_cb_t, void* userdata) PA_GCC_DEPRECATED; -/** Remove an autoload entry. */ +/** \deprecated Remove an autoload entry. */ pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED; -/** Remove an autoload entry. */ +/** \deprecated Remove an autoload entry. */ pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED; /** @} */ diff --git a/src/pulsecore/autoload.c b/src/pulsecore/autoload.c deleted file mode 100644 index 8c84cee5..00000000 --- a/src/pulsecore/autoload.c +++ /dev/null @@ -1,202 +0,0 @@ -/*** - This file is part of PulseAudio. - - Copyright 2004-2006 Lennart Poettering - Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB - - PulseAudio is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - PulseAudio is distributed in the hope that it will be useful, but - 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. - - You should have received a copy of the GNU Lesser General Public License - along with PulseAudio; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> - -#include <pulse/xmalloc.h> - -#include <pulsecore/module.h> -#include <pulsecore/memchunk.h> -#include <pulsecore/sound-file.h> -#include <pulsecore/log.h> -#include <pulsecore/macro.h> -#include <pulsecore/core-scache.h> -#include <pulsecore/core-subscribe.h> - -#include "autoload.h" - -static void entry_free(pa_autoload_entry *e) { - pa_assert(e); - pa_subscription_post(e->core, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_REMOVE, PA_INVALID_INDEX); - pa_xfree(e->name); - pa_xfree(e->module); - pa_xfree(e->argument); - pa_xfree(e); -} - -static void entry_remove_and_free(pa_autoload_entry *e) { - pa_assert(e); - pa_assert(e->core); - - pa_idxset_remove_by_data(e->core->autoload_idxset, e, NULL); - pa_hashmap_remove(e->core->autoload_hashmap, e->name); - entry_free(e); -} - -static pa_autoload_entry* entry_new(pa_core *c, const char *name) { - pa_autoload_entry *e = NULL; - - pa_core_assert_ref(c); - pa_assert(name); - - if (c->autoload_hashmap && (e = pa_hashmap_get(c->autoload_hashmap, name))) - return NULL; - - e = pa_xnew(pa_autoload_entry, 1); - e->core = c; - e->name = pa_xstrdup(name); - e->module = e->argument = NULL; - e->in_action = 0; - - if (!c->autoload_hashmap) - c->autoload_hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); - pa_assert(c->autoload_hashmap); - - pa_hashmap_put(c->autoload_hashmap, e->name, e); - - if (!c->autoload_idxset) - c->autoload_idxset = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); - pa_idxset_put(c->autoload_idxset, e, &e->index); - - pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_NEW, e->index); - - return e; -} - -int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx) { - pa_autoload_entry *e = NULL; - - pa_assert(c); - pa_assert(name); - pa_assert(module); - pa_assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE); - - if (!(e = entry_new(c, name))) - return -1; - - e->module = pa_xstrdup(module); - e->argument = pa_xstrdup(argument); - e->type = type; - - if (idx) - *idx = e->index; - - return 0; -} - -int pa_autoload_remove_by_name(pa_core *c, const char*name, pa_namereg_type_t type) { - pa_autoload_entry *e; - - pa_assert(c); - pa_assert(name); - pa_assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE); - - if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type) - return -1; - - entry_remove_and_free(e); - return 0; -} - -int pa_autoload_remove_by_index(pa_core *c, uint32_t idx) { - pa_autoload_entry *e; - - pa_assert(c); - pa_assert(idx != PA_IDXSET_INVALID); - - if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx))) - return -1; - - entry_remove_and_free(e); - return 0; -} - -void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type) { - pa_autoload_entry *e; - pa_module *m; - - pa_assert(c); - pa_assert(name); - - if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || (e->type != type)) - return; - - if (e->in_action) - return; - - e->in_action = 1; - - if (type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE) { - if ((m = pa_module_load(c, e->module, e->argument))) - m->auto_unload = 1; - } - - e->in_action = 0; -} - -static void free_func(void *p, void *userdata) { - pa_autoload_entry *e = p; - pa_idxset_remove_by_data(e->core->autoload_idxset, e, NULL); - entry_free(e); -} - -void pa_autoload_free(pa_core *c) { - - if (c->autoload_hashmap) { - pa_hashmap_free(c->autoload_hashmap, free_func, NULL); - c->autoload_hashmap = NULL; - } - - if (c->autoload_idxset) { - pa_idxset_free(c->autoload_idxset, NULL, NULL); - c->autoload_idxset = NULL; - } -} - -const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type) { - pa_autoload_entry *e; - - pa_core_assert_ref(c); - pa_assert(name); - - if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type) - return NULL; - - return e; -} - -const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx) { - pa_autoload_entry *e; - - pa_core_assert_ref(c); - pa_assert(idx != PA_IDXSET_INVALID); - - if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx))) - return NULL; - - return e; -} diff --git a/src/pulsecore/autoload.h b/src/pulsecore/autoload.h deleted file mode 100644 index 3926351f..00000000 --- a/src/pulsecore/autoload.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef fooautoloadhfoo -#define fooautoloadhfoo - -/*** - This file is part of PulseAudio. - - Copyright 2004-2006 Lennart Poettering - - PulseAudio is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - PulseAudio is distributed in the hope that it will be useful, but - 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. - - You should have received a copy of the GNU Lesser General Public License - along with PulseAudio; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#include <pulsecore/namereg.h> - -/* Using the autoloading facility, modules by be loaded on-demand and - * synchronously. The user may register a "ghost sink" or "ghost - * source". Whenever this sink/source is requested but not available a - * specified module is loaded. */ - -/* An autoload entry, or "ghost" sink/source */ -typedef struct pa_autoload_entry { - pa_core *core; - uint32_t index; - char *name; - pa_namereg_type_t type; /* Type of the autoload entry */ - int in_action; /* The module is currently being loaded */ - char *module, *argument; -} pa_autoload_entry; - -/* Add a new autoload entry of the given time, with the speicified - * sink/source name, module name and argument. Return the entry's - * index in *index */ -int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx); - -/* Free all autoload entries */ -void pa_autoload_free(pa_core *c); -int pa_autoload_remove_by_name(pa_core *c, const char*name, pa_namereg_type_t type); -int pa_autoload_remove_by_index(pa_core *c, uint32_t idx); - -/* Request an autoload entry by its name, effectively causing a module to be loaded */ -void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type); - -const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type); -const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx); - -#endif diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 93d6bbe6..8f5d9bdd 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -47,7 +47,6 @@ #include <pulsecore/sample-util.h> #include <pulsecore/sound-file.h> #include <pulsecore/play-memchunk.h> -#include <pulsecore/autoload.h> #include <pulsecore/sound-file-stream.h> #include <pulsecore/shared.h> #include <pulsecore/core-util.h> @@ -107,9 +106,6 @@ static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *bu static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); @@ -168,11 +164,6 @@ static const struct command commands[] = { { "load-sample-lazy", pa_cli_command_scache_load, "Lazily load a sound file into the sample cache (args: name, filename)", 3}, { "load-sample-dir-lazy", pa_cli_command_scache_load_dir, "Lazily load all files in a directory into the sample cache (args: pathname)", 2}, { "play-file", pa_cli_command_play_file, "Play a sound file (args: filename, sink|index)", 3}, - { "list-autoload", pa_cli_command_autoload_list, "List autoload entries", 1}, - { "add-autoload-sink", pa_cli_command_autoload_add, NULL /*"Add autoload entry for a sink (args: sink, module name, arguments)"*/, 4}, - { "add-autoload-source", pa_cli_command_autoload_add, NULL /*"Add autoload entry for a source (args: source, module name, arguments)"*/, 4}, - { "remove-autoload-sink", pa_cli_command_autoload_remove, NULL /*"Remove autoload entry for a sink (args: name)"*/, 2}, - { "remove-autoload-source", pa_cli_command_autoload_remove, NULL /*"Remove autoload entry for a source (args: name)"*/, 2}, { "dump", pa_cli_command_dump, "Dump daemon configuration", 1}, { "shared", pa_cli_command_list_shared_props, NULL, 1}, { "move-sink-input", pa_cli_command_move_sink_input, "Move sink input to another sink (args: index, sink)", 3}, @@ -402,7 +393,6 @@ static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b pa_cli_command_sink_inputs(c, t, buf, fail); pa_cli_command_source_outputs(c, t, buf, fail); pa_cli_command_scache_list(c, t, buf, fail); -/* pa_cli_command_autoload_list(c, t, buf, fail); */ return 0; } @@ -519,7 +509,7 @@ static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -597,7 +587,7 @@ static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf * return -1; } - if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE))) { pa_strbuf_puts(buf, "No source found by this name or index.\n"); return -1; } @@ -632,7 +622,7 @@ static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return -1; } - if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -666,7 +656,7 @@ static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -695,7 +685,7 @@ static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_s return -1; } - if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -729,7 +719,7 @@ static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa return -1; } - if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE))) { pa_strbuf_puts(buf, "No source found by this name or index.\n"); return -1; } @@ -1014,7 +1004,7 @@ static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink by that name.\n"); return -1; } @@ -1110,7 +1100,7 @@ static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return -1; } - if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink by that name.\n"); return -1; } @@ -1119,66 +1109,6 @@ static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return pa_play_file(sink, fname, NULL); } -static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { - const char *a, *b; - - pa_core_assert_ref(c); - pa_assert(t); - pa_assert(buf); - pa_assert(fail); - - pa_log_warn("Autoload will no longer be implemented by future versions of the PulseAudio server."); - - if (!(a = pa_tokenizer_get(t, 1)) || !(b = pa_tokenizer_get(t, 2))) { - pa_strbuf_puts(buf, "You need to specify a device name, a filename or a module name and optionally module arguments\n"); - return -1; - } - - pa_autoload_add(c, a, strstr(pa_tokenizer_get(t, 0), "sink") ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE, b, pa_tokenizer_get(t, 3), NULL); - - return 0; -} - -static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { - const char *name; - - pa_core_assert_ref(c); - pa_assert(t); - pa_assert(buf); - pa_assert(fail); - - pa_log_warn("Autoload will no longer be implemented by future versions of the PulseAudio server."); - - if (!(name = pa_tokenizer_get(t, 1))) { - pa_strbuf_puts(buf, "You need to specify a device name\n"); - return -1; - } - - if (pa_autoload_remove_by_name(c, name, strstr(pa_tokenizer_get(t, 0), "sink") ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE) < 0) { - pa_strbuf_puts(buf, "Failed to remove autload entry\n"); - return -1; - } - - return 0; -} - -static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { - char *s; - - pa_core_assert_ref(c); - pa_assert(t); - pa_assert(buf); - pa_assert(fail); - - pa_log_warn("Autoload will no longer be implemented by future versions of the PulseAudio server."); - - pa_assert_se(s = pa_autoload_list_to_string(c)); - pa_strbuf_puts(buf, s); - pa_xfree(s); - - return 0; -} - static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { pa_core_assert_ref(c); pa_assert(t); @@ -1231,7 +1161,7 @@ static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf return -1; } - if (!(sink = pa_namereg_get(c, k, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, k, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -1274,7 +1204,7 @@ static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_str return -1; } - if (!(source = pa_namereg_get(c, k, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c, k, PA_NAMEREG_SOURCE))) { pa_strbuf_puts(buf, "No source found by this name or index.\n"); return -1; } @@ -1311,7 +1241,7 @@ static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *b return -1; } - if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK))) { pa_strbuf_puts(buf, "No sink found by this name or index.\n"); return -1; } @@ -1345,7 +1275,7 @@ static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf return -1; } - if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c, n, PA_NAMEREG_SOURCE))) { pa_strbuf_puts(buf, "No source found by this name or index.\n"); return -1; } @@ -1489,8 +1419,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b uint32_t idx; char txt[256]; time_t now; - void *i; - pa_autoload_entry *a; pa_core_assert_ref(c); pa_assert(t); @@ -1506,8 +1434,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b #endif for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) { - if (m->auto_unload) - continue; pa_strbuf_printf(buf, "load-module %s", m->name); @@ -1520,8 +1446,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b nl = 0; for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) { - if (sink->module && sink->module->auto_unload) - continue; if (!nl) { pa_strbuf_puts(buf, "\n"); @@ -1534,8 +1458,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b } for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) { - if (source->module && source->module->auto_unload) - continue; if (!nl) { pa_strbuf_puts(buf, "\n"); @@ -1548,26 +1470,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b } - if (c->autoload_hashmap) { - nl = 0; - - i = NULL; - while ((a = pa_hashmap_iterate(c->autoload_hashmap, &i, NULL))) { - - if (!nl) { - pa_strbuf_puts(buf, "\n"); - nl = 1; - } - - pa_strbuf_printf(buf, "add-autoload-%s %s %s", a->type == PA_NAMEREG_SINK ? "sink" : "source", a->name, a->module); - - if (a->argument) - pa_strbuf_printf(buf, " %s", a->argument); - - pa_strbuf_puts(buf, "\n"); - } - } - nl = 0; if ((p = pa_namereg_get_default_sink_name(c))) { diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index 5d78ce64..27db56e5 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -38,7 +38,6 @@ #include <pulsecore/strbuf.h> #include <pulsecore/sample-util.h> #include <pulsecore/core-scache.h> -#include <pulsecore/autoload.h> #include <pulsecore/macro.h> #include <pulsecore/core-util.h> @@ -59,9 +58,12 @@ char *pa_module_list_to_string(pa_core *c) { "\tname: <%s>\n" "\targument: <%s>\n" "\tused: %i\n" - "\tauto unload: %s\n", - m->index, m->name, m->argument ? m->argument : "", m->n_used, - pa_yes_no(m->auto_unload)); + "\tload once: %s\n", + m->index, + m->name, + pa_strempty(m->argument), + m->n_used, + pa_yes_no(m->load_once)); } return pa_strbuf_tostring_free(s); @@ -506,45 +508,13 @@ char *pa_scache_list_to_string(pa_core *c) { return pa_strbuf_tostring_free(s); } -char *pa_autoload_list_to_string(pa_core *c) { - pa_strbuf *s; - pa_assert(c); - - s = pa_strbuf_new(); - - pa_strbuf_printf(s, "%u autoload entries available.\n", c->autoload_hashmap ? pa_hashmap_size(c->autoload_hashmap) : 0); - - if (c->autoload_hashmap) { - pa_autoload_entry *e; - void *state = NULL; - - while ((e = pa_hashmap_iterate(c->autoload_hashmap, &state, NULL))) { - pa_strbuf_printf( - s, - " name: <%s>\n" - "\ttype: %s\n" - "\tindex: %u\n" - "\tmodule_name: <%s>\n" - "\targuments: <%s>\n", - e->name, - e->type == PA_NAMEREG_SOURCE ? "source" : "sink", - e->index, - e->module, - e->argument ? e->argument : ""); - - } - } - - return pa_strbuf_tostring_free(s); -} - char *pa_full_status_string(pa_core *c) { pa_strbuf *s; int i; s = pa_strbuf_new(); - for (i = 0; i < 9; i++) { + for (i = 0; i < 8; i++) { char *t = NULL; switch (i) { @@ -572,9 +542,6 @@ char *pa_full_status_string(pa_core *c) { case 7: t = pa_scache_list_to_string(c); break; - case 8: - t = pa_autoload_list_to_string(c); - break; } pa_strbuf_puts(s, t); diff --git a/src/pulsecore/cli-text.h b/src/pulsecore/cli-text.h index 167565e5..aad51648 100644 --- a/src/pulsecore/cli-text.h +++ b/src/pulsecore/cli-text.h @@ -35,7 +35,6 @@ char *pa_card_list_to_string(pa_core *c); char *pa_client_list_to_string(pa_core *c); char *pa_module_list_to_string(pa_core *c); char *pa_scache_list_to_string(pa_core *c); -char *pa_autoload_list_to_string(pa_core *c); char *pa_full_status_string(pa_core *c); diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c index 1d080e11..0f34c9d1 100644 --- a/src/pulsecore/core-scache.c +++ b/src/pulsecore/core-scache.c @@ -98,7 +98,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { pa_assert(c); pa_assert(name); - if ((e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE))) { + if ((e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE))) { if (e->memchunk.memblock) pa_memblock_unref(e->memchunk.memblock); @@ -273,7 +273,7 @@ int pa_scache_remove_item(pa_core *c, const char *name) { pa_assert(c); pa_assert(name); - if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 0))) + if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE))) return -1; pa_assert_se(pa_idxset_remove_by_data(c->scache, e, NULL) == e); @@ -313,7 +313,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t pa_assert(name); pa_assert(sink); - if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE))) + if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE))) return -1; if (e->lazy && !e->memchunk.memblock) { @@ -360,13 +360,13 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t return 0; } -int pa_scache_play_item_by_name(pa_core *c, const char *name, const char*sink_name, pa_bool_t autoload, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx) { +int pa_scache_play_item_by_name(pa_core *c, const char *name, const char*sink_name, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx) { pa_sink *sink; pa_assert(c); pa_assert(name); - if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK, autoload))) + if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK))) return -1; return pa_scache_play_item(c, name, sink, volume, p, sink_input_idx); @@ -390,7 +390,7 @@ uint32_t pa_scache_get_id_by_name(pa_core *c, const char *name) { pa_assert(c); pa_assert(name); - if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE))) + if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE))) return PA_IDXSET_INVALID; return e->index; diff --git a/src/pulsecore/core-scache.h b/src/pulsecore/core-scache.h index 80e0fd04..ba65a964 100644 --- a/src/pulsecore/core-scache.h +++ b/src/pulsecore/core-scache.h @@ -56,7 +56,7 @@ int pa_scache_add_directory_lazy(pa_core *c, const char *pathname); int pa_scache_remove_item(pa_core *c, const char *name); int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx); -int pa_scache_play_item_by_name(pa_core *c, const char *name, const char*sink_name, pa_bool_t autoload, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx); +int pa_scache_play_item_by_name(pa_core *c, const char *name, const char*sink_name, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx); void pa_scache_free(pa_core *c); const char *pa_scache_get_name_by_id(pa_core *c, uint32_t id); diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 20764325..0b78bc40 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -37,7 +37,6 @@ #include <pulsecore/namereg.h> #include <pulsecore/core-util.h> #include <pulsecore/core-scache.h> -#include <pulsecore/autoload.h> #include <pulsecore/core-subscribe.h> #include <pulsecore/shared.h> #include <pulsecore/random.h> @@ -104,8 +103,6 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->modules = NULL; c->namereg = NULL; c->scache = NULL; - c->autoload_idxset = NULL; - c->autoload_hashmap = NULL; c->running_as_daemon = FALSE; c->default_sample_spec.format = PA_SAMPLE_S16NE; @@ -114,7 +111,6 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->default_n_fragments = 4; c->default_fragment_size_msec = 25; - c->module_auto_unload_event = NULL; c->module_defer_unload_event = NULL; c->scache_auto_unload_event = NULL; @@ -129,7 +125,6 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->exit_event = NULL; c->exit_idle_time = -1; - c->module_idle_time = 20; c->scache_idle_time = 20; c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3; @@ -185,7 +180,6 @@ static void core_free(pa_object *o) { pa_scache_free(c); pa_namereg_free(c); - pa_autoload_free(c); pa_subscription_free_all(c); if (c->exit_event) diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index 87ea4ab6..9f463d67 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -99,10 +99,10 @@ struct pa_core { pa_mainloop_api *mainloop; /* idxset of all kinds of entities */ - pa_idxset *clients, *cards, *sinks, *sources, *sink_inputs, *source_outputs, *modules, *scache, *autoload_idxset; + pa_idxset *clients, *cards, *sinks, *sources, *sink_inputs, *source_outputs, *modules, *scache; /* Some hashmaps for all sorts of entities */ - pa_hashmap *namereg, *autoload_hashmap, *shared; + pa_hashmap *namereg, *shared; /* The name of the default sink/source */ char *default_source_name, *default_sink_name; @@ -110,7 +110,6 @@ struct pa_core { pa_sample_spec default_sample_spec; unsigned default_n_fragments, default_fragment_size_msec; - pa_time_event *module_auto_unload_event; pa_defer_event *module_defer_unload_event; pa_defer_event *subscription_defer_event; @@ -121,7 +120,7 @@ struct pa_core { pa_mempool *mempool; pa_silence_cache silence_cache; - int exit_idle_time, module_idle_time, scache_idle_time; + int exit_idle_time, scache_idle_time; pa_time_event *exit_event; diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c index 56ed2c5d..b197ba06 100644 --- a/src/pulsecore/module.c +++ b/src/pulsecore/module.c @@ -48,21 +48,6 @@ #define UNLOAD_POLL_TIME 2 -static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, const struct timeval *tv, void *userdata) { - pa_core *c = PA_CORE(userdata); - struct timeval ntv; - - pa_core_assert_ref(c); - pa_assert(c->mainloop == m); - pa_assert(c->module_auto_unload_event == e); - - pa_module_unload_unused(c); - - pa_gettimeofday(&ntv); - pa_timeval_add(&ntv, UNLOAD_POLL_TIME*PA_USEC_PER_SEC); - m->time_restart(e, &ntv); -} - pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { pa_module *m = NULL; pa_bool_t (*load_once)(void); @@ -110,7 +95,6 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { m->userdata = NULL; m->core = c; m->n_used = -1; - m->auto_unload = FALSE; m->unload_requested = FALSE; if (m->init(m) < 0) { @@ -121,13 +105,6 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { if (!c->modules) c->modules = pa_idxset_new(NULL, NULL); - if (m->auto_unload && !c->module_auto_unload_event) { - struct timeval ntv; - pa_gettimeofday(&ntv); - pa_timeval_add(&ntv, UNLOAD_POLL_TIME*PA_USEC_PER_SEC); - c->module_auto_unload_event = c->mainloop->time_new(c->mainloop, &ntv, timeout_callback, c); - } - pa_assert_se(pa_idxset_put(c->modules, m, &m->index) >= 0); pa_assert(m->index != PA_IDXSET_INVALID); @@ -212,44 +189,12 @@ void pa_module_unload_all(pa_core *c) { c->modules = NULL; } - if (c->module_auto_unload_event) { - c->mainloop->time_free(c->module_auto_unload_event); - c->module_auto_unload_event = NULL; - } - if (c->module_defer_unload_event) { c->mainloop->defer_free(c->module_defer_unload_event); c->module_defer_unload_event = NULL; } } -void pa_module_unload_unused(pa_core *c) { - void *state = NULL; - time_t now; - pa_module *m; - - pa_assert(c); - - if (!c->modules) - return; - - time(&now); - - while ((m = pa_idxset_iterate(c->modules, &state, NULL))) { - - if (m->n_used > 0) - continue; - - if (!m->auto_unload) - continue; - - if (m->last_used_time + m->core->module_idle_time > now) - continue; - - pa_module_unload(c, m, FALSE); - } -} - static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdata) { void *state = NULL; pa_core *c = PA_CORE(userdata); @@ -296,9 +241,6 @@ void pa_module_set_used(pa_module*m, int used) { if (m->n_used != used) pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_CHANGE, m->index); - if (used == 0 && m->n_used > 0) - time(&m->last_used_time); - m->n_used = used; } diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h index 661b2dd6..c54169bf 100644 --- a/src/pulsecore/module.h +++ b/src/pulsecore/module.h @@ -44,11 +44,8 @@ struct pa_module { int n_used; - pa_bool_t auto_unload:1; pa_bool_t load_once:1; pa_bool_t unload_requested:1; - - time_t last_used_time; }; pa_module* pa_module_load(pa_core *c, const char *name, const char*argument); @@ -60,7 +57,6 @@ void pa_module_unload_request(pa_module *m, pa_bool_t force); void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force); void pa_module_unload_all(pa_core *c); -void pa_module_unload_unused(pa_core *c); void pa_module_set_used(pa_module*m, int used); diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c index c1a434ae..3b9ce886 100644 --- a/src/pulsecore/namereg.c +++ b/src/pulsecore/namereg.c @@ -178,7 +178,7 @@ void pa_namereg_unregister(pa_core *c, const char *name) { pa_xfree(e); } -void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, pa_bool_t autoload) { +void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type) { struct namereg_entry *e; uint32_t idx; pa_assert(c); @@ -202,7 +202,7 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, pa_bo if (type == PA_NAMEREG_SOURCE) { pa_sink *k; - if ((k = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, autoload))) + if ((k = pa_namereg_get(c, NULL, PA_NAMEREG_SINK))) return k->monitor_source; } } else if (*name == '@') @@ -215,18 +215,8 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, pa_bo if (e->type == type) return e->data; - if (pa_atou(name, &idx) < 0) { - - if (autoload) { - pa_autoload_request(c, name, type); - - if (c->namereg && (e = pa_hashmap_get(c->namereg, name))) - if (e->type == type) - return e->data; - } - + if (pa_atou(name, &idx) < 0) return NULL; - } if (type == PA_NAMEREG_SINK) return pa_idxset_get_by_index(c->sinks, idx); diff --git a/src/pulsecore/namereg.h b/src/pulsecore/namereg.h index 8ce548a7..4205f2f9 100644 --- a/src/pulsecore/namereg.h +++ b/src/pulsecore/namereg.h @@ -38,7 +38,7 @@ void pa_namereg_free(pa_core *c); const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, pa_bool_t fail); void pa_namereg_unregister(pa_core *c, const char *name); -void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, pa_bool_t autoload); +void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type); int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type); const char *pa_namereg_get_default_sink_name(pa_core *c); diff --git a/src/pulsecore/native-common.h b/src/pulsecore/native-common.h index 8138b7a4..11643a72 100644 --- a/src/pulsecore/native-common.h +++ b/src/pulsecore/native-common.h @@ -94,10 +94,11 @@ enum { PA_COMMAND_LOAD_MODULE, PA_COMMAND_UNLOAD_MODULE, - PA_COMMAND_ADD_AUTOLOAD, - PA_COMMAND_REMOVE_AUTOLOAD, - PA_COMMAND_GET_AUTOLOAD_INFO, - PA_COMMAND_GET_AUTOLOAD_INFO_LIST, + /* Obsolete */ + PA_COMMAND_ADD_AUTOLOAD___OBSOLETE, + PA_COMMAND_REMOVE_AUTOLOAD___OBSOLETE, + PA_COMMAND_GET_AUTOLOAD_INFO___OBSOLETE, + PA_COMMAND_GET_AUTOLOAD_INFO_LIST___OBSOLETE, PA_COMMAND_GET_RECORD_LATENCY, PA_COMMAND_CORK_RECORD_STREAM, diff --git a/src/pulsecore/pdispatch.c b/src/pulsecore/pdispatch.c index a5b33d62..305941a3 100644 --- a/src/pulsecore/pdispatch.c +++ b/src/pulsecore/pdispatch.c @@ -110,10 +110,10 @@ static const char *command_names[PA_COMMAND_MAX] = { [PA_COMMAND_LOAD_MODULE] = "LOAD_MODULE", [PA_COMMAND_UNLOAD_MODULE] = "UNLOAD_MODULE", - [PA_COMMAND_ADD_AUTOLOAD] = "ADD_AUTOLOAD", - [PA_COMMAND_REMOVE_AUTOLOAD] = "REMOVE_AUTOLOAD", - [PA_COMMAND_GET_AUTOLOAD_INFO] = "GET_AUTOLOAD_INFO", - [PA_COMMAND_GET_AUTOLOAD_INFO_LIST] = "GET_AUTOLOAD_INFO_LIST", + [PA_COMMAND_ADD_AUTOLOAD___OBSOLETE] = "ADD_AUTOLOAD (obsolete)", + [PA_COMMAND_REMOVE_AUTOLOAD___OBSOLETE] = "REMOVE_AUTOLOAD (obsolete)", + [PA_COMMAND_GET_AUTOLOAD_INFO___OBSOLETE] = "GET_AUTOLOAD_INFO (obsolete)", + [PA_COMMAND_GET_AUTOLOAD_INFO_LIST___OBSOLETE] = "GET_AUTOLOAD_INFO_LIST (obsolete)", [PA_COMMAND_GET_RECORD_LATENCY] = "GET_RECORD_LATENCY", [PA_COMMAND_CORK_RECORD_STREAM] = "CORK_RECORD_STREAM", diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index 6524b684..97d10df5 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -403,7 +403,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification"); if (c->options->default_sink) { - sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK); CHECK_VALIDITY(sink, "No such sink: %s", c->options->default_sink); } @@ -490,7 +490,7 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi if (request == ESD_PROTO_STREAM_MON) { pa_sink* sink; - if (!(sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK))) { pa_log("no such sink."); return -1; } @@ -503,7 +503,7 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi pa_assert(request == ESD_PROTO_STREAM_REC); if (c->options->default_source) { - if (!(source = pa_namereg_get(c->protocol->core, c->options->default_source, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c->protocol->core, c->options->default_source, PA_NAMEREG_SOURCE))) { pa_log("no such source."); return -1; } @@ -569,7 +569,7 @@ static int esd_proto_get_latency(connection *c, esd_proto_t request, const void pa_assert(!data); pa_assert(length == 0); - if (!(sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK, 1))) + if (!(sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK))) latency = 0; else { double usec = (double) pa_sink_get_latency(sink); @@ -590,7 +590,7 @@ static int esd_proto_server_info(connection *c, esd_proto_t request, const void pa_assert(data); pa_assert(length == sizeof(int32_t)); - if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK, 1))) { + if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK))) { rate = (int32_t) sink->sample_spec.rate; format = format_native2esd(&sink->sample_spec); } @@ -865,7 +865,7 @@ static int esd_proto_sample_free_or_play(connection *c, esd_proto_t request, con if (request == ESD_PROTO_SAMPLE_PLAY) { pa_sink *sink; - if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK, 1))) + if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK))) if (pa_scache_play_item(c->protocol->core, name, sink, PA_VOLUME_NORM, c->client->proplist, NULL) >= 0) ok = (int32_t) idx + 1; } else { diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index d99e212f..21797527 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -49,7 +49,6 @@ #include <pulsecore/core-scache.h> #include <pulsecore/core-subscribe.h> #include <pulsecore/log.h> -#include <pulsecore/autoload.h> #include <pulsecore/strlist.h> #include <pulsecore/shared.h> #include <pulsecore/sample-util.h> @@ -248,10 +247,6 @@ static void command_set_stream_name(pa_pdispatch *pd, uint32_t command, uint32_t static void command_kill(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_load_module(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_unload_module(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); -static void command_add_autoload(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); -static void command_remove_autoload(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); -static void command_get_autoload_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); -static void command_get_autoload_info_list(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_cork_record_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_flush_record_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); @@ -330,10 +325,11 @@ static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = { [PA_COMMAND_KILL_SOURCE_OUTPUT] = command_kill, [PA_COMMAND_LOAD_MODULE] = command_load_module, [PA_COMMAND_UNLOAD_MODULE] = command_unload_module, - [PA_COMMAND_GET_AUTOLOAD_INFO] = command_get_autoload_info, - [PA_COMMAND_GET_AUTOLOAD_INFO_LIST] = command_get_autoload_info_list, - [PA_COMMAND_ADD_AUTOLOAD] = command_add_autoload, - [PA_COMMAND_REMOVE_AUTOLOAD] = command_remove_autoload, + + [PA_COMMAND_GET_AUTOLOAD_INFO___OBSOLETE] = NULL, + [PA_COMMAND_GET_AUTOLOAD_INFO_LIST___OBSOLETE] = NULL, + [PA_COMMAND_ADD_AUTOLOAD___OBSOLETE] = NULL, + [PA_COMMAND_REMOVE_AUTOLOAD___OBSOLETE] = NULL, [PA_COMMAND_MOVE_SINK_INPUT] = command_move_stream, [PA_COMMAND_MOVE_SOURCE_OUTPUT] = command_move_stream, @@ -1799,7 +1795,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u } else if (sink_name) { - if (!(sink = pa_namereg_get(c->protocol->core, sink_name, PA_NAMEREG_SINK, 1))) { + if (!(sink = pa_namereg_get(c->protocol->core, sink_name, PA_NAMEREG_SINK))) { pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY); pa_proplist_free(p); return; @@ -2040,7 +2036,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin } else if (source_name) { - if (!(source = pa_namereg_get(c->protocol->core, source_name, PA_NAMEREG_SOURCE, 1))) { + if (!(source = pa_namereg_get(c->protocol->core, source_name, PA_NAMEREG_SOURCE))) { pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY); pa_proplist_free(p); return; @@ -2315,12 +2311,12 @@ static void command_lookup(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ if (command == PA_COMMAND_LOOKUP_SINK) { pa_sink *sink; - if ((sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK, 1))) + if ((sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK))) idx = sink->index; } else { pa_source *source; pa_assert(command == PA_COMMAND_LOOKUP_SOURCE); - if ((source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1))) + if ((source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE))) idx = source->index; } @@ -2575,7 +2571,7 @@ static void command_play_sample(pa_pdispatch *pd, uint32_t command, uint32_t tag if (sink_index != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, sink_index); else - sink = pa_namereg_get(c->protocol->core, sink_name, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, sink_name, PA_NAMEREG_SINK); CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); @@ -2738,7 +2734,7 @@ static void module_fill_tagstruct(pa_tagstruct *t, pa_module *module) { pa_tagstruct_puts(t, module->name); pa_tagstruct_puts(t, module->argument); pa_tagstruct_putu32(t, (uint32_t) module->n_used); - pa_tagstruct_put_boolean(t, module->auto_unload); + pa_tagstruct_put_boolean(t, FALSE); } static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sink_input *s) { @@ -2855,12 +2851,12 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p if (idx != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx); else - sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK); } else if (command == PA_COMMAND_GET_SOURCE_INFO) { if (idx != PA_INVALID_INDEX) source = pa_idxset_get_by_index(c->protocol->core->sources, idx); else - source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1); + source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE); } else if (command == PA_COMMAND_GET_CLIENT_INFO) client = pa_idxset_get_by_index(c->protocol->core->clients, idx); else if (command == PA_COMMAND_GET_MODULE_INFO) @@ -2874,7 +2870,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p if (idx != PA_INVALID_INDEX) sce = pa_idxset_get_by_index(c->protocol->core->scache, idx); else - sce = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SAMPLE, 0); + sce = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SAMPLE); } if (!sink && !source && !client && !module && !si && !so && !sce) { @@ -3078,14 +3074,14 @@ static void command_set_volume( if (idx != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx); else - sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK); break; case PA_COMMAND_SET_SOURCE_VOLUME: if (idx != PA_INVALID_INDEX) source = pa_idxset_get_by_index(c->protocol->core->sources, idx); else - source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1); + source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE); break; case PA_COMMAND_SET_SINK_INPUT_VOLUME: @@ -3148,7 +3144,7 @@ static void command_set_mute( if (idx != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx); else - sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK); break; @@ -3156,7 +3152,7 @@ static void command_set_mute( if (idx != PA_INVALID_INDEX) source = pa_idxset_get_by_index(c->protocol->core->sources, idx); else - source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1); + source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE); break; @@ -3748,143 +3744,6 @@ static void command_unload_module(pa_pdispatch *pd, uint32_t command, uint32_t t pa_pstream_send_simple_ack(c->pstream, tag); } -static void command_add_autoload(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); - const char *name, *module, *argument; - uint32_t type; - uint32_t idx; - pa_tagstruct *reply; - - pa_native_connection_assert_ref(c); - pa_assert(t); - - if (pa_tagstruct_gets(t, &name) < 0 || - pa_tagstruct_getu32(t, &type) < 0 || - pa_tagstruct_gets(t, &module) < 0 || - pa_tagstruct_gets(t, &argument) < 0 || - !pa_tagstruct_eof(t)) { - protocol_error(c); - return; - } - - CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name), tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, type == 0 || type == 1, tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, module && *module && pa_utf8_valid(module), tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, !argument || pa_utf8_valid(argument), tag, PA_ERR_INVALID); - - if (pa_autoload_add(c->protocol->core, name, type == 0 ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE, module, argument, &idx) < 0) { - pa_pstream_send_error(c->pstream, tag, PA_ERR_EXIST); - return; - } - - reply = reply_new(tag); - pa_tagstruct_putu32(reply, idx); - pa_pstream_send_tagstruct(c->pstream, reply); -} - -static void command_remove_autoload(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); - const char *name = NULL; - uint32_t type, idx = PA_IDXSET_INVALID; - int r; - - pa_native_connection_assert_ref(c); - pa_assert(t); - - if ((pa_tagstruct_getu32(t, &idx) < 0 && - (pa_tagstruct_gets(t, &name) < 0 || - pa_tagstruct_getu32(t, &type) < 0)) || - !pa_tagstruct_eof(t)) { - protocol_error(c); - return; - } - - CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - CHECK_VALIDITY(c->pstream, name || idx != PA_IDXSET_INVALID, tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, !name || (*name && pa_utf8_valid(name) && (type == 0 || type == 1)), tag, PA_ERR_INVALID); - - if (name) - r = pa_autoload_remove_by_name(c->protocol->core, name, type == 0 ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE); - else - r = pa_autoload_remove_by_index(c->protocol->core, idx); - - CHECK_VALIDITY(c->pstream, r >= 0, tag, PA_ERR_NOENTITY); - - pa_pstream_send_simple_ack(c->pstream, tag); -} - -static void autoload_fill_tagstruct(pa_tagstruct *t, const pa_autoload_entry *e) { - pa_assert(t && e); - - pa_tagstruct_putu32(t, e->index); - pa_tagstruct_puts(t, e->name); - pa_tagstruct_putu32(t, e->type == PA_NAMEREG_SINK ? 0U : 1U); - pa_tagstruct_puts(t, e->module); - pa_tagstruct_puts(t, e->argument); -} - -static void command_get_autoload_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); - const pa_autoload_entry *a = NULL; - uint32_t type, idx; - const char *name; - pa_tagstruct *reply; - - pa_native_connection_assert_ref(c); - pa_assert(t); - - if ((pa_tagstruct_getu32(t, &idx) < 0 && - (pa_tagstruct_gets(t, &name) < 0 || - pa_tagstruct_getu32(t, &type) < 0)) || - !pa_tagstruct_eof(t)) { - protocol_error(c); - return; - } - - CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - CHECK_VALIDITY(c->pstream, name || idx != PA_IDXSET_INVALID, tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, !name || (*name && (type == 0 || type == 1) && pa_utf8_valid(name)), tag, PA_ERR_INVALID); - - if (name) - a = pa_autoload_get_by_name(c->protocol->core, name, type == 0 ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE); - else - a = pa_autoload_get_by_index(c->protocol->core, idx); - - CHECK_VALIDITY(c->pstream, a, tag, PA_ERR_NOENTITY); - - reply = reply_new(tag); - autoload_fill_tagstruct(reply, a); - pa_pstream_send_tagstruct(c->pstream, reply); -} - -static void command_get_autoload_info_list(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); - pa_tagstruct *reply; - - pa_native_connection_assert_ref(c); - pa_assert(t); - - if (!pa_tagstruct_eof(t)) { - protocol_error(c); - return; - } - - CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - - reply = reply_new(tag); - - if (c->protocol->core->autoload_hashmap) { - pa_autoload_entry *a; - void *state = NULL; - - while ((a = pa_hashmap_iterate(c->protocol->core->autoload_hashmap, &state, NULL))) - autoload_fill_tagstruct(reply, a); - } - - pa_pstream_send_tagstruct(c->pstream, reply); -} - static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); uint32_t idx = PA_INVALID_INDEX, idx_device = PA_INVALID_INDEX; @@ -3918,7 +3777,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag if (idx_device != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx_device); else - sink = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SINK); CHECK_VALIDITY(c->pstream, si && sink, tag, PA_ERR_NOENTITY); @@ -3937,7 +3796,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag if (idx_device != PA_INVALID_INDEX) source = pa_idxset_get_by_index(c->protocol->core->sources, idx_device); else - source = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SOURCE, 1); + source = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SOURCE); CHECK_VALIDITY(c->pstream, so && source, tag, PA_ERR_NOENTITY); @@ -3989,7 +3848,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx != PA_INVALID_INDEX) sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx); else - sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK, 1); + sink = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SINK); CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); @@ -4017,7 +3876,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx != PA_INVALID_INDEX) source = pa_idxset_get_by_index(c->protocol->core->sources, idx); else - source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1); + source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE); CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY); diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c index a754669c..dd8002a3 100644 --- a/src/pulsecore/protocol-simple.c +++ b/src/pulsecore/protocol-simple.c @@ -526,7 +526,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp size_t l; pa_sink *sink; - if (!(sink = pa_namereg_get(c->protocol->core, o->default_sink, PA_NAMEREG_SINK, TRUE))) { + if (!(sink = pa_namereg_get(c->protocol->core, o->default_sink, PA_NAMEREG_SINK))) { pa_log("Failed to get sink."); goto fail; } @@ -578,7 +578,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp size_t l; pa_source *source; - if (!(source = pa_namereg_get(c->protocol->core, o->default_source, PA_NAMEREG_SOURCE, TRUE))) { + if (!(source = pa_namereg_get(c->protocol->core, o->default_source, PA_NAMEREG_SOURCE))) { pa_log("Failed to get source."); goto fail; } diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 185350fa..8cdc9286 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -131,7 +131,7 @@ pa_sink_input* pa_sink_input_new( pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver)); if (!data->sink) - data->sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK, TRUE); + data->sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK); pa_return_null_if_fail(data->sink); pa_return_null_if_fail(pa_sink_get_state(data->sink) != PA_SINK_UNLINKED); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index b1c65d1c..e04acf90 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -112,7 +112,7 @@ pa_source_output* pa_source_output_new( pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver)); if (!data->source) - data->source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE, TRUE); + data->source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE); pa_return_null_if_fail(data->source); pa_return_null_if_fail(pa_source_get_state(data->source) != PA_SOURCE_UNLINKED); diff --git a/src/utils/pactl.c b/src/utils/pactl.c index 2f430ca7..65342bb2 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -476,36 +476,6 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int pa_xfree(pl); } -static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata) { - if (is_last < 0) { - fprintf(stderr, _("Failed to get autoload information: %s\n"), pa_strerror(pa_context_errno(c))); - quit(1); - return; - } - - if (is_last) { - complete_action(); - return; - } - - assert(i); - - if (nl) - printf("\n"); - nl = 1; - - printf(_("*** Autoload Entry #%u ***\n" - "Name: %s\n" - "Type: %s\n" - "Module: %s\n" - "Argument: %s\n"), - i->index, - i->name, - i->type == PA_AUTOLOAD_SINK ? _("sink") : _("source"), - i->module, - i->argument ? i->argument : ""); -} - static void simple_callback(pa_context *c, int success, void *userdata) { if (!success) { fprintf(stderr, _("Failure: %s\n"), pa_strerror(pa_context_errno(c))); @@ -619,7 +589,6 @@ static void context_state_callback(pa_context *c, void *userdata) { pa_operation_unref(pa_context_get_source_output_info_list(c, get_source_output_info_callback, NULL)); pa_operation_unref(pa_context_get_client_info_list(c, get_client_info_callback, NULL)); pa_operation_unref(pa_context_get_sample_info_list(c, get_sample_info_callback, NULL)); - pa_operation_unref(pa_context_get_autoload_info_list(c, get_autoload_info_callback, NULL)); break; case MOVE_SINK_INPUT: |