diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-05-20 10:14:00 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-05-20 10:14:00 +0200 |
commit | a564d9f3f1b46ee8591c8c88264c59e8f63acc02 (patch) | |
tree | eceebf038cf61902bd21bfb4d27c725495357546 | |
parent | b195a2563699d4dcf05d93fa16a8b5293bdd0532 (diff) |
Move implementation helpers to utils
29 files changed, 65 insertions, 41 deletions
diff --git a/spa/include/spa/monitor/device.h b/spa/include/spa/monitor/device.h index 765e96f8..dbb3c4d8 100644 --- a/spa/include/spa/monitor/device.h +++ b/spa/include/spa/monitor/device.h @@ -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: * diff --git a/spa/include/spa/monitor/monitor.h b/spa/include/spa/monitor/monitor.h index 605f8913..bbf244c0 100644 --- a/spa/include/spa/monitor/monitor.h +++ b/spa/include/spa/monitor/monitor.h @@ -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: * diff --git a/spa/include/spa/monitor/utils.h b/spa/include/spa/monitor/utils.h index 928416bc..442855c4 100644 --- a/spa/include/spa/monitor/utils.h +++ b/spa/include/spa/monitor/utils.h @@ -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 diff --git a/spa/include/spa/node/node.h b/spa/include/spa/node/node.h index 19fad83d..480509f1 100644 --- a/spa/include/spa/node/node.h +++ b/spa/include/spa/node/node.h @@ -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 */ diff --git a/spa/include/spa/node/utils.h b/spa/include/spa/node/utils.h index a82085fa..0069ccad 100644 --- a/spa/include/spa/node/utils.h +++ b/spa/include/spa/node/utils.h @@ -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 diff --git a/spa/plugins/alsa/alsa-device.c b/spa/plugins/alsa/alsa-device.c index b3ca7c8a..932e9217 100644 --- a/spa/plugins/alsa/alsa-device.c +++ b/spa/plugins/alsa/alsa-device.c @@ -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> diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c index b1478e28..91174f05 100644 --- a/spa/plugins/alsa/alsa-monitor.c +++ b/spa/plugins/alsa/alsa-monitor.c @@ -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" diff --git a/spa/plugins/alsa/alsa-utils.h b/spa/plugins/alsa/alsa-utils.h index a862873f..3ef874b8 100644 --- a/spa/plugins/alsa/alsa-utils.h +++ b/spa/plugins/alsa/alsa-utils.h @@ -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> diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index e9e0e1e0..a0c1b652 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -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> diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 2a30f179..a3225015 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -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> diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index 9dbef82f..a0615aec 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -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> diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 731577e5..08484efb 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -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> diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 8cc46f83..e2560d29 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -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> diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index d6ea467e..ee262b9a 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -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" diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c index 5b8ff495..ee907125 100644 --- a/spa/plugins/bluez5/bluez5-monitor.c +++ b/spa/plugins/bluez5/bluez5-monitor.c @@ -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" diff --git a/spa/plugins/ffmpeg/ffmpeg-dec.c b/spa/plugins/ffmpeg/ffmpeg-dec.c index 72fcf87c..164955fe 100644 --- a/spa/plugins/ffmpeg/ffmpeg-dec.c +++ b/spa/plugins/ffmpeg/ffmpeg-dec.c @@ -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> diff --git a/spa/plugins/ffmpeg/ffmpeg-enc.c b/spa/plugins/ffmpeg/ffmpeg-enc.c index 36f3ebee..3bb5fb42 100644 --- a/spa/plugins/ffmpeg/ffmpeg-enc.c +++ b/spa/plugins/ffmpeg/ffmpeg-enc.c @@ -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> diff --git a/spa/plugins/test/fakesink.c b/spa/plugins/test/fakesink.c index dc952b28..de693fae 100644 --- a/spa/plugins/test/fakesink.c +++ b/spa/plugins/test/fakesink.c @@ -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> diff --git a/spa/plugins/test/fakesrc.c b/spa/plugins/test/fakesrc.c index 0eb313fc..d7560cb4 100644 --- a/spa/plugins/test/fakesrc.c +++ b/spa/plugins/test/fakesrc.c @@ -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> diff --git a/spa/plugins/v4l2/v4l2-device.c b/spa/plugins/v4l2/v4l2-device.c index b8581e80..96748f58 100644 --- a/spa/plugins/v4l2/v4l2-device.c +++ b/spa/plugins/v4l2/v4l2-device.c @@ -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" diff --git a/spa/plugins/v4l2/v4l2-monitor.c b/spa/plugins/v4l2/v4l2-monitor.c index 276540bc..4a028557 100644 --- a/spa/plugins/v4l2/v4l2-monitor.c +++ b/spa/plugins/v4l2/v4l2-monitor.c @@ -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" diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c index 18b824dd..c012c622 100644 --- a/spa/plugins/videotestsrc/videotestsrc.c +++ b/spa/plugins/videotestsrc/videotestsrc.c @@ -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> diff --git a/spa/plugins/volume/volume.c b/spa/plugins/volume/volume.c index a8d5918b..a8ca4cdc 100644 --- a/spa/plugins/volume/volume.c +++ b/spa/plugins/volume/volume.c @@ -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> diff --git a/src/examples/export-sink.c b/src/examples/export-sink.c index 27cb8100..43369131 100644 --- a/src/examples/export-sink.c +++ b/src/examples/export-sink.c @@ -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> diff --git a/src/examples/export-source.c b/src/examples/export-source.c index 52ced890..d01b6b3f 100644 --- a/src/examples/export-source.c +++ b/src/examples/export-source.c @@ -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> diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c index 6d5e3f93..c9ab820d 100644 --- a/src/examples/local-v4l2.c +++ b/src/examples/local-v4l2.c @@ -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> diff --git a/src/modules/module-audio-dsp/floatmix.c b/src/modules/module-audio-dsp/floatmix.c index 100d77be..3039cde9 100644 --- a/src/modules/module-audio-dsp/floatmix.c +++ b/src/modules/module-audio-dsp/floatmix.c @@ -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> diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 450e875b..30430f42 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -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> diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index e22bd189..14bc8223 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -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> |