[pulseaudio-discuss] [PATCH] RFC: Remove symdef header generation
Arun Raghavan
arun at arunraghavan.net
Tue Dec 5 05:26:37 UTC 2017
---
src/modules/module-allow-passthrough.c | 5 +++--
src/modules/module-null-sink.c | 6 +++---
src/pulsecore/module.h | 29 +++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/src/modules/module-allow-passthrough.c b/src/modules/module-allow-passthrough.c
index aea81cb52..5fda6878a 100644
--- a/src/modules/module-allow-passthrough.c
+++ b/src/modules/module-allow-passthrough.c
@@ -25,6 +25,9 @@
#include <pulse/xmalloc.h>
+#define PA_MODULE_NAME module_allow_passthrough
+#include <pulsecore/module.h>
+
#include <pulsecore/core.h>
#include <pulsecore/i18n.h>
#include <pulsecore/sink-input.h>
@@ -34,8 +37,6 @@
#include <pulsecore/namereg.h>
#include <pulsecore/core-util.h>
-#include "module-allow-passthrough-symdef.h"
-
PA_MODULE_AUTHOR("Guillaume Desmottes");
PA_MODULE_DESCRIPTION("When a passthrough stream is requested, route all the other streams to a dummy device");
PA_MODULE_VERSION(PACKAGE_VERSION);
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 9237656a3..f4107f554 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -30,10 +30,12 @@
#include <pulse/timeval.h>
#include <pulse/xmalloc.h>
+#define PA_MODULE_NAME module_null_sink
+#include <pulsecore/module.h>
+
#include <pulsecore/i18n.h>
#include <pulsecore/macro.h>
#include <pulsecore/sink.h>
-#include <pulsecore/module.h>
#include <pulsecore/core-util.h>
#include <pulsecore/modargs.h>
#include <pulsecore/log.h>
@@ -41,8 +43,6 @@
#include <pulsecore/thread-mq.h>
#include <pulsecore/rtpoll.h>
-#include "module-null-sink-symdef.h"
-
PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION(_("Clocked NULL sink"));
PA_MODULE_VERSION(PACKAGE_VERSION);
diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
index ec2de0b94..d20c80258 100644
--- a/src/pulsecore/module.h
+++ b/src/pulsecore/module.h
@@ -92,4 +92,33 @@ void pa_module_hook_connect(pa_module *m, pa_hook *hook, pa_hook_priority_t prio
bool pa__load_once(void) { return b; } \
struct __stupid_useless_struct_to_allow_trailing_semicolon
+/* Check if we're defining a module */
+#ifdef PA_MODULE_NAME
+
+/* Jump through some double-indirection hoops to get PA_MODULE_NAME substituted before the concatenation */
+#define _PA_MACRO_CONCAT1(a, b) a ## b
+#define _PA_MACRO_CONCAT(a, b) _PA_MACRO_CONCAT1(a, b)
+
+#define pa__init _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__init)
+#define pa__done _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__done)
+#define pa__get_author _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_author)
+#define pa__get_description _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_description)
+#define pa__get_usage _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_usage)
+#define pa__get_version _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_version)
+#define pa__get_deprecated _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_deprecated)
+#define pa__load_once _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__load_once)
+#define pa__get_n_used _PA_MACRO_CONCAT(PA_MODULE_NAME, _LTX_pa__get_n_used)
+
+int pa__init(pa_module*m);
+void pa__done(pa_module*m);
+int pa__get_n_used(pa_module*m);
+
+const char* pa__get_author(void);
+const char* pa__get_description(void);
+const char* pa__get_usage(void);
+const char* pa__get_version(void);
+const char* pa__get_deprecated(void);
+bool pa__load_once(void);
+#endif /* PA_MODULE_NAME */
+
#endif
--
2.14.3
More information about the pulseaudio-discuss
mailing list