mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
pod: improve the vararg pod builder and parser
Automatically parse and build key/value when in objects without having to prefix the key with ":" Automatically build control/value when in sequence without the "." prefix. Remove the builder with key/pod, taking a reference to the stack built temporary pods is not allowed in c++. We can use the varargs version with the same convenient syntax. Remove the parser "*" option, it is unused. Improve spa_pod_builder_add_* and spa_pod_parser_get_* and make them look similar.
This commit is contained in:
parent
79d68ace68
commit
80cfda89c1
59 changed files with 1833 additions and 2005 deletions
|
|
@ -91,15 +91,15 @@ static void fill_item(struct spa_bt_monitor *this, struct spa_bt_device *device,
|
|||
char dev[16];
|
||||
|
||||
spa_pod_builder_push_object(builder, SPA_TYPE_OBJECT_MonitorItem, 0);
|
||||
spa_pod_builder_props(builder,
|
||||
SPA_MONITOR_ITEM_id, &SPA_POD_Stringv(device->path),
|
||||
SPA_MONITOR_ITEM_flags, &SPA_POD_Id(SPA_MONITOR_ITEM_FLAG_NONE),
|
||||
SPA_MONITOR_ITEM_state, &SPA_POD_Id(SPA_MONITOR_ITEM_STATE_Available),
|
||||
SPA_MONITOR_ITEM_name, &SPA_POD_Stringv(device->name),
|
||||
SPA_MONITOR_ITEM_class, &SPA_POD_Stringc("Adapter/Bluetooth"),
|
||||
SPA_MONITOR_ITEM_factory, &SPA_POD_Pointer(SPA_TYPE_INTERFACE_HandleFactory,
|
||||
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),
|
||||
SPA_MONITOR_ITEM_state, SPA_POD_Id(SPA_MONITOR_ITEM_STATE_Available),
|
||||
SPA_MONITOR_ITEM_name, SPA_POD_String(device->name),
|
||||
SPA_MONITOR_ITEM_class, SPA_POD_String("Adapter/Bluetooth"),
|
||||
SPA_MONITOR_ITEM_factory, SPA_POD_Pointer(SPA_TYPE_INTERFACE_HandleFactory,
|
||||
&spa_bluez5_device_factory),
|
||||
SPA_MONITOR_ITEM_type, &SPA_POD_Id(SPA_TYPE_INTERFACE_Device),
|
||||
SPA_MONITOR_ITEM_type, SPA_POD_Id(SPA_TYPE_INTERFACE_Device),
|
||||
0);
|
||||
|
||||
spa_pod_builder_prop(builder, SPA_MONITOR_ITEM_info, 0);
|
||||
|
|
@ -529,7 +529,7 @@ static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *devi
|
|||
return 0;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
event = spa_pod_builder_object(&b, SPA_TYPE_EVENT_Monitor, SPA_MONITOR_EVENT_Added, 0);
|
||||
event = spa_pod_builder_add_object(&b, SPA_TYPE_EVENT_Monitor, SPA_MONITOR_EVENT_Added);
|
||||
fill_item(monitor, device, &item, &b);
|
||||
|
||||
device->added = true;
|
||||
|
|
@ -549,7 +549,7 @@ static int device_remove(struct spa_bt_monitor *monitor, struct spa_bt_device *d
|
|||
return 0;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
event = spa_pod_builder_object(&b, SPA_TYPE_EVENT_Monitor, SPA_MONITOR_EVENT_Removed, 0);
|
||||
event = spa_pod_builder_add_object(&b, SPA_TYPE_EVENT_Monitor, SPA_MONITOR_EVENT_Removed);
|
||||
fill_item(monitor, device, &item, &b);
|
||||
|
||||
device->added = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue