mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-17 07:00:03 -05:00
Add client info message
Update client info and improve core info
This commit is contained in:
parent
2f18af1fb2
commit
ff5e260d67
11 changed files with 165 additions and 21 deletions
|
|
@ -179,3 +179,36 @@ pinos_client_destroy (PinosClient * client)
|
|||
sync_destroy,
|
||||
client);
|
||||
}
|
||||
|
||||
void
|
||||
pinos_client_update_properties (PinosClient *client,
|
||||
const SpaDict *dict)
|
||||
{
|
||||
PinosMessageClientInfo m;
|
||||
PinosClientInfo info;
|
||||
PinosResource *resource;
|
||||
|
||||
if (client->properties == NULL) {
|
||||
if (dict)
|
||||
client->properties = pinos_properties_new_dict (dict);
|
||||
} else {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < dict->n_items; i++)
|
||||
pinos_properties_set (client->properties,
|
||||
dict->items[i].key,
|
||||
dict->items[i].value);
|
||||
}
|
||||
|
||||
m.info = &info;
|
||||
info.id = client->global->id;
|
||||
info.change_mask = 1 << 0;
|
||||
info.props = client->properties ? &client->properties->dict : NULL;
|
||||
|
||||
spa_list_for_each (resource, &client->resource_list, link) {
|
||||
pinos_resource_send_message (resource,
|
||||
PINOS_MESSAGE_CLIENT_INFO,
|
||||
&m,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ struct _PinosClient {
|
|||
PinosClient * pinos_client_new (PinosCore *core,
|
||||
PinosProperties *properties);
|
||||
void pinos_client_destroy (PinosClient *client);
|
||||
void pinos_client_update_properties (PinosClient *client,
|
||||
const SpaDict *dict);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include <time.h>
|
||||
|
||||
#include <pinos/client/pinos.h>
|
||||
#include <pinos/server/core.h>
|
||||
|
|
@ -87,6 +88,15 @@ core_dispatch_func (void *object,
|
|||
PinosCore *this = data;
|
||||
|
||||
switch (type) {
|
||||
case PINOS_MESSAGE_CLIENT_UPDATE:
|
||||
{
|
||||
PinosMessageClientUpdate *m = message;
|
||||
|
||||
pinos_client_update_properties (client,
|
||||
m->props);
|
||||
break;
|
||||
}
|
||||
|
||||
case PINOS_MESSAGE_GET_REGISTRY:
|
||||
{
|
||||
PinosMessageGetRegistry *m = message;
|
||||
|
|
@ -189,11 +199,12 @@ core_bind_func (PinosGlobal *global,
|
|||
m.info = &info;
|
||||
info.id = global->id;
|
||||
info.change_mask = ~0;
|
||||
info.user_name = "wim";
|
||||
info.host_name = "wtay";
|
||||
info.version = 0;
|
||||
info.user_name = pinos_get_user_name ();
|
||||
info.host_name = pinos_get_host_name ();
|
||||
info.version = "0";
|
||||
info.name = "pinos-0";
|
||||
info.cookie = 0;
|
||||
srandom (time (NULL));
|
||||
info.cookie = random ();
|
||||
info.props = NULL;
|
||||
|
||||
pinos_resource_send_message (resource,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue