mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
cli: introspect device
This commit is contained in:
parent
5b303b5883
commit
10d277ce03
2 changed files with 41 additions and 0 deletions
|
|
@ -365,6 +365,9 @@ struct pw_device_info *pw_device_info_update(struct pw_device_info *info,
|
|||
return NULL;
|
||||
}
|
||||
info->id = update->id;
|
||||
if (info->name)
|
||||
free((void *) info->name);
|
||||
info->name = update->name ? strdup(update->name) : NULL;
|
||||
info->change_mask = update->change_mask;
|
||||
|
||||
if (update->change_mask & PW_CLIENT_CHANGE_MASK_PROPS) {
|
||||
|
|
@ -377,6 +380,8 @@ struct pw_device_info *pw_device_info_update(struct pw_device_info *info,
|
|||
|
||||
void pw_device_info_free(struct pw_device_info *info)
|
||||
{
|
||||
if (info->name)
|
||||
free((void *) info->name);
|
||||
if (info->props)
|
||||
pw_spa_dict_destroy(info->props);
|
||||
free(info);
|
||||
|
|
|
|||
|
|
@ -606,6 +606,15 @@ static void info_link(struct proxy_data *pd)
|
|||
info->change_mask = 0;
|
||||
}
|
||||
|
||||
static void info_device(struct proxy_data *pd)
|
||||
{
|
||||
struct pw_device_info *info = pd->info;
|
||||
|
||||
info_global(pd);
|
||||
fprintf(stdout, "\tname: \"%s\"\n", info->name);
|
||||
print_properties(info->props, MARK_CHANGE(0), true);
|
||||
info->change_mask = 0;
|
||||
}
|
||||
|
||||
static void core_event_info(void *object, struct pw_core_info *info)
|
||||
{
|
||||
|
|
@ -781,6 +790,27 @@ static const struct pw_link_proxy_events link_events = {
|
|||
.info = link_event_info
|
||||
};
|
||||
|
||||
|
||||
static void device_event_info(void *object, struct pw_device_info *info)
|
||||
{
|
||||
struct proxy_data *pd = object;
|
||||
struct remote_data *rd = pd->rd;
|
||||
if (pd->info)
|
||||
fprintf(stdout, "remote %d device %d changed\n", rd->id, info->id);
|
||||
pd->info = pw_device_info_update(pd->info, info);
|
||||
if (pd->global == NULL)
|
||||
pd->global = pw_map_lookup(&rd->globals, info->id);
|
||||
if (pd->global && pd->global->info_pending) {
|
||||
info_device(pd);
|
||||
pd->global->info_pending = false;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct pw_device_proxy_events device_events = {
|
||||
PW_VERSION_DEVICE_PROXY_EVENTS,
|
||||
.info = device_event_info
|
||||
};
|
||||
|
||||
static void
|
||||
destroy_proxy (void *data)
|
||||
{
|
||||
|
|
@ -831,6 +861,12 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
destroy = (pw_destroy_t) pw_module_info_free;
|
||||
info_func = info_module;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Device:
|
||||
events = &device_events;
|
||||
client_version = PW_VERSION_DEVICE;
|
||||
destroy = (pw_destroy_t) pw_device_info_free;
|
||||
info_func = info_device;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Node:
|
||||
events = &node_events;
|
||||
client_version = PW_VERSION_NODE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue