mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
spa: use static inline for interfaces instead of macro
It gives better typechecking and a path to make a library of functions.
This commit is contained in:
parent
5e0e1204d7
commit
84bd4b7ea9
32 changed files with 1069 additions and 563 deletions
|
|
@ -68,26 +68,69 @@ struct spa_audio_aec_methods {
|
|||
struct spa_audio_info_raw *out_info);
|
||||
};
|
||||
|
||||
#define spa_audio_aec_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
struct spa_audio_aec *_o = (o); \
|
||||
spa_interface_call_res(&_o->iface, \
|
||||
struct spa_audio_aec_methods, _res, \
|
||||
method, (version), ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
static inline int spa_audio_aec_add_listener(struct spa_audio_aec *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_audio_aec_events *events,
|
||||
void *data)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, add_listener, 0, listener, events, data);
|
||||
}
|
||||
|
||||
#define spa_audio_aec_add_listener(o,...) spa_audio_aec_method(o, add_listener, 0, __VA_ARGS__)
|
||||
#define spa_audio_aec_init(o,...) spa_audio_aec_method(o, init, 0, __VA_ARGS__)
|
||||
#define spa_audio_aec_run(o,...) spa_audio_aec_method(o, run, 0, __VA_ARGS__)
|
||||
#define spa_audio_aec_set_props(o,...) spa_audio_aec_method(o, set_props, 0, __VA_ARGS__)
|
||||
#define spa_audio_aec_activate(o) spa_audio_aec_method(o, activate, 1)
|
||||
#define spa_audio_aec_deactivate(o) spa_audio_aec_method(o, deactivate, 1)
|
||||
#define spa_audio_aec_enum_props(o,...) spa_audio_aec_method(o, enum_props, 2, __VA_ARGS__)
|
||||
#define spa_audio_aec_get_params(o,...) spa_audio_aec_method(o, get_params, 2, __VA_ARGS__)
|
||||
#define spa_audio_aec_set_params(o,...) spa_audio_aec_method(o, set_params, 2, __VA_ARGS__)
|
||||
#define spa_audio_aec_init2(o,...) spa_audio_aec_method(o, init2, 3, __VA_ARGS__)
|
||||
static inline int spa_audio_aec_init(struct spa_audio_aec *object,
|
||||
const struct spa_dict *args, const struct spa_audio_info_raw *info)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, init, 0, args, info);
|
||||
}
|
||||
static inline int spa_audio_aec_run(struct spa_audio_aec *object,
|
||||
const float *rec[], const float *play[], float *out[], uint32_t n_samples)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, run, 0, rec, play, out, n_samples);
|
||||
}
|
||||
static inline int spa_audio_aec_set_props(struct spa_audio_aec *object, const struct spa_dict *args)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, set_props, 0, args);
|
||||
}
|
||||
static inline int spa_audio_aec_activate(struct spa_audio_aec *object)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, activate, 1);
|
||||
}
|
||||
static inline int spa_audio_aec_deactivate(struct spa_audio_aec *object)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, deactivate, 1);
|
||||
}
|
||||
static inline int spa_audio_aec_enum_props(struct spa_audio_aec *object,
|
||||
int index, struct spa_pod_builder* builder)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, enum_props, 2, index, builder);
|
||||
}
|
||||
static inline int spa_audio_aec_get_params(struct spa_audio_aec *object,
|
||||
struct spa_pod_builder* builder)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, get_params, 2, builder);
|
||||
}
|
||||
static inline int spa_audio_aec_set_params(struct spa_audio_aec *object,
|
||||
const struct spa_pod *args)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, set_params, 2, args);
|
||||
}
|
||||
static inline int spa_audio_aec_init2(struct spa_audio_aec *object,
|
||||
const struct spa_dict *args,
|
||||
struct spa_audio_info_raw *play_info,
|
||||
struct spa_audio_info_raw *rec_info,
|
||||
struct spa_audio_info_raw *out_info)
|
||||
{
|
||||
return spa_api_method_r(int, -ENOTSUP,
|
||||
spa_audio_aec, &object->iface, init2, 3, args, play_info, rec_info, out_info);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue