remote: remove obsolete exported event

We can now do the same and more with the bound event on the proxy.
This commit is contained in:
Wim Taymans 2019-11-28 13:05:01 +01:00
parent a1801b690f
commit fcd4ae3334
6 changed files with 16 additions and 32 deletions

View file

@ -239,7 +239,6 @@ static int 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 = data->remote;
clean_transport(data);
@ -265,7 +264,6 @@ static int client_node_transport(void *object, uint32_t node_id,
if (data->node->active)
pw_client_node_proxy_set_active(data->client_node, true);
pw_remote_emit_exported(remote, data->proxy->id, node_id);
return 0;
}

View file

@ -868,10 +868,18 @@ static void proxy_error(void *_data, int seq, int res, const char *message)
filter_set_state(filter, PW_FILTER_STATE_ERROR, message);
}
static void proxy_bound(void *_data, uint32_t global_id)
{
struct pw_filter *filter = _data;
filter->node_id = global_id;
filter_set_state(filter, PW_FILTER_STATE_PAUSED, NULL);
}
static const struct pw_proxy_events proxy_events = {
PW_VERSION_PROXY_EVENTS,
.destroy = proxy_destroy,
.error = proxy_error,
.bound = proxy_bound,
};
static int handle_connect(struct pw_filter *filter)
@ -943,19 +951,9 @@ static void on_remote_state_changed(void *_data, enum pw_remote_state old,
}
}
static void on_remote_exported(void *_data, uint32_t proxy_id, uint32_t global_id)
{
struct pw_filter *filter = _data;
if (filter->proxy && filter->proxy->id == proxy_id) {
filter->node_id = global_id;
filter_set_state(filter, PW_FILTER_STATE_PAUSED, NULL);
}
}
static const struct pw_remote_events remote_events = {
PW_VERSION_REMOTE_EVENTS,
.state_changed = on_remote_state_changed,
.exported = on_remote_exported,
};
SPA_EXPORT

View file

@ -734,7 +734,6 @@ struct pw_proxy {
#define pw_remote_emit(r,m,v,...) spa_hook_list_call(&r->listener_list, struct pw_remote_events, m, v, ##__VA_ARGS__)
#define pw_remote_emit_destroy(r) pw_remote_emit(r, destroy, 0)
#define pw_remote_emit_state_changed(r,o,s,e) pw_remote_emit(r, state_changed, 0, o, s, e)
#define pw_remote_emit_exported(r,i,g) pw_remote_emit(r, exported, 0, i,g)
struct pw_remote {
struct pw_core *core; /**< core */

View file

@ -137,8 +137,6 @@ struct pw_remote_events {
/** 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 a node was exported */
void (*exported) (void *data, uint32_t proxy_id, uint32_t global_id);
};
/** Create a new unconnected remote \memberof pw_remote

View file

@ -818,10 +818,18 @@ static void proxy_error(void *_data, int seq, int res, const char *message)
stream_set_state(stream, PW_STREAM_STATE_ERROR, message);
}
static void proxy_bound(void *data, uint32_t global_id)
{
struct pw_stream *stream = data;
stream->node_id = global_id;
stream_set_state(stream, PW_STREAM_STATE_PAUSED, NULL);
}
static const struct pw_proxy_events proxy_events = {
PW_VERSION_PROXY_EVENTS,
.destroy = proxy_destroy,
.error = proxy_error,
.bound = proxy_bound,
};
static struct control *find_control(struct pw_stream *stream, uint32_t id)
@ -1090,19 +1098,9 @@ static void on_remote_state_changed(void *_data, enum pw_remote_state old,
}
}
static void on_remote_exported(void *_data, uint32_t proxy_id, uint32_t global_id)
{
struct pw_stream *stream = _data;
if (stream->proxy && stream->proxy->id == proxy_id) {
stream->node_id = global_id;
stream_set_state(stream, PW_STREAM_STATE_PAUSED, NULL);
}
}
static const struct pw_remote_events remote_events = {
PW_VERSION_REMOTE_EVENTS,
.state_changed = on_remote_state_changed,
.exported = on_remote_exported,
};
SPA_EXPORT

View file

@ -40,12 +40,10 @@ static void test_abi(void)
void (*destroy) (void *data);
void (*state_changed) (void *data, enum pw_remote_state old,
enum pw_remote_state state, const char *error);
void (*exported) (void *data, uint32_t proxy_id, uint32_t remote_id);
} test = { PW_VERSION_REMOTE_EVENTS, NULL };
TEST_FUNC(ev, test, destroy);
TEST_FUNC(ev, test, state_changed);
TEST_FUNC(ev, test, exported);
spa_assert(PW_VERSION_REMOTE_EVENTS == 0);
spa_assert(sizeof(ev) == sizeof(test));
@ -70,17 +68,12 @@ static void remote_state_changed_error(void *data, enum pw_remote_state old,
{
spa_assert_not_reached();
}
static void remote_exported_error(void *data, uint32_t proxy_id, uint32_t global_id)
{
spa_assert_not_reached();
}
static const struct pw_remote_events remote_events_error =
{
PW_VERSION_REMOTE_EVENTS,
.destroy = remote_destroy_error,
.state_changed = remote_state_changed_error,
.exported = remote_exported_error,
};
static int destroy_count = 0;