mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-19 07:00:10 -05:00
Add core introspection
Use global ids in info messages to refer to global objects.
This commit is contained in:
parent
0d0385b881
commit
8ce3f949e2
10 changed files with 102 additions and 9 deletions
|
|
@ -103,8 +103,31 @@ core_dispatch_func (void *object,
|
|||
{
|
||||
PinosContextImpl *impl = data;
|
||||
PinosContext *this = &impl->this;
|
||||
PinosProxy *proxy = object;
|
||||
|
||||
switch (type) {
|
||||
case PINOS_MESSAGE_CORE_INFO:
|
||||
{
|
||||
PinosMessageCoreInfo *m = message;
|
||||
PinosSubscriptionEvent event;
|
||||
|
||||
pinos_log_debug ("got core info %d", type);
|
||||
if (proxy->user_data == NULL)
|
||||
event = PINOS_SUBSCRIPTION_EVENT_NEW;
|
||||
else
|
||||
event = PINOS_SUBSCRIPTION_EVENT_CHANGE;
|
||||
|
||||
proxy->user_data = pinos_core_info_update (proxy->user_data, m->info);
|
||||
|
||||
if (impl->subscribe_func) {
|
||||
impl->subscribe_func (this,
|
||||
event,
|
||||
proxy->type,
|
||||
proxy->id,
|
||||
impl->subscribe_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PINOS_MESSAGE_NOTIFY_DONE:
|
||||
{
|
||||
PinosMessageNotifyDone *nd = message;
|
||||
|
|
|
|||
|
|
@ -137,6 +137,73 @@ pinos_spa_dict_copy (SpaDict *dict)
|
|||
return copy;
|
||||
}
|
||||
|
||||
PinosCoreInfo *
|
||||
pinos_core_info_update (PinosCoreInfo *info,
|
||||
const PinosCoreInfo *update)
|
||||
{
|
||||
uint64_t change_mask;
|
||||
|
||||
if (update == NULL)
|
||||
return info;
|
||||
|
||||
if (info == NULL) {
|
||||
info = calloc (1, sizeof (PinosCoreInfo));
|
||||
change_mask = ~0;
|
||||
} else {
|
||||
change_mask = info->change_mask | update->change_mask;
|
||||
}
|
||||
info->id = update->id;
|
||||
info->change_mask = change_mask;
|
||||
|
||||
if (update->change_mask & (1 << 0)) {
|
||||
if (info->user_name)
|
||||
free ((void*)info->user_name);
|
||||
info->user_name = update->user_name ? strdup (update->user_name) : NULL;
|
||||
}
|
||||
if (update->change_mask & (1 << 1)) {
|
||||
if (info->host_name)
|
||||
free ((void*)info->host_name);
|
||||
info->host_name = update->host_name ? strdup (update->host_name) : NULL;
|
||||
}
|
||||
if (update->change_mask & (1 << 2)) {
|
||||
if (info->version)
|
||||
free ((void*)info->version);
|
||||
info->version = update->version ? strdup (update->version) : NULL;
|
||||
}
|
||||
if (update->change_mask & (1 << 3)) {
|
||||
if (info->name)
|
||||
free ((void*)info->name);
|
||||
info->name = update->name ? strdup (update->name) : NULL;
|
||||
}
|
||||
if (update->change_mask & (1 << 4))
|
||||
info->cookie = update->cookie;
|
||||
if (update->change_mask & (1 << 5)) {
|
||||
if (info->props)
|
||||
pinos_spa_dict_destroy (info->props);
|
||||
info->props = pinos_spa_dict_copy (update->props);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
void
|
||||
pinos_core_info_free (PinosCoreInfo *info)
|
||||
{
|
||||
if (info == NULL)
|
||||
return;
|
||||
|
||||
if (info->user_name)
|
||||
free ((void*)info->user_name);
|
||||
if (info->host_name)
|
||||
free ((void*)info->host_name);
|
||||
if (info->version)
|
||||
free ((void*)info->version);
|
||||
if (info->name)
|
||||
free ((void*)info->name);
|
||||
if (info->props)
|
||||
pinos_spa_dict_destroy (info->props);
|
||||
free (info);
|
||||
}
|
||||
|
||||
PinosNodeInfo *
|
||||
pinos_node_info_update (PinosNodeInfo *info,
|
||||
const PinosNodeInfo *update)
|
||||
|
|
@ -225,7 +292,7 @@ pinos_module_info_update (PinosModuleInfo *info,
|
|||
}
|
||||
|
||||
void
|
||||
pinos_module_info_free (PinosModuleInfo *info)
|
||||
pinos_module_info_free (PinosModuleInfo *info)
|
||||
{
|
||||
if (info == NULL)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ SpaBuffer *
|
|||
pinos_serialize_buffer_deserialize (void *src, off_t offset)
|
||||
{
|
||||
SpaBuffer *b;
|
||||
unsigned int i;
|
||||
|
||||
b = SPA_MEMBER (src, offset, SpaBuffer);
|
||||
if (b->metas)
|
||||
|
|
|
|||
|
|
@ -1080,7 +1080,6 @@ pinos_stream_send_buffer (PinosStream *stream,
|
|||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
BufferId *bid;
|
||||
unsigned int i;
|
||||
|
||||
if ((bid = find_buffer (stream, id))) {
|
||||
uint8_t cmd = PINOS_TRANSPORT_CMD_HAVE_DATA;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue