mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
context: also find monitor names
This commit is contained in:
parent
fa66bf8187
commit
35bec2c7c4
1 changed files with 15 additions and 3 deletions
|
|
@ -155,6 +155,14 @@ const char *pa_context_find_global_name(pa_context *c, uint32_t id)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool pa_endswith(const char *s, const char *sfx)
|
||||||
|
{
|
||||||
|
size_t l1, l2;
|
||||||
|
l1 = strlen(s);
|
||||||
|
l2 = strlen(sfx);
|
||||||
|
return l1 >= l2 && pa_streq(s + l1 - l2, sfx);
|
||||||
|
}
|
||||||
|
|
||||||
struct global *pa_context_find_global_by_name(pa_context *c, uint32_t mask, const char *name)
|
struct global *pa_context_find_global_by_name(pa_context *c, uint32_t mask, const char *name)
|
||||||
{
|
{
|
||||||
struct global *g;
|
struct global *g;
|
||||||
|
|
@ -165,9 +173,13 @@ struct global *pa_context_find_global_by_name(pa_context *c, uint32_t mask, cons
|
||||||
if ((g->mask & mask) == 0)
|
if ((g->mask & mask) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (g->props != NULL &&
|
if (g->props != NULL &&
|
||||||
(str = pw_properties_get(g->props, PW_KEY_NODE_NAME)) != NULL &&
|
(str = pw_properties_get(g->props, PW_KEY_NODE_NAME)) != NULL) {
|
||||||
strcmp(str, name) == 0)
|
if (strcmp(str, name) == 0)
|
||||||
return g;
|
return g;
|
||||||
|
if (pa_endswith(name, ".monitor") &&
|
||||||
|
strncmp(str, name, strlen(name) - 8) == 0)
|
||||||
|
return g;
|
||||||
|
}
|
||||||
if (g->id == id || (g->id == (id & PA_IDX_MASK_DSP)))
|
if (g->id == id || (g->id == (id & PA_IDX_MASK_DSP)))
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue