context: match wildcards @DEFAULT_SINK/SOURCE/MONITOR@

See #291
This commit is contained in:
Wim Taymans 2020-09-14 13:21:10 +02:00
parent 67f4acaf1d
commit 310ed89aad
2 changed files with 10 additions and 3 deletions

View file

@ -180,7 +180,14 @@ struct global *pa_context_find_global_by_name(pa_context *c, uint32_t mask, cons
{ {
struct global *g; struct global *g;
const char *str; const char *str;
uint32_t id = atoi(name); uint32_t id;
if (strcmp(name, "@DEFAULT_SINK@") == 0 || strcmp("@DEFAULT_MONITOR@", name) == 0)
id = c->default_sink;
else if (strcmp(name, "@DEFAULT_SOURCE@") == 0)
id = c->default_sink;
else
id = atoi(name);
spa_list_for_each(g, &c->globals, link) { spa_list_for_each(g, &c->globals, link) {
if ((g->mask & mask) == 0) if ((g->mask & mask) == 0)

View file

@ -202,6 +202,8 @@ static void sink_info(pa_operation *o, void *userdata)
pa_context *c = o->context; pa_context *c = o->context;
int error = 0; int error = 0;
pw_log_debug("%p name:%s idx:%u", c, d->name, d->idx);
if (d->name) { if (d->name) {
g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SINK, d->name); g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SINK, d->name);
pa_xfree(d->name); pa_xfree(d->name);
@ -211,8 +213,6 @@ static void sink_info(pa_operation *o, void *userdata)
g = NULL; g = NULL;
} }
pw_log_debug("%p", c);
if (g) { if (g) {
error = sink_callback(c, g, d); error = sink_callback(c, g, d);
} else { } else {