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 \
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,
{"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},
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;
.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,
{ "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 },
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;
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)));
log_meta,
log_time;
int exit_idle_time,
- module_idle_time,
scache_idle_time,
auto_log_target,
realtime_priority,
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;
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;
}
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;
}
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;
}
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;
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
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
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++;
}
}
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);
}
}
}
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;
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) {
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);
}
}
}
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;
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;
}
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;
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;
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;
}
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))
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))
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;
}
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);
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);
}
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);
}
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);
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);
}
}
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);
}
}
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);
}
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;
}
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;
}
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 */
};
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;
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 */
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);
/*** 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) {
* 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
* 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
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*/
/** @{ \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 {
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;
/** @} */
+++ /dev/null
-/***
- 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;
-}
+++ /dev/null
-#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
#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>
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);
{ "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},
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
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;
}
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;
}
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;
}
uint32_t idx;
char txt[256];
time_t now;
- void *i;
- pa_autoload_entry *a;
pa_core_assert_ref(c);
pa_assert(t);
#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);
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");
}
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");
}
- 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))) {
#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>
"\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);
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) {
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);
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);
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);
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);
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) {
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);
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;
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);
#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>
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;
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;
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;
pa_scache_free(c);
pa_namereg_free(c);
- pa_autoload_free(c);
pa_subscription_free_all(c);
if (c->exit_event)
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;
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;
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;
#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);
m->userdata = NULL;
m->core = c;
m->n_used = -1;
- m->auto_unload = FALSE;
m->unload_requested = FALSE;
if (m->init(m) < 0) {
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);
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);
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;
}
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);
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);
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);
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 == '@')
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);
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);
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,
[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",
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);
}
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;
}
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;
}
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);
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);
}
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 {
#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>
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);
[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,
} 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;
} 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;
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;
}
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);
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) {
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)
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) {
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:
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;
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;
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;
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);
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);
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);
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);
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;
}
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;
}
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);
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);
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)));
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: