mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-22 08:56:59 -05:00
small cleanups
This commit is contained in:
parent
141202b1fd
commit
94019fb1f5
3 changed files with 30 additions and 10 deletions
|
|
@ -193,20 +193,25 @@ static void
|
||||||
update_monitor (PinosCore *core,
|
update_monitor (PinosCore *core,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
PinosProperties *props;
|
|
||||||
const char *monitors;
|
const char *monitors;
|
||||||
|
SpaDictItem item;
|
||||||
|
SpaDict dict = SPA_DICT_INIT(1, &item);
|
||||||
|
|
||||||
if (!(props = core->properties))
|
if (core->properties)
|
||||||
props = pinos_properties_new (NULL, NULL);
|
monitors = pinos_properties_get (core->properties, "monitors");
|
||||||
|
|
||||||
monitors = pinos_properties_get (props, "monitors");
|
|
||||||
|
|
||||||
if (monitors == NULL)
|
|
||||||
pinos_properties_setf (props, "monitors", "%s", name);
|
|
||||||
else
|
else
|
||||||
pinos_properties_setf (props, "monitors", "%s,%s", monitors, name);
|
monitors = NULL;
|
||||||
|
|
||||||
pinos_core_update_properties (core, &props->dict);
|
item.key = "monitors";
|
||||||
|
if (monitors == NULL)
|
||||||
|
item.value = name;
|
||||||
|
else
|
||||||
|
asprintf ((char**)&item.value, "%s,%s", monitors, name);
|
||||||
|
|
||||||
|
pinos_core_update_properties (core, &dict);
|
||||||
|
|
||||||
|
if (monitors != NULL)
|
||||||
|
free ((void*)item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
PinosSpaMonitor *
|
PinosSpaMonitor *
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,7 @@ node_bind_func (PinosGlobal *global,
|
||||||
PinosNode *this = global->object;
|
PinosNode *this = global->object;
|
||||||
PinosResource *resource;
|
PinosResource *resource;
|
||||||
PinosNodeInfo info;
|
PinosNodeInfo info;
|
||||||
|
int i;
|
||||||
|
|
||||||
resource = pinos_resource_new (client,
|
resource = pinos_resource_new (client,
|
||||||
id,
|
id,
|
||||||
|
|
@ -428,6 +429,18 @@ node_bind_func (PinosGlobal *global,
|
||||||
|
|
||||||
pinos_node_notify_info (resource, &info);
|
pinos_node_notify_info (resource, &info);
|
||||||
|
|
||||||
|
if (info.input_formats) {
|
||||||
|
for (i = 0; i < info.n_input_formats; i++)
|
||||||
|
free (info.input_formats[i]);
|
||||||
|
free (info.input_formats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.output_formats) {
|
||||||
|
for (i = 0; i < info.n_output_formats; i++)
|
||||||
|
free (info.output_formats[i]);
|
||||||
|
free (info.output_formats);
|
||||||
|
}
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
||||||
no_mem:
|
no_mem:
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ struct _SpaDict {
|
||||||
SpaDictItem *items;
|
SpaDictItem *items;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SPA_DICT_INIT(n_items,items) { n_items, items }
|
||||||
|
|
||||||
#define spa_dict_for_each(item, dict) \
|
#define spa_dict_for_each(item, dict) \
|
||||||
for ((item) = (dict)->items; \
|
for ((item) = (dict)->items; \
|
||||||
(item) < &(dict)->items[(dict)->n_items]; \
|
(item) < &(dict)->items[(dict)->n_items]; \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue