mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
factory: add introspection
This commit is contained in:
parent
7f20e04803
commit
67d4dd8656
10 changed files with 220 additions and 22 deletions
|
|
@ -543,6 +543,17 @@ static void info_node(struct proxy_data *pd)
|
|||
print_properties(info->props, MARK_CHANGE(6));
|
||||
}
|
||||
|
||||
static void info_factory(struct proxy_data *pd)
|
||||
{
|
||||
struct pw_factory_info *info = pd->info;
|
||||
struct pw_type *t = pd->rd->data->t;
|
||||
|
||||
info_global(pd);
|
||||
fprintf(stdout, "\tname: \"%s\"\n", info->name);
|
||||
fprintf(stdout, "\tobject-type: %s/%d\n", spa_type_map_get_type(t->map, info->type), info->version);
|
||||
print_properties(info->props, MARK_CHANGE(0));
|
||||
}
|
||||
|
||||
static void info_client(struct proxy_data *pd)
|
||||
{
|
||||
struct pw_client_info *info = pd->info;
|
||||
|
|
@ -624,6 +635,24 @@ static const struct pw_node_proxy_events node_events = {
|
|||
.info = node_event_info
|
||||
};
|
||||
|
||||
static void factory_event_info(void *object, struct pw_factory_info *info)
|
||||
{
|
||||
struct proxy_data *pd = object;
|
||||
struct remote_data *rd = pd->rd;
|
||||
pd->info = pw_factory_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_factory(pd);
|
||||
pd->global->info_pending = false;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct pw_factory_proxy_events factory_events = {
|
||||
PW_VERSION_FACTORY_PROXY_EVENTS,
|
||||
.info = factory_event_info
|
||||
};
|
||||
|
||||
static void client_event_info(void *object, struct pw_client_info *info)
|
||||
{
|
||||
struct proxy_data *pd = object;
|
||||
|
|
@ -716,6 +745,12 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
destroy = (pw_destroy_t) pw_node_info_free;
|
||||
info_func = info_node;
|
||||
}
|
||||
else if (global->type == t->factory) {
|
||||
events = &factory_events;
|
||||
client_version = PW_VERSION_FACTORY;
|
||||
destroy = (pw_destroy_t) pw_factory_info_free;
|
||||
info_func = info_factory;
|
||||
}
|
||||
else if (global->type == t->client) {
|
||||
events = &client_events;
|
||||
client_version = PW_VERSION_CLIENT;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ struct data {
|
|||
};
|
||||
|
||||
struct proxy_data {
|
||||
struct data *data;
|
||||
struct pw_proxy *proxy;
|
||||
uint32_t id;
|
||||
uint32_t parent_id;
|
||||
|
|
@ -86,8 +87,7 @@ static void on_info_changed(void *data, const struct pw_core_info *info)
|
|||
|
||||
static void module_event_info(void *object, struct pw_module_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct proxy_data *data = pw_proxy_get_user_data(proxy);
|
||||
struct proxy_data *data = object;
|
||||
bool print_all, print_mark;
|
||||
|
||||
print_all = true;
|
||||
|
|
@ -123,8 +123,7 @@ static const struct pw_module_proxy_events module_events = {
|
|||
|
||||
static void node_event_info(void *object, struct pw_node_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct proxy_data *data = pw_proxy_get_user_data(proxy);
|
||||
struct proxy_data *data = object;
|
||||
bool print_all, print_mark;
|
||||
|
||||
print_all = true;
|
||||
|
|
@ -173,10 +172,45 @@ static const struct pw_node_proxy_events node_events = {
|
|||
.info = node_event_info
|
||||
};
|
||||
|
||||
static void factory_event_info(void *object, struct pw_factory_info *info)
|
||||
{
|
||||
struct proxy_data *data = object;
|
||||
struct pw_type *t = pw_core_get_type(data->data->core);
|
||||
bool print_all, print_mark;
|
||||
|
||||
print_all = true;
|
||||
if (data->info == NULL) {
|
||||
printf("added:\n");
|
||||
print_mark = false;
|
||||
}
|
||||
else {
|
||||
printf("changed:\n");
|
||||
print_mark = true;
|
||||
}
|
||||
|
||||
info = data->info = pw_factory_info_update(data->info, info);
|
||||
|
||||
printf("\tid: %d\n", data->id);
|
||||
printf("\tparent_id: %d\n", data->parent_id);
|
||||
printf("\tpermissions: %c%c%c\n", data->permissions & PW_PERM_R ? 'r' : '-',
|
||||
data->permissions & PW_PERM_W ? 'w' : '-',
|
||||
data->permissions & PW_PERM_X ? 'x' : '-');
|
||||
printf("\ttype: %s (version %d)\n", PW_TYPE_INTERFACE__Factory, data->version);
|
||||
printf("\tname: \"%s\"\n", info->name);
|
||||
printf("\tobject-type: %s/%d\n", spa_type_map_get_type(t->map, info->type), info->version);
|
||||
if (print_all) {
|
||||
print_properties(info->props, MARK_CHANGE(0));
|
||||
}
|
||||
}
|
||||
|
||||
static const struct pw_factory_proxy_events factory_events = {
|
||||
PW_VERSION_FACTORY_PROXY_EVENTS,
|
||||
.info = factory_event_info
|
||||
};
|
||||
|
||||
static void client_event_info(void *object, struct pw_client_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct proxy_data *data = pw_proxy_get_user_data(proxy);
|
||||
struct proxy_data *data = object;
|
||||
bool print_all, print_mark;
|
||||
|
||||
print_all = true;
|
||||
|
|
@ -209,8 +243,7 @@ static const struct pw_client_proxy_events client_events = {
|
|||
|
||||
static void link_event_info(void *object, struct pw_link_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct proxy_data *data = pw_proxy_get_user_data(proxy);
|
||||
struct proxy_data *data = object;
|
||||
bool print_all, print_mark;
|
||||
|
||||
print_all = true;
|
||||
|
|
@ -290,6 +323,11 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id,
|
|||
client_version = PW_VERSION_MODULE;
|
||||
destroy = (pw_destroy_t) pw_module_info_free;
|
||||
}
|
||||
else if (type == t->factory) {
|
||||
events = &factory_events;
|
||||
client_version = PW_VERSION_FACTORY;
|
||||
destroy = (pw_destroy_t) pw_factory_info_free;
|
||||
}
|
||||
else if (type == t->client) {
|
||||
events = &client_events;
|
||||
client_version = PW_VERSION_CLIENT;
|
||||
|
|
@ -318,6 +356,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id,
|
|||
goto no_mem;
|
||||
|
||||
pd = pw_proxy_get_user_data(proxy);
|
||||
pd->data = d;
|
||||
pd->proxy = proxy;
|
||||
pd->id = id;
|
||||
pd->parent_id = parent_id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue