mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
remote: remove some events
Remove some events from the remote that we can find on the core_proxy. Use the core_proxy to get to the done and info events. Remove pw_remote_get_core_info(), we don't need this anymore now that we don't listen for the event and the user can keep track of this herself.
This commit is contained in:
parent
349a11cde5
commit
66bab1d9b2
11 changed files with 93 additions and 137 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 5de91e837e0d395dfdb4559bded4946e3663b6cb
|
||||
Subproject commit 16874536363649535cfdda5227e9108ec158127a
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0de0de299a53fe8ab561d3eefffbe6bc66645777
|
||||
Subproject commit 14573f120124c237637b3129dc3f031b17f492b0
|
||||
|
|
@ -574,7 +574,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
|
||||
pw_remote_connect(data.remote);
|
||||
if (pw_remote_connect(data.remote) < 0)
|
||||
return -1;
|
||||
|
||||
pw_main_loop_run(data.loop);
|
||||
|
||||
|
|
|
|||
|
|
@ -1274,6 +1274,18 @@ static void do_rescan(struct impl *impl)
|
|||
rescan_node(impl, node);
|
||||
}
|
||||
|
||||
static void core_done(void *data, uint32_t seq)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
if (impl->seq == seq)
|
||||
do_rescan(impl);
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.done = core_done
|
||||
};
|
||||
|
||||
static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remote_state state, const char *error)
|
||||
{
|
||||
struct impl *impl = _data;
|
||||
|
|
@ -1287,6 +1299,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
case PW_REMOTE_STATE_CONNECTED:
|
||||
pw_log_info(NAME" %p: connected", impl);
|
||||
impl->core_proxy = pw_remote_get_core_proxy(impl->remote);
|
||||
pw_core_proxy_add_listener(impl->core_proxy,
|
||||
&impl->core_listener,
|
||||
&core_events, impl);
|
||||
impl->registry_proxy = pw_core_proxy_get_registry(impl->core_proxy,
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
|
|
@ -1309,17 +1324,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
}
|
||||
}
|
||||
|
||||
static void remote_sync_reply(void *data, uint32_t seq)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
if (impl->seq == seq)
|
||||
do_rescan(impl);
|
||||
}
|
||||
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
.sync_reply = remote_sync_reply
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
@ -1342,7 +1349,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
pw_remote_add_listener(impl.remote, &impl.remote_listener, &remote_events, &impl);
|
||||
|
||||
pw_remote_connect(impl.remote);
|
||||
if (pw_remote_connect(impl.remote) < 0)
|
||||
return -1;
|
||||
|
||||
pw_main_loop_run(impl.loop);
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ struct pending {
|
|||
struct remote_data {
|
||||
uint32_t seq;
|
||||
GstPipeWireDeviceProvider *self;
|
||||
struct spa_hook core_listener;
|
||||
struct pw_registry_proxy *registry;
|
||||
struct spa_hook registry_listener;
|
||||
struct spa_list nodes;
|
||||
|
|
@ -272,12 +273,31 @@ static void do_add_node(void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_core_info (struct pw_remote *remote,
|
||||
void *user_data)
|
||||
static void add_pending(GstPipeWireDeviceProvider *self, struct pending *p,
|
||||
void (*callback) (void *data), void *data)
|
||||
{
|
||||
GstDeviceProvider *provider = user_data;
|
||||
const struct pw_core_info *info = pw_remote_get_core_info(remote);
|
||||
spa_list_append(&self->pending, &p->link);
|
||||
p->callback = callback;
|
||||
p->data = data;
|
||||
p->seq = ++self->seq;
|
||||
pw_log_debug("add pending %d", p->seq);
|
||||
pw_core_proxy_sync(self->core_proxy, p->seq);
|
||||
}
|
||||
|
||||
static void remove_pending(struct pending *p)
|
||||
{
|
||||
if (p->seq != SPA_ID_INVALID) {
|
||||
pw_log_debug("remove pending %d", p->seq);
|
||||
spa_list_remove(&p->link);
|
||||
p->seq = SPA_ID_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_core_info (void *data, const struct pw_core_info *info)
|
||||
{
|
||||
GstPipeWireDeviceProvider *self = data;
|
||||
GstDeviceProvider *provider = (GstDeviceProvider*)self;
|
||||
const gchar *value;
|
||||
|
||||
if (info == NULL || info->props == NULL)
|
||||
|
|
@ -300,28 +320,8 @@ get_core_info (struct pw_remote *remote,
|
|||
}
|
||||
}
|
||||
|
||||
static void add_pending(GstPipeWireDeviceProvider *self, struct pending *p,
|
||||
void (*callback) (void *data), void *data)
|
||||
{
|
||||
spa_list_append(&self->pending, &p->link);
|
||||
p->callback = callback;
|
||||
p->data = data;
|
||||
p->seq = ++self->seq;
|
||||
pw_log_debug("add pending %d", p->seq);
|
||||
pw_core_proxy_sync(self->core_proxy, p->seq);
|
||||
}
|
||||
|
||||
static void remove_pending(struct pending *p)
|
||||
{
|
||||
if (p->seq != SPA_ID_INVALID) {
|
||||
pw_log_debug("remove pending %d", p->seq);
|
||||
spa_list_remove(&p->link);
|
||||
p->seq = SPA_ID_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_sync_reply (void *data, uint32_t seq)
|
||||
on_core_done (void *data, uint32_t seq)
|
||||
{
|
||||
GstPipeWireDeviceProvider *self = data;
|
||||
struct pending *p, *t;
|
||||
|
|
@ -341,10 +341,17 @@ on_sync_reply (void *data, uint32_t seq)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
};
|
||||
|
||||
static void
|
||||
on_state_changed (void *data, enum pw_remote_state old, enum pw_remote_state state, const char *error)
|
||||
{
|
||||
GstPipeWireDeviceProvider *self = data;
|
||||
struct remote_data *rd = data;
|
||||
GstPipeWireDeviceProvider *self = rd->self;
|
||||
|
||||
GST_DEBUG ("got remote state %d", state);
|
||||
|
||||
|
|
@ -353,6 +360,8 @@ on_state_changed (void *data, enum pw_remote_state old, enum pw_remote_state sta
|
|||
break;
|
||||
case PW_REMOTE_STATE_UNCONNECTED:
|
||||
case PW_REMOTE_STATE_CONNECTED:
|
||||
self->core_proxy = pw_remote_get_core_proxy(self->remote);
|
||||
pw_core_proxy_add_listener(self->core_proxy, &rd->core_listener, &core_events, self);
|
||||
break;
|
||||
case PW_REMOTE_STATE_ERROR:
|
||||
GST_ERROR_OBJECT (self, "remote error: %s", error);
|
||||
|
|
@ -515,9 +524,9 @@ static const struct pw_registry_proxy_events registry_events = {
|
|||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
.sync_reply = on_sync_reply,
|
||||
};
|
||||
|
||||
|
||||
static GList *
|
||||
gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
||||
{
|
||||
|
|
@ -546,9 +555,10 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
|
||||
spa_list_init(&self->pending);
|
||||
self->seq = 1;
|
||||
pw_remote_add_listener(r, &listener, &remote_events, self);
|
||||
pw_remote_add_listener(r, &listener, &remote_events, data);
|
||||
|
||||
pw_remote_connect (r);
|
||||
if (pw_remote_connect (r) < 0)
|
||||
goto failed;
|
||||
|
||||
for (;;) {
|
||||
enum pw_remote_state state;
|
||||
|
|
@ -569,13 +579,10 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
}
|
||||
GST_DEBUG_OBJECT (self, "connected");
|
||||
|
||||
get_core_info (r, self);
|
||||
|
||||
self->end = FALSE;
|
||||
self->list_only = TRUE;
|
||||
self->devices = NULL;
|
||||
|
||||
self->core_proxy = pw_remote_get_core_proxy(r);
|
||||
data->registry = pw_core_proxy_get_registry(self->core_proxy,
|
||||
PW_TYPE_INTERFACE_Registry, PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_proxy_add_listener(data->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
|
@ -639,9 +646,11 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
data->self = self;
|
||||
spa_list_init(&data->nodes);
|
||||
spa_list_init(&data->ports);
|
||||
pw_remote_add_listener (self->remote, &self->remote_listener, &remote_events, self);
|
||||
pw_remote_add_listener (self->remote, &self->remote_listener, &remote_events, data);
|
||||
|
||||
if (pw_remote_connect (self->remote) < 0)
|
||||
goto not_running;
|
||||
|
||||
pw_remote_connect (self->remote);
|
||||
for (;;) {
|
||||
enum pw_remote_state state;
|
||||
const char *error = NULL;
|
||||
|
|
@ -660,9 +669,7 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
pw_thread_loop_wait (self->main_loop);
|
||||
}
|
||||
GST_DEBUG_OBJECT (self, "connected");
|
||||
get_core_info (self->remote, self);
|
||||
|
||||
self->core_proxy = pw_remote_get_core_proxy(self->remote);
|
||||
self->registry = pw_core_proxy_get_registry(self->core_proxy,
|
||||
PW_TYPE_INTERFACE_Registry, PW_VERSION_REGISTRY, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -547,10 +547,7 @@ struct pw_proxy {
|
|||
|
||||
#define pw_remote_events_emit(r,m,v,...) spa_hook_list_call(&r->listener_list, struct pw_remote_events, m, v, ##__VA_ARGS__)
|
||||
#define pw_remote_events_destroy(r) pw_remote_events_emit(r, destroy, 0)
|
||||
#define pw_remote_events_info_changed(r,i) pw_remote_events_emit(r, info_changed, 0, i)
|
||||
#define pw_remote_events_sync_reply(r,s) pw_remote_events_emit(r, sync_reply, 0, s)
|
||||
#define pw_remote_events_state_changed(r,o,s,e) pw_remote_events_emit(r, state_changed, 0, o, s, e)
|
||||
#define pw_remote_events_error(r,i,res,e) pw_remote_events_emit(r, error, 0, i, res, e)
|
||||
#define pw_remote_events_exported(r,i) pw_remote_events_emit(r, exported, 0, i)
|
||||
|
||||
struct pw_remote {
|
||||
|
|
@ -561,7 +558,6 @@ struct pw_remote {
|
|||
struct pw_core_proxy *core_proxy; /**< proxy for the core object */
|
||||
struct pw_map objects; /**< map of client side proxy objects
|
||||
* indexed with the client id */
|
||||
struct pw_core_info *info; /**< info about the remote core */
|
||||
|
||||
struct spa_list proxy_list; /**< list of \ref pw_proxy objects */
|
||||
struct spa_list stream_list; /**< list of \ref pw_stream objects */
|
||||
|
|
|
|||
|
|
@ -170,33 +170,6 @@ pw_remote_update_state(struct pw_remote *remote, enum pw_remote_state state, con
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void core_event_info(void *data, const struct pw_core_info *info)
|
||||
{
|
||||
struct pw_remote *this = data;
|
||||
|
||||
pw_log_debug("remote %p: got core info", this);
|
||||
this->info = pw_core_info_update(this->info, info);
|
||||
pw_remote_events_info_changed(this, this->info);
|
||||
}
|
||||
|
||||
static void core_event_done(void *data, uint32_t seq)
|
||||
{
|
||||
struct pw_remote *this = data;
|
||||
|
||||
pw_log_debug("remote %p: core event done %d", this, seq);
|
||||
if (seq == 0)
|
||||
pw_remote_update_state(this, PW_REMOTE_STATE_CONNECTED, NULL);
|
||||
|
||||
pw_remote_events_sync_reply(this, seq);
|
||||
}
|
||||
|
||||
static void core_event_error(void *data, uint32_t id, int res, const char *error, ...)
|
||||
{
|
||||
struct pw_remote *this = data;
|
||||
pw_log_warn("remote %p: got error %d, %d (%s): %s", this,
|
||||
id, res, spa_strerror(res), error);
|
||||
pw_remote_events_error(this, id, res, error);
|
||||
}
|
||||
|
||||
static void core_event_remove_id(void *data, uint32_t id)
|
||||
{
|
||||
|
|
@ -213,10 +186,7 @@ static void core_event_remove_id(void *data, uint32_t id)
|
|||
|
||||
static const struct pw_core_proxy_events core_proxy_events = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
.done = core_event_done,
|
||||
.error = core_event_error,
|
||||
.remove_id = core_event_remove_id,
|
||||
.info = core_event_info,
|
||||
};
|
||||
|
||||
struct pw_remote *pw_remote_new(struct pw_core *core,
|
||||
|
|
@ -383,9 +353,9 @@ static int do_connect(struct pw_remote *remote)
|
|||
|
||||
pw_core_proxy_add_listener(remote->core_proxy, &impl->core_listener, &core_proxy_events, remote);
|
||||
|
||||
pw_core_proxy_hello(remote->core_proxy, PW_VERSION_CORE);
|
||||
pw_core_proxy_client_update(remote->core_proxy, &remote->properties->dict);
|
||||
pw_core_proxy_sync(remote->core_proxy, 0);
|
||||
pw_core_proxy_hello(remote->core_proxy, PW_VERSION_CORE);
|
||||
pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTED, NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -400,11 +370,6 @@ struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote)
|
|||
return remote->core_proxy;
|
||||
}
|
||||
|
||||
const struct pw_core_info *pw_remote_get_core_info(struct pw_remote *remote)
|
||||
{
|
||||
return remote->info;
|
||||
}
|
||||
|
||||
struct pw_proxy *pw_remote_find_proxy(struct pw_remote *remote, uint32_t id)
|
||||
{
|
||||
return pw_map_lookup(&remote->objects, id);
|
||||
|
|
@ -481,11 +446,6 @@ int pw_remote_disconnect(struct pw_remote *remote)
|
|||
|
||||
pw_map_reset(&remote->objects);
|
||||
|
||||
if (remote->info) {
|
||||
pw_core_info_free(remote->info);
|
||||
remote->info = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,15 +134,9 @@ struct pw_remote_events {
|
|||
|
||||
/** The remote is destroyed */
|
||||
void (*destroy) (void *data);
|
||||
/** emited when the remote core info changed */
|
||||
void (*info_changed) (void *data, const struct pw_core_info *info);
|
||||
/** emited when a reply to a sync was received */
|
||||
void (*sync_reply) (void *data, uint32_t seq);
|
||||
/** emited when the state changes */
|
||||
void (*state_changed) (void *data, enum pw_remote_state old,
|
||||
enum pw_remote_state state, const char *error);
|
||||
/** emited when an error was reported */
|
||||
void (*error) (void *data, uint32_t id, int res, const char *error);
|
||||
/** emited when a node was exported */
|
||||
void (*exported) (void *data, uint32_t id);
|
||||
};
|
||||
|
|
@ -200,9 +194,6 @@ int pw_remote_steal_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);
|
||||
|
||||
/** Get the remote core info, can only be called when connected */
|
||||
const struct pw_core_info *pw_remote_get_core_info(struct pw_remote *remote);
|
||||
|
||||
/** Get the proxy with the given id */
|
||||
struct pw_proxy *pw_remote_find_proxy(struct pw_remote *remote, uint32_t id);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,19 +38,13 @@ static void test_abi(void)
|
|||
struct {
|
||||
uint32_t version;
|
||||
void (*destroy) (void *data);
|
||||
void (*info_changed) (void *data, const struct pw_core_info *info);
|
||||
void (*sync_reply) (void *data, uint32_t seq);
|
||||
void (*state_changed) (void *data, enum pw_remote_state old,
|
||||
enum pw_remote_state state, const char *error);
|
||||
void (*error) (void *data, uint32_t id, int res, const char *error);
|
||||
void (*exported) (void *data, uint32_t id);
|
||||
} test = { PW_VERSION_REMOTE_EVENTS, NULL };
|
||||
|
||||
TEST_FUNC(ev, test, destroy);
|
||||
TEST_FUNC(ev, test, info_changed);
|
||||
TEST_FUNC(ev, test, sync_reply);
|
||||
TEST_FUNC(ev, test, state_changed);
|
||||
TEST_FUNC(ev, test, error);
|
||||
TEST_FUNC(ev, test, exported);
|
||||
|
||||
spa_assert(PW_VERSION_REMOTE_EVENTS == 0);
|
||||
|
|
@ -71,23 +65,11 @@ static void remote_destroy_error(void *data)
|
|||
{
|
||||
spa_assert_not_reached();
|
||||
}
|
||||
static void remote_info_changed_error(void *data, const struct pw_core_info *info)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
}
|
||||
static void remote_sync_reply_error(void *data, uint32_t seq)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
}
|
||||
static void remote_state_changed_error(void *data, enum pw_remote_state old,
|
||||
enum pw_remote_state state, const char *error)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
}
|
||||
static void remote_error_error(void *data, uint32_t id, int res, const char *error)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
}
|
||||
static void remote_exported_error(void *data, uint32_t id)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
|
|
@ -97,10 +79,7 @@ static const struct pw_remote_events remote_events_error =
|
|||
{
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.destroy = remote_destroy_error,
|
||||
.info_changed = remote_info_changed_error,
|
||||
.sync_reply = remote_sync_reply_error,
|
||||
.state_changed = remote_state_changed_error,
|
||||
.error = remote_error_error,
|
||||
.exported = remote_exported_error,
|
||||
};
|
||||
|
||||
|
|
@ -135,8 +114,6 @@ static void test_create(void)
|
|||
|
||||
/* check core proxy, only available when connected */
|
||||
spa_assert(pw_remote_get_core_proxy(remote) == NULL);
|
||||
/* check core info, only available when connected */
|
||||
spa_assert(pw_remote_get_core_info(remote) == NULL);
|
||||
|
||||
/* check some non-existing proxies */
|
||||
spa_assert(pw_remote_find_proxy(remote, 0) == NULL);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ struct remote_data {
|
|||
struct spa_hook remote_listener;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct spa_hook core_listener;
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
|
|
@ -238,7 +239,7 @@ static bool do_load_module(struct data *data, const char *cmd, char *args, char
|
|||
return true;
|
||||
}
|
||||
|
||||
static void on_info_changed(void *_data, const struct pw_core_info *info)
|
||||
static void on_core_info(void *_data, const struct pw_core_info *info)
|
||||
{
|
||||
struct remote_data *rd = _data;
|
||||
rd->name = info->name;
|
||||
|
|
@ -251,7 +252,7 @@ static void show_prompt(struct remote_data *rd)
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void on_sync_reply(void *_data, uint32_t seq)
|
||||
static void on_core_done(void *_data, uint32_t seq)
|
||||
{
|
||||
struct remote_data *rd = _data;
|
||||
|
||||
|
|
@ -342,7 +343,6 @@ static const struct pw_registry_proxy_events registry_events = {
|
|||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
||||
|
||||
static void on_remote_destroy(void *_data)
|
||||
{
|
||||
struct remote_data *rd = _data;
|
||||
|
|
@ -357,6 +357,12 @@ static void on_remote_destroy(void *_data)
|
|||
data->current = NULL;
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_events remote_core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
};
|
||||
|
||||
static void on_state_changed(void *_data, enum pw_remote_state old,
|
||||
enum pw_remote_state state, const char *error)
|
||||
{
|
||||
|
|
@ -372,6 +378,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
case PW_REMOTE_STATE_CONNECTED:
|
||||
fprintf(stdout, "remote %d state: \"%s\"\n", rd->id, pw_remote_state_as_string(state));
|
||||
rd->core_proxy = pw_remote_get_core_proxy(rd->remote);
|
||||
pw_core_proxy_add_listener(rd->core_proxy,
|
||||
&rd->core_listener,
|
||||
&remote_core_events, rd);
|
||||
rd->registry_proxy = pw_core_proxy_get_registry(rd->core_proxy,
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
|
|
@ -390,8 +399,6 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.destroy = on_remote_destroy,
|
||||
.info_changed = on_info_changed,
|
||||
.sync_reply = on_sync_reply,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -421,7 +428,8 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er
|
|||
data->current = rd;
|
||||
|
||||
pw_remote_add_listener(remote, &rd->remote_listener, &remote_events, rd);
|
||||
pw_remote_connect(remote);
|
||||
if (pw_remote_connect(remote) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ struct data {
|
|||
struct spa_hook remote_listener;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct spa_hook core_listener;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct spa_hook registry_listener;
|
||||
|
|
@ -90,7 +91,7 @@ static void remove_pending(struct proxy_data *pd)
|
|||
}
|
||||
}
|
||||
|
||||
static void on_sync_reply(void *data, uint32_t seq)
|
||||
static void on_core_done(void *data, uint32_t seq)
|
||||
{
|
||||
struct data *d = data;
|
||||
struct proxy_data *pd, *t;
|
||||
|
|
@ -143,7 +144,7 @@ static void print_properties(const struct spa_dict *props, char mark)
|
|||
|
||||
#define MARK_CHANGE(f) ((print_mark && ((info)->change_mask & (1 << (f)))) ? '*' : ' ')
|
||||
|
||||
static void on_info_changed(void *data, const struct pw_core_info *info)
|
||||
static void on_core_info(void *data, const struct pw_core_info *info)
|
||||
{
|
||||
bool print_all = true, print_mark = false;
|
||||
|
||||
|
|
@ -617,6 +618,12 @@ static const struct pw_registry_proxy_events registry_events = {
|
|||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_core_proxy_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
};
|
||||
|
||||
static void on_state_changed(void *_data, enum pw_remote_state old,
|
||||
enum pw_remote_state state, const char *error)
|
||||
{
|
||||
|
|
@ -632,6 +639,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
printf("remote state: \"%s\"\n", pw_remote_state_as_string(state));
|
||||
|
||||
data->core_proxy = pw_remote_get_core_proxy(data->remote);
|
||||
pw_core_proxy_add_listener(data->core_proxy,
|
||||
&data->core_listener,
|
||||
&core_events, data);
|
||||
data->registry_proxy = pw_core_proxy_get_registry(data->core_proxy,
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
|
|
@ -648,9 +658,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.info_changed = on_info_changed,
|
||||
.state_changed = on_state_changed,
|
||||
.sync_reply = on_sync_reply,
|
||||
};
|
||||
|
||||
static void do_quit(void *data, int signal_number)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue