remote: add exported signal

Add a signal to notify when a proxy id has been expored. Use this in the
stream to signal the configure state.
This commit is contained in:
Wim Taymans 2018-10-31 14:31:49 +00:00
parent f8b93d2a1b
commit 95c1b7d0a3
4 changed files with 14 additions and 1 deletions

View file

@ -516,6 +516,7 @@ struct pw_proxy {
#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 {
struct pw_core *core; /**< core */

View file

@ -742,6 +742,7 @@ static void client_node_transport(void *object, uint32_t node_id,
{
struct pw_proxy *proxy = object;
struct node_data *data = proxy->user_data;
struct pw_remote *remote = proxy->remote;
clean_transport(data);
@ -751,12 +752,14 @@ static void client_node_transport(void *object, uint32_t node_id,
proxy, readfd, writefd, node_id);
data->rtwritefd = writefd;
data->rtsocket_source = pw_loop_add_io(proxy->remote->core->data_loop,
data->rtsocket_source = pw_loop_add_io(remote->core->data_loop,
readfd,
SPA_IO_ERR | SPA_IO_HUP,
true, on_rtsocket_condition, proxy);
if (data->node->active)
pw_client_node_proxy_set_active(data->node_proxy, true);
pw_remote_events_exported(remote, proxy->id);
}
static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32_t change_mask)

View file

@ -138,6 +138,8 @@ struct pw_remote_events {
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);
};
/** Specify the name of the protocol to use, default is using the native protocol */

View file

@ -825,10 +825,17 @@ static void on_remote_state_changed(void *_data, enum pw_remote_state old,
break;
}
}
static void on_remote_exported(void *_data, uint32_t id)
{
struct pw_stream *stream = _data;
if (stream->proxy->id == id)
stream_set_state(stream, PW_STREAM_STATE_CONFIGURE, NULL);
}
static const struct pw_remote_events remote_events = {
PW_VERSION_REMOTE_EVENTS,
.state_changed = on_remote_state_changed,
.exported = on_remote_exported,
};
struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name,