mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
interface: add an interface struct
The interface struct has the type,version and methods of the interface. Make spa interfaces extend from spa_interface and make a separate structure for the methods. Pass a generic void* as the first argument of methods, like we don in PipeWire. Bundle the methods + implementation in a versioned inteface and use that to invoke methods. This way we can do version checks on the methods. Make resource and proxy interfaces that we can can call. We can then make the core interfaces independent on proxy/resource and hide them in the lower layers. Add add_listener method to methods of core interfaces, just like SPA.
This commit is contained in:
parent
eb6481efb3
commit
ff946e3d4b
85 changed files with 3051 additions and 3000 deletions
|
|
@ -280,10 +280,10 @@ static const struct spa_dbus_connection impl_connection = {
|
|||
};
|
||||
|
||||
static struct spa_dbus_connection *
|
||||
impl_get_connection(struct spa_dbus *dbus,
|
||||
impl_get_connection(void *object,
|
||||
enum spa_dbus_type type)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(dbus, struct impl, dbus);
|
||||
struct impl *impl = object;
|
||||
struct connection *conn;
|
||||
DBusError error;
|
||||
|
||||
|
|
@ -318,9 +318,9 @@ impl_get_connection(struct spa_dbus *dbus,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const struct spa_dbus impl_dbus = {
|
||||
SPA_VERSION_DBUS,
|
||||
impl_get_connection,
|
||||
static const struct spa_dbus_methods impl_dbus = {
|
||||
SPA_VERSION_DBUS_METHODS,
|
||||
.get_connection = impl_get_connection,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -372,7 +372,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct impl *) handle;
|
||||
spa_list_init(&this->connection_list);
|
||||
|
||||
this->dbus = impl_dbus;
|
||||
this->dbus.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_DBus,
|
||||
SPA_VERSION_DBUS,
|
||||
&impl_dbus, this);
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue