mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
maintain a list of sink inputs/source outputs as part of the pa_client object
This commit is contained in:
parent
b6deb0cc4c
commit
344c934edb
5 changed files with 27 additions and 2 deletions
|
|
@ -117,8 +117,8 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
|||
c->driver = pa_xstrdup(data->driver);
|
||||
c->module = data->module;
|
||||
|
||||
c->sinks = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
|
||||
c->sources = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
|
||||
c->sinks = pa_idxset_new(NULL, NULL);
|
||||
c->sources = pa_idxset_new(NULL, NULL);
|
||||
|
||||
c->configs = data->configs;
|
||||
data->configs = NULL;
|
||||
|
|
@ -156,7 +156,9 @@ void pa_card_free(pa_card *c) {
|
|||
|
||||
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sinks));
|
||||
pa_idxset_free(c->sinks, NULL, NULL);
|
||||
pa_assert(pa_idxset_isempty(c->sources));
|
||||
pa_idxset_free(c->sources, NULL, NULL);
|
||||
|
||||
while ((config = pa_hashmap_steal_first(c->configs)))
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ pa_client *pa_client_new(pa_core *core, pa_client_new_data *data) {
|
|||
c->driver = pa_xstrdup(data->driver);
|
||||
c->module = data->module;
|
||||
|
||||
c->sink_inputs = pa_idxset_new(NULL, NULL);
|
||||
c->source_outputs = pa_idxset_new(NULL, NULL);
|
||||
|
||||
c->userdata = NULL;
|
||||
c->kill = NULL;
|
||||
|
||||
|
|
@ -97,6 +100,11 @@ void pa_client_free(pa_client *c) {
|
|||
pa_log_info("Freed %u \"%s\"", c->index, pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_NAME)));
|
||||
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sink_inputs));
|
||||
pa_idxset_free(c->sink_inputs, NULL, NULL);
|
||||
pa_assert(pa_idxset_isempty(c->source_outputs));
|
||||
pa_idxset_free(c->source_outputs, NULL, NULL);
|
||||
|
||||
pa_proplist_free(c->proplist);
|
||||
pa_xfree(c->driver);
|
||||
pa_xfree(c);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ struct pa_client {
|
|||
pa_module *module;
|
||||
char *driver;
|
||||
|
||||
pa_idxset *sink_inputs;
|
||||
pa_idxset *source_outputs;
|
||||
|
||||
void *userdata;
|
||||
|
||||
void (*kill)(pa_client *c);
|
||||
|
|
|
|||
|
|
@ -283,6 +283,9 @@ pa_sink_input* pa_sink_input_new(
|
|||
pa_assert_se(pa_idxset_put(core->sink_inputs, pa_sink_input_ref(i), &i->index) == 0);
|
||||
pa_assert_se(pa_idxset_put(i->sink->inputs, i, NULL) == 0);
|
||||
|
||||
if (i->client)
|
||||
pa_assert_se(pa_idxset_put(i->client->sink_inputs, i, NULL) >= 0);
|
||||
|
||||
pa_log_info("Created input %u \"%s\" on %s with sample spec %s and channel map %s",
|
||||
i->index,
|
||||
pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME)),
|
||||
|
|
@ -372,6 +375,9 @@ void pa_sink_input_unlink(pa_sink_input *i) {
|
|||
if (pa_idxset_remove_by_data(i->sink->inputs, i, NULL))
|
||||
pa_sink_input_unref(i);
|
||||
|
||||
if (i->client)
|
||||
pa_idxset_remove_by_data(i->client->sink_inputs, i, NULL);
|
||||
|
||||
while ((o = pa_idxset_first(i->direct_outputs, NULL))) {
|
||||
pa_assert(o != p);
|
||||
pa_source_output_kill(o);
|
||||
|
|
|
|||
|
|
@ -223,6 +223,9 @@ pa_source_output* pa_source_output_new(
|
|||
pa_assert_se(pa_idxset_put(core->source_outputs, o, &o->index) == 0);
|
||||
pa_assert_se(pa_idxset_put(o->source->outputs, pa_source_output_ref(o), NULL) == 0);
|
||||
|
||||
if (o->client)
|
||||
pa_assert_se(pa_idxset_put(o->client->source_outputs, o, NULL) >= 0);
|
||||
|
||||
if (o->direct_on_input)
|
||||
pa_assert_se(pa_idxset_put(o->direct_on_input->direct_outputs, o, NULL) == 0);
|
||||
|
||||
|
|
@ -290,6 +293,9 @@ void pa_source_output_unlink(pa_source_output*o) {
|
|||
if (pa_idxset_remove_by_data(o->source->outputs, o, NULL))
|
||||
pa_source_output_unref(o);
|
||||
|
||||
if (o->client)
|
||||
pa_idxset_remove_by_data(o->client->source_outputs, o, NULL);
|
||||
|
||||
update_n_corked(o, PA_SOURCE_OUTPUT_UNLINKED);
|
||||
o->state = PA_SOURCE_OUTPUT_UNLINKED;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue