mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -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,
|
||||
const char *name)
|
||||
{
|
||||
PinosProperties *props;
|
||||
const char *monitors;
|
||||
SpaDictItem item;
|
||||
SpaDict dict = SPA_DICT_INIT(1, &item);
|
||||
|
||||
if (!(props = core->properties))
|
||||
props = pinos_properties_new (NULL, NULL);
|
||||
|
||||
monitors = pinos_properties_get (props, "monitors");
|
||||
|
||||
if (monitors == NULL)
|
||||
pinos_properties_setf (props, "monitors", "%s", name);
|
||||
if (core->properties)
|
||||
monitors = pinos_properties_get (core->properties, "monitors");
|
||||
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 *
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ node_bind_func (PinosGlobal *global,
|
|||
PinosNode *this = global->object;
|
||||
PinosResource *resource;
|
||||
PinosNodeInfo info;
|
||||
int i;
|
||||
|
||||
resource = pinos_resource_new (client,
|
||||
id,
|
||||
|
|
@ -428,6 +429,18 @@ node_bind_func (PinosGlobal *global,
|
|||
|
||||
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;
|
||||
|
||||
no_mem:
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ struct _SpaDict {
|
|||
SpaDictItem *items;
|
||||
};
|
||||
|
||||
#define SPA_DICT_INIT(n_items,items) { n_items, items }
|
||||
|
||||
#define spa_dict_for_each(item, dict) \
|
||||
for ((item) = (dict)->items; \
|
||||
(item) < &(dict)->items[(dict)->n_items]; \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue