mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
interfaces: improve remote API
Add return values to events and method callbacks. This makes it possible to pass any error or async return value. Add sync/done/error in both directions so that both proxy and resource and perform/reply sync and produce errors. Return a SPA_ASYNC from remote method calls (and events), keep the sequence number in the connection. With the core sync/done we can remove the client-node done method and it's internal sequence number along with the seq number in method calls. We can also use the method/event async return value to perform a sync with as the unique sequence number for this method. Add sync method and done/error event to proxy and resource.
This commit is contained in:
parent
0d8821096a
commit
eea062ee53
41 changed files with 1180 additions and 817 deletions
|
|
@ -37,28 +37,33 @@ static void test_core_abi(void)
|
|||
struct pw_core_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*hello) (void *object, uint32_t version);
|
||||
void (*sync) (void *object, uint32_t seq);
|
||||
void (*get_registry) (void *object, uint32_t version, uint32_t new_id);
|
||||
void (*create_object) (void *object,
|
||||
int (*hello) (void *object, uint32_t version);
|
||||
int (*sync) (void *object, uint32_t id, uint32_t seq);
|
||||
int (*done) (void *object, uint32_t id, uint32_t seq);
|
||||
int (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
int (*get_registry) (void *object, uint32_t version, uint32_t new_id);
|
||||
int (*create_object) (void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id);
|
||||
void (*destroy) (void *object, uint32_t id);
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
} methods = { PW_VERSION_CORE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*done) (void *object, uint32_t seq);
|
||||
void (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
void (*remove_id) (void *object, uint32_t id);
|
||||
void (*info) (void *object, const struct pw_core_info *info);
|
||||
int (*info) (void *object, const struct pw_core_info *info);
|
||||
int (*done) (void *object, uint32_t id, uint32_t seq);
|
||||
int (*sync) (void *object, uint32_t id, uint32_t seq);
|
||||
int (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
int (*remove_id) (void *object, uint32_t id);
|
||||
} events = { PW_VERSION_CORE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, hello);
|
||||
TEST_FUNC(m, methods, sync);
|
||||
TEST_FUNC(m, methods, done);
|
||||
TEST_FUNC(e, methods, error);
|
||||
TEST_FUNC(m, methods, get_registry);
|
||||
TEST_FUNC(m, methods, create_object);
|
||||
TEST_FUNC(m, methods, destroy);
|
||||
|
|
@ -66,10 +71,11 @@ static void test_core_abi(void)
|
|||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
TEST_FUNC(e, events, version);
|
||||
TEST_FUNC(e, events, info);
|
||||
TEST_FUNC(e, events, done);
|
||||
TEST_FUNC(e, events, sync);
|
||||
TEST_FUNC(e, events, error);
|
||||
TEST_FUNC(e, events, remove_id);
|
||||
TEST_FUNC(e, events, info);
|
||||
spa_assert(PW_VERSION_CORE_PROXY_EVENTS == 0);
|
||||
spa_assert(sizeof(e) == sizeof(events));
|
||||
}
|
||||
|
|
@ -80,15 +86,15 @@ static void test_registry_abi(void)
|
|||
struct pw_registry_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version, uint32_t new_id);
|
||||
void (*destroy) (void *object, uint32_t id);
|
||||
int (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version, uint32_t new_id);
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
} methods = { PW_VERSION_REGISTRY_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*global) (void *object, uint32_t id, uint32_t parent_id,
|
||||
int (*global) (void *object, uint32_t id, uint32_t parent_id,
|
||||
uint32_t permissions, uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props);
|
||||
void (*global_remove) (void *object, uint32_t id);
|
||||
int (*global_remove) (void *object, uint32_t id);
|
||||
} events = { PW_VERSION_REGISTRY_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
|
|
@ -113,7 +119,7 @@ static void test_module_abi(void)
|
|||
} methods = { PW_VERSION_MODULE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_module_info *info);
|
||||
int (*info) (void *object, const struct pw_module_info *info);
|
||||
} events = { PW_VERSION_MODULE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
|
|
@ -132,15 +138,15 @@ static void test_device_abi(void)
|
|||
struct pw_device_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
int (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
void (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
} methods = { PW_VERSION_DEVICE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_device_info *info);
|
||||
void (*param) (void *object,
|
||||
int (*info) (void *object, const struct pw_device_info *info);
|
||||
int (*param) (void *object,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
} events = { PW_VERSION_DEVICE_PROXY_EVENTS, };
|
||||
|
|
@ -164,16 +170,16 @@ static void test_node_abi(void)
|
|||
struct pw_node_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
int (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
void (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
void (*send_command) (void *object, const struct spa_command *command);
|
||||
int (*send_command) (void *object, const struct spa_command *command);
|
||||
} methods = { PW_VERSION_NODE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_node_info *info);
|
||||
void (*param) (void *object,
|
||||
int (*info) (void *object, const struct pw_node_info *info);
|
||||
int (*param) (void *object,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
} events = { PW_VERSION_NODE_PROXY_EVENTS, };
|
||||
|
|
@ -198,13 +204,13 @@ static void test_port_abi(void)
|
|||
struct pw_port_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
int (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
} methods = { PW_VERSION_PORT_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_port_info *info);
|
||||
void (*param) (void *object,
|
||||
int (*info) (void *object, const struct pw_port_info *info);
|
||||
int (*param) (void *object,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
} events = { PW_VERSION_PORT_PROXY_EVENTS, };
|
||||
|
|
@ -230,7 +236,7 @@ static void test_factory_abi(void)
|
|||
} methods = { PW_VERSION_FACTORY_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_factory_info *info);
|
||||
int (*info) (void *object, const struct pw_factory_info *info);
|
||||
} events = { PW_VERSION_FACTORY_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
|
|
@ -249,16 +255,16 @@ static void test_client_abi(void)
|
|||
struct pw_client_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
void (*update_properties) (void *object, const struct spa_dict *props);
|
||||
void (*get_permissions) (void *object, uint32_t index, uint32_t num);
|
||||
void (*update_permissions) (void *object, uint32_t n_permissions,
|
||||
int (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
int (*update_properties) (void *object, const struct spa_dict *props);
|
||||
int (*get_permissions) (void *object, uint32_t index, uint32_t num);
|
||||
int (*update_permissions) (void *object, uint32_t n_permissions,
|
||||
const struct pw_permission *permissions);
|
||||
} methods = { PW_VERSION_CLIENT_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_client_info *info);
|
||||
void (*permissions) (void *object, uint32_t index,
|
||||
int (*info) (void *object, const struct pw_client_info *info);
|
||||
int (*permissions) (void *object, uint32_t index,
|
||||
uint32_t n_permissions, const struct pw_permission *permissions);
|
||||
} events = { PW_VERSION_CLIENT_PROXY_EVENTS, };
|
||||
|
||||
|
|
@ -285,7 +291,7 @@ static void test_link_abi(void)
|
|||
} methods = { PW_VERSION_LINK_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_link_info *info);
|
||||
int (*info) (void *object, const struct pw_link_info *info);
|
||||
} events = { PW_VERSION_LINK_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue