mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04: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
|
|
@ -99,14 +99,14 @@ static void fill_item(struct impl *this, struct udev_device *dev,
|
|||
name = "Unknown";
|
||||
|
||||
spa_pod_builder_push_object(builder, SPA_TYPE_OBJECT_MonitorItem, 0);
|
||||
spa_pod_builder_props(builder,
|
||||
SPA_MONITOR_ITEM_id, &SPA_POD_Stringv(udev_device_get_syspath(dev)),
|
||||
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(name),
|
||||
SPA_MONITOR_ITEM_class, &SPA_POD_Stringc("Video/Device"),
|
||||
SPA_MONITOR_ITEM_factory, &SPA_POD_Pointer(SPA_TYPE_INTERFACE_HandleFactory, &spa_v4l2_device_factory),
|
||||
SPA_MONITOR_ITEM_type, &SPA_POD_Id(SPA_TYPE_INTERFACE_Device),
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_MONITOR_ITEM_id, SPA_POD_String(udev_device_get_syspath(dev)),
|
||||
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(name),
|
||||
SPA_MONITOR_ITEM_class, SPA_POD_String("Video/Device"),
|
||||
SPA_MONITOR_ITEM_factory, SPA_POD_Pointer(SPA_TYPE_INTERFACE_HandleFactory, &spa_v4l2_device_factory),
|
||||
SPA_MONITOR_ITEM_type, SPA_POD_Id(SPA_TYPE_INTERFACE_Device),
|
||||
0);
|
||||
|
||||
spa_pod_builder_prop(builder, SPA_MONITOR_ITEM_info, 0);
|
||||
|
|
@ -171,7 +171,7 @@ static int emit_device(struct impl *this, uint32_t id, struct udev_device *dev)
|
|||
struct spa_pod *item;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
event = spa_pod_builder_object(&b, SPA_TYPE_EVENT_Monitor, id, 0);
|
||||
event = spa_pod_builder_add_object(&b, SPA_TYPE_EVENT_Monitor, id);
|
||||
fill_item(this, dev, &item, &b);
|
||||
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue