Move implementation helpers to utils

This commit is contained in:
Wim Taymans 2019-05-20 10:14:00 +02:00
parent b195a25636
commit a564d9f3f1
29 changed files with 65 additions and 41 deletions

View file

@ -102,15 +102,6 @@ struct spa_device_events {
const struct spa_device_object_info *info);
};
#define spa_device_emit(hooks,method,version,...) \
spa_hook_list_call_simple(hooks, struct spa_device_events, \
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_events(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)
/**
* spa_device:
*

View file

@ -86,17 +86,6 @@ struct spa_monitor_callbacks {
int (*event) (void *data, struct spa_event *event);
};
#define spa_monitor_call(callbacks,method,version,...) \
({ \
int __res = 0; \
spa_callbacks_call_res(callbacks, struct spa_monitor_callbacks, \
__res, method, version, ##__VA_ARGS__); \
__res; \
})
#define spa_monitor_call_info(hook,i) spa_monitor_call(hook, info, 0, i)
#define spa_monitor_call_event(hook,e) spa_monitor_call(hook, event, 0, e)
/**
* spa_monitor:
*

View file

@ -78,6 +78,26 @@ static inline int spa_device_enum_params_sync(struct spa_device *device,
return res;
}
#define spa_monitor_call(callbacks,method,version,...) \
({ \
int __res = 0; \
spa_callbacks_call_res(callbacks, struct spa_monitor_callbacks, \
__res, method, version, ##__VA_ARGS__); \
__res; \
})
#define spa_monitor_call_info(hook,i) spa_monitor_call(hook, info, 0, i)
#define spa_monitor_call_event(hook,e) spa_monitor_call(hook, event, 0, e)
#define spa_device_emit(hooks,method,version,...) \
spa_hook_list_call_simple(hooks, struct spa_device_events, \
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_events(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)
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -166,15 +166,6 @@ struct spa_node_events {
void (*event) (void *data, struct spa_event *event);
};
#define spa_node_emit(hooks,method,version,...) \
spa_hook_list_call_simple(hooks, struct spa_node_events, \
method, version, ##__VA_ARGS__)
#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_event(hooks,e) spa_node_emit(hooks,event, 0, e)
/** Node callbacks
*
* Callbacks are called from the real-time data thread. Only
@ -208,17 +199,6 @@ struct spa_node_callbacks {
uint32_t buffer_id);
};
#define spa_node_call(callbacks,method,version,...) \
({ \
int _res = 0; \
spa_callbacks_call_res(callbacks, struct spa_node_callbacks, \
_res, method, version, ##__VA_ARGS__); \
_res; \
})
#define spa_node_call_ready(hook,s) spa_node_call(hook, ready, 0, s)
#define spa_node_call_reuse_buffer(hook,p,b) spa_node_call(hook, reuse_buffer, 0, p, b)
/** flags that can be passed to set_param and port_set_param functions */
#define SPA_NODE_PARAM_FLAG_TEST_ONLY (1 << 0) /* just check if the param is accepted */

View file

@ -109,6 +109,27 @@ static inline int spa_node_port_enum_params_sync(struct spa_node *node,
return res;
}
#define spa_node_emit(hooks,method,version,...) \
spa_hook_list_call_simple(hooks, struct spa_node_events, \
method, version, ##__VA_ARGS__)
#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_event(hooks,e) spa_node_emit(hooks,event, 0, e)
#define spa_node_call(callbacks,method,version,...) \
({ \
int _res = 0; \
spa_callbacks_call_res(callbacks, struct spa_node_callbacks, \
_res, method, version, ##__VA_ARGS__); \
_res; \
})
#define spa_node_call_ready(hook,s) spa_node_call(hook, ready, 0, s)
#define spa_node_call_reuse_buffer(hook,p,b) spa_node_call(hook, reuse_buffer, 0, p, b)
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -36,6 +36,7 @@
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/monitor/device.h>
#include <spa/monitor/utils.h>
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#include <spa/pod/parser.h>

View file

@ -37,6 +37,7 @@
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/monitor/monitor.h>
#include <spa/monitor/utils.h>
#define NAME "alsa-monitor"

View file

@ -39,6 +39,7 @@ extern "C" {
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/param.h>
#include <spa/param/audio/format-utils.h>

View file

@ -31,6 +31,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>

View file

@ -29,6 +29,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>

View file

@ -34,6 +34,7 @@
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/param.h>
#include <spa/param/audio/format.h>

View file

@ -36,6 +36,7 @@
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/param.h>
#include <spa/param/audio/format.h>

View file

@ -35,6 +35,7 @@
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/monitor/device.h>
#include <spa/monitor/utils.h>
#include "defs.h"

View file

@ -42,8 +42,8 @@
#include <spa/support/dbus.h>
#include <spa/support/plugin.h>
#include <spa/monitor/monitor.h>
#include <spa/monitor/utils.h>
#include <spa/utils/type.h>
#include <spa/debug/mem.h>
#include "a2dp-codecs.h"
#include "defs.h"

View file

@ -30,6 +30,7 @@
#include <spa/support/log.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/video/format-utils.h>
#include <spa/param/video/format.h>

View file

@ -30,6 +30,7 @@
#include <spa/support/log.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/video/format-utils.h>
#include <spa/pod/filter.h>

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/param.h>
#include <spa/param/format.h>

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/param.h>
#include <spa/param/format.h>

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/pod/builder.h>
#include <spa/monitor/device.h>
#include <spa/monitor/utils.h>
#include <spa/debug/pod.h>
#include "v4l2.h"

View file

@ -36,6 +36,7 @@
#include <spa/support/plugin.h>
#include <spa/utils/type.h>
#include <spa/monitor/monitor.h>
#include <spa/monitor/utils.h>
#define NAME "v4l2-monitor"

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/video/format-utils.h>
#include <spa/param/param.h>

View file

@ -29,6 +29,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>

View file

@ -28,6 +28,7 @@
#include <spa/param/video/format-utils.h>
#include <spa/param/props.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/control/control.h>
#include <spa/pod/filter.h>

View file

@ -30,6 +30,7 @@
#include <spa/param/audio/format-utils.h>
#include <spa/param/props.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
#include <spa/pod/filter.h>
#include <spa/debug/format.h>

View file

@ -35,6 +35,7 @@
#include <spa/param/props.h>
#include <spa/pod/filter.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
#include <spa/debug/format.h>
#include <pipewire/pipewire.h>

View file

@ -29,6 +29,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>

View file

@ -31,6 +31,7 @@
#include <sys/eventfd.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/pod/filter.h>
#include <spa/pod/parser.h>
#include <spa/debug/types.h>

View file

@ -31,6 +31,7 @@
#include <spa/buffer/alloc.h>
#include <spa/param/props.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
#include <spa/utils/ringbuffer.h>
#include <spa/pod/filter.h>
#include <spa/control/control.h>