mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
remote: add _get_fd method
Add a method to get the fd of the connection.
This commit is contained in:
parent
a79e8923b5
commit
bc35d30407
5 changed files with 22 additions and 0 deletions
|
|
@ -527,6 +527,15 @@ static int impl_connect(struct pw_protocol_client *client)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int impl_get_fd(struct pw_protocol_client *client)
|
||||
{
|
||||
struct client *impl = SPA_CONTAINER_OF(client, struct client, this);
|
||||
|
||||
if (impl->source == NULL)
|
||||
return -EIO;
|
||||
|
||||
return impl->source->fd;
|
||||
}
|
||||
|
||||
static void
|
||||
on_remote_data(void *data, int fd, enum spa_io mask)
|
||||
|
|
@ -698,6 +707,7 @@ impl_new_client(struct pw_protocol *protocol,
|
|||
impl->properties = properties ? pw_properties_copy(properties) : NULL;
|
||||
|
||||
this->connect = impl_connect;
|
||||
this->get_fd = impl_get_fd;
|
||||
this->connect_fd = impl_connect_fd;
|
||||
this->disconnect = impl_disconnect;
|
||||
this->destroy = impl_destroy;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ pw_global_register(struct pw_global *global,
|
|||
|
||||
spa_list_for_each(registry, &core->registry_resource_list, link) {
|
||||
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
||||
pw_log_debug("registry %p: global %d %08x", registry, global->id, permissions);
|
||||
if (PW_PERM_IS_R(permissions))
|
||||
pw_registry_resource_global(registry,
|
||||
global->id,
|
||||
|
|
@ -240,6 +241,7 @@ void pw_global_destroy(struct pw_global *global)
|
|||
if (global->id != SPA_ID_INVALID) {
|
||||
spa_list_for_each(registry, &core->registry_resource_list, link) {
|
||||
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
||||
pw_log_debug("registry %p: global %d %08x", registry, global->id, permissions);
|
||||
if (PW_PERM_IS_R(permissions))
|
||||
pw_registry_resource_global_remove(registry, global->id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,14 @@ struct pw_protocol_client {
|
|||
struct pw_remote *remote; /**< the associated remote */
|
||||
|
||||
int (*connect) (struct pw_protocol_client *client);
|
||||
int (*get_fd) (struct pw_protocol_client *client);
|
||||
int (*connect_fd) (struct pw_protocol_client *client, int fd);
|
||||
void (*disconnect) (struct pw_protocol_client *client);
|
||||
void (*destroy) (struct pw_protocol_client *client);
|
||||
};
|
||||
|
||||
#define pw_protocol_client_connect(c) ((c)->connect(c))
|
||||
#define pw_protocol_client_get_fd(c) ((c)->get_fd(c))
|
||||
#define pw_protocol_client_connect_fd(c,fd) ((c)->connect_fd(c,fd))
|
||||
#define pw_protocol_client_disconnect(c) ((c)->disconnect(c))
|
||||
#define pw_protocol_client_destroy(c) ((c)->destroy(c))
|
||||
|
|
|
|||
|
|
@ -404,6 +404,11 @@ int pw_remote_connect_fd(struct pw_remote *remote, int fd)
|
|||
return do_connect(remote);
|
||||
}
|
||||
|
||||
int pw_remote_get_fd(struct pw_remote *remote)
|
||||
{
|
||||
return pw_protocol_client_get_fd(remote->conn);
|
||||
}
|
||||
|
||||
int pw_remote_disconnect(struct pw_remote *remote)
|
||||
{
|
||||
struct pw_proxy *proxy, *t2;
|
||||
|
|
|
|||
|
|
@ -178,6 +178,9 @@ int pw_remote_connect(struct pw_remote *remote);
|
|||
* \return 0 on success, < 0 on error */
|
||||
int pw_remote_connect_fd(struct pw_remote *remote, int fd);
|
||||
|
||||
/** Get the fd of the remote connection or < 0 on error */
|
||||
int pw_remote_get_fd(struct pw_remote *remote);
|
||||
|
||||
/** Get the core proxy, can only be called when connected */
|
||||
struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue