mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
cleanups
Remove signals. Rename callbacks -> events, use listeners to listen for events. Callbacks are still used in spa for things you can listen to only once.
This commit is contained in:
parent
b898eb46cd
commit
1b79419554
64 changed files with 779 additions and 880 deletions
|
|
@ -24,7 +24,6 @@
|
|||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
struct data {
|
||||
bool running;
|
||||
|
|
@ -32,12 +31,12 @@ struct data {
|
|||
struct pw_core *core;
|
||||
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_callback_info registry_listener;
|
||||
struct pw_listener registry_listener;
|
||||
};
|
||||
|
||||
struct proxy_data {
|
||||
|
|
@ -49,8 +48,8 @@ struct proxy_data {
|
|||
uint32_t type;
|
||||
void *info;
|
||||
pw_destroy_t destroy;
|
||||
struct pw_callback_info proxy_listener;
|
||||
struct pw_callback_info proxy_callbacks;
|
||||
struct pw_listener proxy_listener;
|
||||
struct pw_listener proxy_proxy_listener;
|
||||
};
|
||||
|
||||
static void print_properties(struct spa_dict *props, char mark)
|
||||
|
|
@ -115,8 +114,8 @@ static void module_event_info(void *object, struct pw_module_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_module_events module_events = {
|
||||
PW_VERSION_MODULE_EVENTS,
|
||||
static const struct pw_module_proxy_events module_events = {
|
||||
PW_VERSION_MODULE_PROXY_EVENTS,
|
||||
.info = module_event_info,
|
||||
};
|
||||
|
||||
|
|
@ -167,8 +166,8 @@ static void node_event_info(void *object, struct pw_node_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
static const struct pw_node_proxy_events node_events = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
.info = node_event_info
|
||||
};
|
||||
|
||||
|
|
@ -201,8 +200,8 @@ static void client_event_info(void *object, struct pw_client_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_client_events client_events = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
static const struct pw_client_proxy_events client_events = {
|
||||
PW_VERSION_CLIENT_PROXY_EVENTS,
|
||||
.info = client_event_info
|
||||
};
|
||||
|
||||
|
|
@ -243,8 +242,8 @@ static void link_event_info(void *object, struct pw_link_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_link_events link_events = {
|
||||
PW_VERSION_LINK_EVENTS,
|
||||
static const struct pw_link_proxy_events link_events = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
.info = link_event_info
|
||||
};
|
||||
|
||||
|
|
@ -261,8 +260,8 @@ destroy_proxy (void *data)
|
|||
user_data->info = NULL;
|
||||
}
|
||||
|
||||
static const struct pw_proxy_callbacks proxy_callbacks = {
|
||||
PW_VERSION_PROXY_CALLBACKS,
|
||||
static const struct pw_proxy_events proxy_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.destroy = destroy_proxy,
|
||||
};
|
||||
|
||||
|
|
@ -322,8 +321,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id,
|
|||
pd->permissions = permissions;
|
||||
pd->version = version;
|
||||
pd->destroy = destroy;
|
||||
pw_proxy_add_listener(proxy, &pd->proxy_listener, events, pd);
|
||||
pw_proxy_add_callbacks(proxy, &pd->proxy_callbacks, &proxy_callbacks, pd);
|
||||
pw_proxy_add_proxy_listener(proxy, &pd->proxy_proxy_listener, events, pd);
|
||||
pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
|
||||
|
||||
return;
|
||||
|
||||
|
|
@ -338,8 +337,8 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
|||
printf("\tid: %u\n", id);
|
||||
}
|
||||
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -374,8 +373,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.info_changed = on_info_changed,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
|
@ -391,7 +390,7 @@ int main(int argc, char *argv[])
|
|||
data.core = pw_core_new(data.loop, NULL);
|
||||
data.remote = pw_remote_new(data.core, NULL);
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
pw_loop_enter(data.loop);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue