summaryrefslogtreecommitdiff
path: root/spa/plugins/bluez5
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-01-22 17:38:23 +0100
committerWim Taymans <wtaymans@redhat.com>2019-01-22 17:38:23 +0100
commit351fb9ce295200db1065a7af1d2f40dd9c60cfbd (patch)
tree682c99f1a9e916909970a98cb284bd16f8253b2c /spa/plugins/bluez5
parent878ae769ef4d6addfc4321a3d8df890b24aecfd2 (diff)
pod: improve parser and builder
Remove the spa_pod_iter helpers Remove builder/parser vararg recurse option, you have to manually recurse into structures when needed. This simplifies things a lot. Pass spa_pod_frames to builder and parser explicitly, we don't have to keep an internal stack anymore. The parser is now almost a mirror image of the builder. Make the parser safer when iterating over objects, add functions to check and get pod contents in a safe way. Make the builder return errno style results on errors Improve performance of object properties when they are stored and retrieved in the same order. Add many more tests for the builder and parser Add some benchmarks
Diffstat (limited to 'spa/plugins/bluez5')
-rw-r--r--spa/plugins/bluez5/bluez5-monitor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c
index 7916c911..7f9dd349 100644
--- a/spa/plugins/bluez5/bluez5-monitor.c
+++ b/spa/plugins/bluez5/bluez5-monitor.c
@@ -89,8 +89,9 @@ static void fill_item(struct spa_bt_monitor *this, struct spa_bt_device *device,
struct spa_pod **result, struct spa_pod_builder *builder)
{
char dev[16];
+ struct spa_pod_frame f[2];
- spa_pod_builder_push_object(builder, SPA_TYPE_OBJECT_MonitorItem, 0);
+ spa_pod_builder_push_object(builder, &f[0], SPA_TYPE_OBJECT_MonitorItem, 0);
spa_pod_builder_add(builder,
SPA_MONITOR_ITEM_id, SPA_POD_String(device->path),
SPA_MONITOR_ITEM_flags, SPA_POD_Id(SPA_MONITOR_ITEM_FLAG_NONE),
@@ -103,7 +104,7 @@ static void fill_item(struct spa_bt_monitor *this, struct spa_bt_device *device,
0);
spa_pod_builder_prop(builder, SPA_MONITOR_ITEM_info, 0);
- spa_pod_builder_push_struct(builder);
+ spa_pod_builder_push_struct(builder, &f[1]);
snprintf(dev, sizeof(dev), "%p", device);
add_dict(builder, "device.api", "bluez5");
@@ -113,8 +114,8 @@ static void fill_item(struct spa_bt_monitor *this, struct spa_bt_device *device,
add_dict(builder, "device.bluez5.address", device->address);
add_dict(builder, "bluez5.device", dev);
- spa_pod_builder_pop(builder);
- *result = spa_pod_builder_pop(builder);
+ spa_pod_builder_pop(builder, &f[1]);
+ *result = spa_pod_builder_pop(builder, &f[0]);
}
static uint8_t a2dp_default_bitpool(struct spa_bt_monitor *monitor, uint8_t freq, uint8_t mode) {