doc: split the spa_interfaces out as separate group from the spa_hooks

This commit is contained in:
Peter Hutterer 2021-08-05 14:31:26 +10:00 committed by Wim Taymans
parent 1be939c672
commit 56acf766a5

View file

@ -32,23 +32,17 @@ extern "C" {
#include <spa/utils/defs.h> #include <spa/utils/defs.h>
#include <spa/utils/list.h> #include <spa/utils/list.h>
/** \defgroup spa_hook SPA Hooks /** \defgroup spa_interface SPA Interfaces
* *
* \brief a list of hooks * \brief Generic implementation of interfaces
* *
* The hook list provides a way to keep track of hooks.
*/ */
/** /**
* \addtogroup spa_hook * \addtogroup spa_interface
* \{ * \{
*/ */
/** A list of hooks */
struct spa_hook_list {
struct spa_list list;
};
/** Callbacks, contains the structure with functions and the data passed /** Callbacks, contains the structure with functions and the data passed
* to the functions. The structure should also contain a version field that * to the functions. The structure should also contain a version field that
* is checked. */ * is checked. */
@ -71,6 +65,49 @@ struct spa_interface {
#define SPA_INTERFACE_INIT(_type,_version,_funcs,_data) \ #define SPA_INTERFACE_INIT(_type,_version,_funcs,_data) \
(struct spa_interface){ _type, _version, SPA_CALLBACKS_INIT(_funcs,_data), } (struct spa_interface){ _type, _version, SPA_CALLBACKS_INIT(_funcs,_data), }
#define spa_callbacks_call(callbacks,type,method,vers,...) \
({ \
const type *_f = (const type *) (callbacks)->funcs; \
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
_f->method((callbacks)->data, ## __VA_ARGS__); \
})
#define spa_callbacks_call_res(callbacks,type,res,method,vers,...) \
({ \
const type *_f = (const type *) (callbacks)->funcs; \
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
res = _f->method((callbacks)->data, ## __VA_ARGS__); \
res; \
})
#define spa_interface_call(iface,type,method,vers,...) \
spa_callbacks_call(&(iface)->cb,type,method,vers,##__VA_ARGS__)
#define spa_interface_call_res(iface,type,res,method,vers,...) \
spa_callbacks_call_res(&(iface)->cb,type,res,method,vers,##__VA_ARGS__)
/**
* \}
*/
/** \defgroup spa_hook SPA Hooks
*
* \brief a list of hooks
*
* The hook list provides a way to keep track of hooks.
*/
/**
* \addtogroup spa_hook
* \{
*/
/** A list of hooks */
struct spa_hook_list {
struct spa_list list;
};
/** A hook, contains the structure with functions and the data passed /** A hook, contains the structure with functions and the data passed
* to the functions. */ * to the functions. */
struct spa_hook { struct spa_hook {
@ -149,27 +186,6 @@ spa_hook_list_join(struct spa_hook_list *list,
spa_list_insert_list(&list->list, &save->list); spa_list_insert_list(&list->list, &save->list);
} }
#define spa_callbacks_call(callbacks,type,method,vers,...) \
({ \
const type *_f = (const type *) (callbacks)->funcs; \
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
_f->method((callbacks)->data, ## __VA_ARGS__); \
})
#define spa_callbacks_call_res(callbacks,type,res,method,vers,...) \
({ \
const type *_f = (const type *) (callbacks)->funcs; \
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
res = _f->method((callbacks)->data, ## __VA_ARGS__); \
res; \
})
#define spa_interface_call(iface,type,method,vers,...) \
spa_callbacks_call(&(iface)->cb,type,method,vers,##__VA_ARGS__)
#define spa_interface_call_res(iface,type,res,method,vers,...) \
spa_callbacks_call_res(&(iface)->cb,type,res,method,vers,##__VA_ARGS__)
#define spa_hook_list_call_simple(l,type,method,vers,...) \ #define spa_hook_list_call_simple(l,type,method,vers,...) \
({ \ ({ \
struct spa_hook_list *_l = l; \ struct spa_hook_list *_l = l; \