Do a do_sync after setting the metadata to ensure the messages are
flushed to the server and processed. Fixes an issue where jack_property
would exit before the messages are flushed and so nothing happens.
We must use the serial for generating the uuid.
We use the serial for the port_id and jack_port_uuid_generate() can
be used to turn that into a uuid. So all mappings to and from
uuid need to be with serials.
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
Only emit callbacks when something changed.
When setting a value, first update the local store. This triggers
the emit from the calling thread (as expected by jack clients) and
when the update arrives from the server, it will not emit the callback
anymore because the value didn't change.
Protect the global metadata with a lock because we update this from
multiple clients. Avoid updating the metadata if it didn't change.
Add a simple lock to protect the session objects, they could be
accessed from the main thread or data thread. Use the simple lock
in methods that just read.
Use the new data loop invoke to make sure we sync the data update
with the data thread.
Stop the data loop when our position io is removed.
Rework the metadata implementation without pw_properties to make
it easier to delete all subjects and implement the metadata API.
Remove metadata from all objects when they are destroyed.