spa: add result type

We need this to know the type of result, especially when serializing.
This commit is contained in:
Wim Taymans 2019-05-28 13:59:48 +02:00
parent c767ce62c9
commit 857b2a0cfb
33 changed files with 110 additions and 73 deletions

View file

@ -76,6 +76,7 @@ struct spa_device_object_info {
#define SPA_DEVICE_OBJECT_INFO_INIT() (struct spa_device_object_info){ SPA_VERSION_DEVICE_OBJECT_INFO, }
/** the result of spa_device_enum_params() */
#define SPA_RESULT_TYPE_DEVICE_PARAMS 1
struct spa_result_device_params {
uint32_t id;
uint32_t index;
@ -103,7 +104,7 @@ struct spa_device_events {
void (*info) (void *data, const struct spa_device_info *info);
/** notify a result */
void (*result) (void *data, int seq, int res, const void *result);
void (*result) (void *data, int seq, int res, uint32_t type, const void *result);
/** a device event */
void (*event) (void *data, const struct spa_event *event);

View file

@ -37,7 +37,7 @@ struct spa_result_device_params_data {
};
static inline void spa_result_func_device_params(void *data, int seq, int res,
const void *result)
uint32_t type, const void *result)
{
struct spa_result_device_params_data *d =
(struct spa_result_device_params_data *)data;
@ -94,7 +94,7 @@ static inline int spa_device_enum_params_sync(struct spa_device *device,
method, version, ##__VA_ARGS__)
#define spa_device_emit_info(hooks,i) spa_device_emit(hooks,info, 0, i)
#define spa_device_emit_result(hooks,s,r,res) spa_device_emit(hooks,result, 0, s, r, res)
#define spa_device_emit_result(hooks,s,r,t,res) spa_device_emit(hooks,result, 0, s, r, t, res)
#define spa_device_emit_event(hooks,e) spa_device_emit(hooks,event, 0, e)
#define spa_device_emit_object_info(hooks,id,i) spa_device_emit(hooks,object_info, 0, id, i)

View file

@ -112,6 +112,9 @@ struct spa_port_info {
#define SPA_PORT_INFO_INIT() (struct spa_port_info) { 0, }
#define SPA_RESULT_TYPE_NODE_ERROR 1
#define SPA_RESULT_TYPE_NODE_PARAMS 2
/** an error result */
struct spa_result_node_error {
const char *message;
@ -152,8 +155,8 @@ struct spa_node_events {
/** notify a result.
*
* Some methods will trigger a result event with an optional
* result. Look at the documentation of the method to know
* when to expect a result event.
* result of the given type. Look at the documentation of the
* method to know when to expect a result event.
*
* The result event can be called synchronously, as an event
* called from inside the method itself, in which case the seq
@ -165,7 +168,8 @@ struct spa_node_events {
* the method call. Users should match the seq number from
* request to the reply.
*/
void (*result) (void *data, int seq, int res, const void *result);
void (*result) (void *data, int seq, int res,
uint32_t type, const void *result);
/**
* \param node a spa_node

View file

@ -37,7 +37,7 @@ struct spa_result_node_params_data {
};
static inline void spa_result_func_node_params(void *data,
int seq, int res, const void *result)
int seq, int res, uint32_t type, const void *result)
{
struct spa_result_node_params_data *d =
(struct spa_result_node_params_data *) data;
@ -119,7 +119,7 @@ static inline int spa_node_port_enum_params_sync(struct spa_node *node,
#define spa_node_emit_info(hooks,i) spa_node_emit(hooks,info, 0, i)
#define spa_node_emit_port_info(hooks,d,p,i) spa_node_emit(hooks,port_info, 0, d, p, i)
#define spa_node_emit_result(hooks,s,r,res) spa_node_emit(hooks,result, 0, s, r, res)
#define spa_node_emit_result(hooks,s,r,t,res) spa_node_emit(hooks,result, 0, s, r, t, res)
#define spa_node_emit_event(hooks,e) spa_node_emit(hooks,event, 0, e)