diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 7528b0f65..b9a383cc4 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -887,7 +887,7 @@ impl_init(const struct spa_handle_factory *factory, if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL) return -EINVAL; - sscanf(str, "%p", &this->slave); + sscanf(str, "pointer:%p", &this->slave); if (this->slave == NULL) return -EINVAL; diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 8010e3e21..69e3d7a1a 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -1481,7 +1481,7 @@ impl_init(const struct spa_handle_factory *factory, for (i = 0; info && i < info->n_items; i++) { if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0) - sscanf(info->items[i].value, "%p", &this->transport); + sscanf(info->items[i].value, "pointer:%p", &this->transport); } if (this->transport == NULL) { spa_log_error(this->log, "a transport is needed"); diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 2c5d4cfb0..ebdc0b3f8 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -1178,7 +1178,7 @@ impl_init(const struct spa_handle_factory *factory, for (i = 0; info && i < info->n_items; i++) { if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0) - sscanf(info->items[i].value, "%p", &this->transport); + sscanf(info->items[i].value, "pointer:%p", &this->transport); } if (this->transport == NULL) { spa_log_error(this->log, "a transport is needed"); diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index 2dcecc953..768f7ee65 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -99,9 +99,9 @@ static int emit_source_node(struct impl *this) spa_list_for_each(t, &device->transport_list, device_link) { if (t->profile == profile) { struct spa_device_object_info info; - char transport[16]; + char transport[32]; - snprintf(transport, 16, "%p", t); + snprintf(transport, sizeof(transport), "pointer:%p", t); items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_TRANSPORT, transport); spa_bt_transport_acquire(t, true); @@ -148,9 +148,9 @@ static int emit_sink_node(struct impl *this) spa_list_for_each(t, &device->transport_list, device_link) { if (t->profile == profile) { struct spa_device_object_info info; - char transport[16]; + char transport[32]; - snprintf(transport, 16, "%p", t); + snprintf(transport, sizeof(transport), "pointer:%p", t); items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_TRANSPORT, transport); info = SPA_DEVICE_OBJECT_INFO_INIT(); @@ -301,7 +301,7 @@ impl_init(const struct spa_handle_factory *factory, for (i = 0; info && i < info->n_items; i++) { if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_DEVICE) == 0) - sscanf(info->items[i].value, "%p", &this->bt_dev); + sscanf(info->items[i].value, "pointer:%p", &this->bt_dev); } if (this->bt_dev == NULL) { spa_log_error(this->log, "a device is needed"); diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c index 64b7ec4fa..7f22d65dc 100644 --- a/spa/plugins/bluez5/bluez5-monitor.c +++ b/spa/plugins/bluez5/bluez5-monitor.c @@ -491,7 +491,7 @@ static int device_free(struct spa_bt_device *device) static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *device) { struct spa_monitor_object_info info; - char dev[16]; + char dev[32]; struct spa_dict_item items[20]; uint32_t n_items = 0; @@ -511,7 +511,7 @@ static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *devi items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_ICON_NAME, device->icon); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_PATH, device->path); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_ADDRESS, device->address); - snprintf(dev, sizeof(dev), "%p", device); + snprintf(dev, sizeof(dev), "pointer:%p", device); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_DEVICE, dev); info.props = &SPA_DICT_INIT(items, n_items); diff --git a/src/modules/module-adapter/adapter.c b/src/modules/module-adapter/adapter.c index b2a24fa23..5cc18d4e8 100644 --- a/src/modules/module-adapter/adapter.c +++ b/src/modules/module-adapter/adapter.c @@ -292,7 +292,7 @@ struct pw_node *pw_adapter_new(struct pw_core *core, mode = "split"; } - pw_properties_setf(props, "audio.adapt.slave", "%p", slave->node); + pw_properties_setf(props, "audio.adapt.slave", "pointer:%p", slave->node); pw_properties_set(props, "factory.mode", mode); pw_properties_set(props, SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert"); pw_properties_setf(props, PW_KEY_MEDIA_CLASS, "Audio/%s", diff --git a/src/modules/module-client-device/protocol-native.c b/src/modules/module-client-device/protocol-native.c index ed65e7f74..a283dcec9 100644 --- a/src/modules/module-client-device/protocol-native.c +++ b/src/modules/module-client-device/protocol-native.c @@ -30,6 +30,40 @@ #include +static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item) +{ + const char *str; + spa_pod_builder_string(b, item->key); + str = item->value; + if (strstr(str, "pointer:") == str) + str = ""; + spa_pod_builder_string(b, str); +} + +static inline int parse_item(struct spa_pod_parser *prs, struct spa_dict_item *item) +{ + int res; + if ((res = spa_pod_parser_get(prs, + SPA_POD_String(&item->key), + SPA_POD_String(&item->value), + NULL)) < 0) + return res; + if (strstr(item->value, "pointer:") == item->value) + item->value = ""; + return 0; +} + +static inline int parse_dict(struct spa_pod_parser *prs, struct spa_dict *dict) +{ + uint32_t i; + int res; + for (i = 0; i < dict->n_items; i++) { + if ((res = parse_item(prs, (struct spa_dict_item *) &dict->items[i])) < 0) + return res; + } + return 0; +} + static int device_marshal_add_listener(void *object, struct spa_hook *listener, const struct spa_device_events *events, @@ -179,11 +213,8 @@ static void device_marshal_info(void *object, SPA_POD_Long(change_mask), SPA_POD_Long(info->flags), SPA_POD_Int(n_items), NULL); - for (i = 0; i < n_items; i++) { - spa_pod_builder_add(b, - SPA_POD_String(info->props->items[i].key), - SPA_POD_String(info->props->items[i].value), NULL); - } + for (i = 0; i < n_items; i++) + push_item(b, &info->props->items[i]); spa_pod_builder_add(b, SPA_POD_Int(info->n_params), NULL); for (i = 0; i < info->n_params; i++) { @@ -238,12 +269,8 @@ static int device_demarshal_info(void *object, info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&p2, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&p2, &props) < 0) + return -EINVAL; } if (spa_pod_parser_get(&p2, SPA_POD_Int(&info.n_params), NULL) < 0) @@ -400,11 +427,8 @@ static void device_marshal_object_info(void *object, uint32_t id, SPA_POD_Long(change_mask), SPA_POD_Long(info->flags), SPA_POD_Int(n_items), NULL); - for (i = 0; i < n_items; i++) { - spa_pod_builder_add(b, - SPA_POD_String(info->props->items[i].key), - SPA_POD_String(info->props->items[i].value), NULL); - } + for (i = 0; i < n_items; i++) + push_item(b, &info->props->items[i]); spa_pod_builder_pop(b, &f[1]); } else { spa_pod_builder_add(b, @@ -423,7 +447,7 @@ static int device_demarshal_object_info(void *object, struct spa_device_object_info info = SPA_DEVICE_OBJECT_INFO_INIT(), *infop; struct spa_pod *ipod; struct spa_dict props; - uint32_t i, id; + uint32_t id; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_get_struct(&prs, @@ -452,12 +476,8 @@ static int device_demarshal_object_info(void *object, info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&p2, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&p2, &props) < 0) + return -EINVAL; } } else { infop = NULL; diff --git a/src/modules/module-client-node/protocol-native.c b/src/modules/module-client-node/protocol-native.c index de5521002..e036afc27 100644 --- a/src/modules/module-client-node/protocol-native.c +++ b/src/modules/module-client-node/protocol-native.c @@ -31,6 +31,16 @@ #include #include +static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item) +{ + const char *str; + spa_pod_builder_string(b, item->key); + str = item->value; + if (strstr(str, "pointer:") == str) + str = ""; + spa_pod_builder_string(b, str); +} + static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict) { uint32_t i, n_items; @@ -40,13 +50,35 @@ static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict) spa_pod_builder_push_struct(b, &f); spa_pod_builder_int(b, n_items); - for (i = 0; i < n_items; i++) { - spa_pod_builder_string(b, dict->items[i].key); - spa_pod_builder_string(b, dict->items[i].value); - } + for (i = 0; i < n_items; i++) + push_item(b, &dict->items[i]); spa_pod_builder_pop(b, &f); } +static inline int parse_item(struct spa_pod_parser *prs, struct spa_dict_item *item) +{ + int res; + if ((res = spa_pod_parser_get(prs, + SPA_POD_String(&item->key), + SPA_POD_String(&item->value), + NULL)) < 0) + return res; + if (strstr(item->value, "pointer:") == item->value) + item->value = ""; + return 0; +} + +static inline int parse_dict(struct spa_pod_parser *prs, struct spa_dict *dict) +{ + uint32_t i; + int res; + for (i = 0; i < dict->n_items; i++) { + if ((res = parse_item(prs, (struct spa_dict_item *) &dict->items[i])) < 0) + return res; + } + return 0; +} + static int client_node_marshal_add_listener(void *object, struct spa_hook *listener, const struct pw_client_node_proxy_events *events, @@ -120,11 +152,8 @@ client_node_marshal_update(void *object, SPA_POD_Long(change_mask), SPA_POD_Long(info->flags), SPA_POD_Int(n_items), NULL); - for (i = 0; i < n_items; i++) { - spa_pod_builder_add(b, - SPA_POD_String(info->props->items[i].key), - SPA_POD_String(info->props->items[i].value), NULL); - } + for (i = 0; i < n_items; i++) + push_item(b, &info->props->items[i]); spa_pod_builder_add(b, SPA_POD_Int(info->n_params), NULL); for (i = 0; i < info->n_params; i++) { @@ -187,11 +216,8 @@ client_node_marshal_port_update(void *object, SPA_POD_Int(info->rate.num), SPA_POD_Int(info->rate.denom), SPA_POD_Int(n_items), NULL); - for (i = 0; i < n_items; i++) { - spa_pod_builder_add(b, - SPA_POD_String(info->props->items[i].key), - SPA_POD_String(info->props->items[i].value), NULL); - } + for (i = 0; i < n_items; i++) + push_item(b, &info->props->items[i]); spa_pod_builder_add(b, SPA_POD_Int(info->n_params), NULL); for (i = 0; i < info->n_params; i++) { @@ -340,7 +366,6 @@ static int client_node_demarshal_add_port(void *object, const struct pw_protocol struct spa_pod_frame f[2]; int32_t direction, port_id; struct spa_dict props; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0) @@ -358,13 +383,8 @@ static int client_node_demarshal_add_port(void *object, const struct pw_protocol return -EINVAL; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), - NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_port, 0, direction, port_id, props.n_items ? &props : NULL); @@ -876,12 +896,8 @@ static int client_node_demarshal_update(void *object, const struct pw_protocol_n info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&p2, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&p2, &props) < 0) + return -EINVAL; } if (spa_pod_parser_get(&p2, SPA_POD_Int(&info.n_params), NULL) < 0) @@ -958,12 +974,8 @@ static int client_node_demarshal_port_update(void *object, const struct pw_proto info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&p2, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&p2, &props) < 0) + return -EINVAL; } if (spa_pod_parser_get(&p2, SPA_POD_Int(&info.n_params), NULL) < 0) diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index 8199f7ede..d9c06a83c 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -125,6 +125,16 @@ static struct pw_registry_proxy * core_method_marshal_get_registry(void *object, return (struct pw_registry_proxy *) res; } +static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item) +{ + const char *str; + spa_pod_builder_string(b, item->key); + str = item->value; + if (strstr(str, "pointer:") == str) + str = ""; + spa_pod_builder_string(b, str); +} + static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict) { uint32_t i, n_items; @@ -134,13 +144,35 @@ static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict) spa_pod_builder_push_struct(b, &f); spa_pod_builder_int(b, n_items); - for (i = 0; i < n_items; i++) { - spa_pod_builder_string(b, dict->items[i].key); - spa_pod_builder_string(b, dict->items[i].value); - } + for (i = 0; i < n_items; i++) + push_item(b, &dict->items[i]); spa_pod_builder_pop(b, &f); } +static inline int parse_item(struct spa_pod_parser *prs, struct spa_dict_item *item) +{ + int res; + if ((res = spa_pod_parser_get(prs, + SPA_POD_String(&item->key), + SPA_POD_String(&item->value), + NULL)) < 0) + return res; + if (strstr(item->value, "pointer:") == item->value) + item->value = ""; + return 0; +} + +static inline int parse_dict(struct spa_pod_parser *prs, struct spa_dict *dict) +{ + uint32_t i; + int res; + for (i = 0; i < dict->n_items; i++) { + if ((res = parse_item(prs, (struct spa_dict_item *) &dict->items[i])) < 0) + return res; + } + return 0; +} + static void push_params(struct spa_pod_builder *b, uint32_t n_params, const struct spa_param_info *params) { @@ -213,7 +245,6 @@ static int core_event_demarshal_info(void *object, const struct pw_protocol_nati struct spa_pod_frame f[2]; struct pw_core_info info; struct spa_pod_parser prs; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0) @@ -236,13 +267,9 @@ static int core_event_demarshal_info(void *object, const struct pw_protocol_nati info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), - NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_proxy_notify(proxy, struct pw_core_proxy_events, info, 0, &info); } @@ -473,7 +500,7 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro struct pw_resource *resource = object; struct spa_pod_parser prs; struct spa_pod_frame f[2]; - uint32_t version, type, new_id, i; + uint32_t version, type, new_id; const char *factory_name; struct spa_dict props; @@ -492,12 +519,8 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro return -EINVAL; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; spa_pod_parser_pop(&prs, &f[1]); if (spa_pod_parser_get(&prs, @@ -650,7 +673,6 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m struct spa_pod_frame f[2]; struct spa_dict props; struct pw_module_info info; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 || @@ -669,12 +691,9 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_proxy_notify(proxy, struct pw_module_proxy_events, info, 0, &info); } @@ -733,12 +752,8 @@ static int device_demarshal_info(void *object, const struct pw_protocol_native_m info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; spa_pod_parser_pop(&prs, &f[1]); if (spa_pod_parser_push_struct(&prs, &f[1]) < 0 || @@ -908,7 +923,6 @@ static int factory_demarshal_info(void *object, const struct pw_protocol_native_ struct spa_pod_frame f[2]; struct spa_dict props; struct pw_factory_info info; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 || @@ -927,12 +941,9 @@ static int factory_demarshal_info(void *object, const struct pw_protocol_native_ info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_proxy_notify(proxy, struct pw_factory_proxy_events, info, 0, &info); } @@ -1003,12 +1014,8 @@ static int node_demarshal_info(void *object, const struct pw_protocol_native_mes info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; spa_pod_parser_pop(&prs, &f[1]); if (spa_pod_parser_push_struct(&prs, &f[1]) < 0 || @@ -1251,12 +1258,8 @@ static int port_demarshal_info(void *object, const struct pw_protocol_native_mes info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; spa_pod_parser_pop(&prs, &f[1]); if (spa_pod_parser_push_struct(&prs, &f[1]) < 0 || @@ -1422,7 +1425,6 @@ static int client_demarshal_info(void *object, const struct pw_protocol_native_m struct spa_pod_frame f[2]; struct spa_dict props; struct pw_client_info info; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 || @@ -1438,12 +1440,9 @@ static int client_demarshal_info(void *object, const struct pw_protocol_native_m info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_proxy_notify(proxy, struct pw_client_proxy_events, info, 0, &info); } @@ -1573,7 +1572,6 @@ static int client_demarshal_update_properties(void *object, const struct pw_prot struct spa_dict props; struct spa_pod_parser prs; struct spa_pod_frame f[2]; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 || @@ -1583,12 +1581,9 @@ static int client_demarshal_update_properties(void *object, const struct pw_prot return -EINVAL; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_resource_notify(resource, struct pw_client_proxy_methods, update_properties, 0, &props); } @@ -1697,7 +1692,6 @@ static int link_demarshal_info(void *object, const struct pw_protocol_native_mes struct spa_pod_frame f[2]; struct spa_dict props; struct pw_link_info info = { 0, }; - uint32_t i; spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 || @@ -1720,12 +1714,9 @@ static int link_demarshal_info(void *object, const struct pw_protocol_native_mes info.props = &props; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; + return pw_proxy_notify(proxy, struct pw_link_proxy_events, info, 0, &info); } @@ -1734,7 +1725,7 @@ static int registry_demarshal_global(void *object, const struct pw_protocol_nati struct pw_proxy *proxy = object; struct spa_pod_parser prs; struct spa_pod_frame f[2]; - uint32_t id, parent_id, permissions, type, version, i; + uint32_t id, parent_id, permissions, type, version; struct spa_dict props; spa_pod_parser_init(&prs, msg->data, msg->size); @@ -1753,12 +1744,8 @@ static int registry_demarshal_global(void *object, const struct pw_protocol_nati return -EINVAL; props.items = alloca(props.n_items * sizeof(struct spa_dict_item)); - for (i = 0; i < props.n_items; i++) { - if (spa_pod_parser_get(&prs, - SPA_POD_String(&props.items[i].key), - SPA_POD_String(&props.items[i].value), NULL) < 0) - return -EINVAL; - } + if (parse_dict(&prs, &props) < 0) + return -EINVAL; return pw_proxy_notify(proxy, struct pw_registry_proxy_events, global, 0, id, parent_id, permissions, type, version,