mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
introspect: only introspect readable node and device params
Check the node and device params for READ access before attempting to enumerate them.
This commit is contained in:
parent
d379fa348b
commit
f54412e722
1 changed files with 38 additions and 15 deletions
|
|
@ -30,8 +30,26 @@
|
||||||
static void node_event_info(void *object, const struct pw_node_info *info)
|
static void node_event_info(void *object, const struct pw_node_info *info)
|
||||||
{
|
{
|
||||||
struct global *g = object;
|
struct global *g = object;
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
pw_log_debug("update %d", g->id);
|
pw_log_debug("update %d", g->id);
|
||||||
g->info = pw_node_info_update(g->info, info);
|
g->info = pw_node_info_update(g->info, info);
|
||||||
|
|
||||||
|
if (info->change_mask & SPA_NODE_CHANGE_MASK_PARAMS) {
|
||||||
|
for (i = 0; i < info->n_params; i++) {
|
||||||
|
if (!(info->params[i].flags & SPA_PARAM_INFO_READ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (info->params[i].id) {
|
||||||
|
case SPA_PARAM_EnumFormat:
|
||||||
|
pw_node_proxy_enum_params((struct pw_node_proxy*)g->proxy,
|
||||||
|
0, SPA_PARAM_EnumFormat, 0, -1, NULL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_event_param(void *object, int seq,
|
static void node_event_param(void *object, int seq,
|
||||||
|
|
@ -151,6 +169,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
|
||||||
{
|
{
|
||||||
struct global *g = object;
|
struct global *g = object;
|
||||||
pa_card_info *i = &g->card_info.info;
|
pa_card_info *i = &g->card_info.info;
|
||||||
|
uint32_t n;
|
||||||
|
|
||||||
pw_log_debug("update %d", g->id);
|
pw_log_debug("update %d", g->id);
|
||||||
info = g->info = pw_device_info_update(g->info, info);
|
info = g->info = pw_device_info_update(g->info, info);
|
||||||
|
|
@ -166,6 +185,25 @@ static void device_event_info(void *object, const struct pw_device_info *info)
|
||||||
else
|
else
|
||||||
i->proplist = pa_proplist_new_dict(info->props);
|
i->proplist = pa_proplist_new_dict(info->props);
|
||||||
}
|
}
|
||||||
|
if (info->change_mask & SPA_DEVICE_CHANGE_MASK_PARAMS) {
|
||||||
|
for (n = 0; n < info->n_params; n++) {
|
||||||
|
if (!(info->params[n].flags & SPA_PARAM_INFO_READ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (info->params[n].id) {
|
||||||
|
case SPA_PARAM_EnumProfile:
|
||||||
|
pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
|
||||||
|
0, SPA_PARAM_EnumProfile, 0, -1, NULL);
|
||||||
|
break;
|
||||||
|
case SPA_PARAM_Profile:
|
||||||
|
pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
|
||||||
|
0, SPA_PARAM_Profile, 0, -1, NULL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_device_proxy_events device_events = {
|
static const struct pw_device_proxy_events device_events = {
|
||||||
|
|
@ -257,21 +295,6 @@ static int ensure_global(pa_context *c, struct global *g)
|
||||||
|
|
||||||
pw_proxy_add_proxy_listener(g->proxy, &g->proxy_proxy_listener, events, g);
|
pw_proxy_add_proxy_listener(g->proxy, &g->proxy_proxy_listener, events, g);
|
||||||
g->destroy = destroy;
|
g->destroy = destroy;
|
||||||
|
|
||||||
switch (g->type) {
|
|
||||||
case PW_TYPE_INTERFACE_Node:
|
|
||||||
pw_node_proxy_enum_params((struct pw_node_proxy*)g->proxy,
|
|
||||||
0, SPA_PARAM_EnumFormat, 0, -1, NULL);
|
|
||||||
break;
|
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
|
|
||||||
0, SPA_PARAM_EnumProfile, 0, -1, NULL);
|
|
||||||
pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
|
|
||||||
0, SPA_PARAM_Profile, 0, -1, NULL);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue