summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--farstream/fs-plugin.c23
-rw-r--r--farstream/fs-plugin.h50
-rw-r--r--transmitters/multicast/Makefile.am1
-rw-r--r--transmitters/multicast/fs-multicast-stream-transmitter.c6
-rw-r--r--transmitters/multicast/fs-multicast-transmitter.c6
-rw-r--r--transmitters/nice/Makefile.am1
-rw-r--r--transmitters/nice/fs-nice-agent.c5
-rw-r--r--transmitters/nice/fs-nice-stream-transmitter.c6
-rw-r--r--transmitters/nice/fs-nice-transmitter.c6
-rw-r--r--transmitters/rawudp/Makefile.am1
-rw-r--r--transmitters/rawudp/fs-rawudp-component.c5
-rw-r--r--transmitters/rawudp/fs-rawudp-stream-transmitter.c4
-rw-r--r--transmitters/rawudp/fs-rawudp-transmitter.c6
-rw-r--r--transmitters/shm/Makefile.am1
-rw-r--r--transmitters/shm/fs-shm-stream-transmitter.c6
-rw-r--r--transmitters/shm/fs-shm-transmitter.c8
17 files changed, 103 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac
index ffb9db6c..7973e053 100644
--- a/configure.ac
+++ b/configure.ac
@@ -337,7 +337,7 @@ AC_SUBST(FS_LIB_LDFLAGS)
dnl this really should only contain flags, not libs - they get added before
dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
-FS_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*fs_init_plugin\$\$' $FS_ALL_LDFLAGS"
+FS_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*fs_.*plugin.*' $FS_ALL_LDFLAGS"
AC_SUBST(FS_PLUGIN_LDFLAGS)
dnl this really should only contain flags, not libs - they get added before
diff --git a/farstream/fs-plugin.c b/farstream/fs-plugin.c
index 05a3bd4c..656d9d78 100644
--- a/farstream/fs-plugin.c
+++ b/farstream/fs-plugin.c
@@ -390,3 +390,26 @@ fs_plugin_list_available (const gchar *type_suffix)
return retval;
}
+
+/**
+ * fs_plugin_register_static:
+ * @name: The name of the plugin to register
+ * @type_suffix: The type of plugin to register (normally "transmitter")
+ *
+ * Register a staticly linked transmitter. This function should strictly be
+ * used by plugins own register function. To register a static plugin:
+ * extern fs_plugin_<name>_<type>_register_pluing (void);
+ * fs_plugin_<name>_<type>_register_pluing ();
+ **/
+
+void
+fs_plugin_register_static (const gchar *name, const gchar *type_suffix, GType type)
+{
+ FsPlugin *plugin;
+
+ plugin = g_object_new (FS_TYPE_PLUGIN, NULL);
+ plugin->name = g_strdup_printf ("%s-%s", name, type_suffix);
+ g_type_module_set_name (G_TYPE_MODULE (plugin), plugin->name);
+ plugin->type = type;
+ plugins = g_list_append (plugins, plugin);
+}
diff --git a/farstream/fs-plugin.h b/farstream/fs-plugin.h
index c6d0a216..abcbe453 100644
--- a/farstream/fs-plugin.h
+++ b/farstream/fs-plugin.h
@@ -104,6 +104,9 @@ GObject *fs_plugin_create (const gchar *name,
gchar **fs_plugin_list_available (const gchar *type_suffix);
+void fs_plugin_register_static (const gchar *name, const gchar *type_suffix,
+ GType type);
+
/**
* FS_INIT_PLUGIN:
* @type_register_func: A function that register a #GType and returns it
@@ -112,11 +115,52 @@ gchar **fs_plugin_list_available (const gchar *type_suffix);
* in any farstream plugin.
*/
-#define FS_INIT_PLUGIN(type_register_func) \
- G_MODULE_EXPORT void fs_init_plugin (FsPlugin *plugin) { \
- plugin->type = (type_register_func (plugin)); \
+#define _FS_REGISTER_TYPE(plugin,name,type) \
+ fs_ ## name ## _ ## type ## _register_type (plugin)
+
+#ifdef GST_PLUGIN_BUILD_STATIC
+
+#define FS_INIT_PLUGIN(name,type) \
+ G_MODULE_EXPORT void \
+ fs_plugin_ ## name ## _ ## type ## _register (void) \
+ { \
+ fs_plugin_register_static (#name, #type, \
+ _FS_REGISTER_TYPE (NULL, name, type)); \
}
+#else /* !GST_PLUGIN_BUILD_STATIC */
+
+#define FS_INIT_PLUGIN(name,_type) \
+ G_MODULE_EXPORT void \
+ fs_init_plugin (FsPlugin *plugin) \
+ { \
+ plugin->type = _FS_REGISTER_TYPE (plugin, name, _type); \
+ }
+
+#endif /* GST_PLUGIN_BUILD_STATIC */
+
+/**
+ * FS_PLUGIN_STATIC_DECLARE:
+ * @name: unique name of the plugin
+ *
+ * This macro can be used to initialize statically linked plugins. It is
+ * necessary to call this macro before the plugin can be used. It has to be
+ * used in combination with FS_PLUGIN_STATIC_REGISTER and must be placed
+ * outside any block to declare the plugin initialization function.
+ */
+#define FS_PLUGIN_STATIC_DECLARE(name) \
+ extern void fs_plugin_ ## name ## _register(void);
+
+/**
+ * FS_PLUGIN_STATIC_REGISTER:
+ * @name: unique name of the plugin
+ *
+ * This macro can be used to initialize statically linked plugins. It is
+ * necessary to call this macro before the plugin can be used. It has to
+ * be used in combination with FS_PLUGIN_STATIC_DECLARE and calls the plugin
+ * initialization function.
+ */
+#define FS_PLUGIN_STATIC_REGISTER(name) fs_plugin_ ## name ## _register ()
G_END_DECLS
#endif
diff --git a/transmitters/multicast/Makefile.am b/transmitters/multicast/Makefile.am
index d2e1954d..d5e3e2b1 100644
--- a/transmitters/multicast/Makefile.am
+++ b/transmitters/multicast/Makefile.am
@@ -16,6 +16,7 @@ libmulticast_transmitter_la_CFLAGS = \
$(GST_CFLAGS) \
$(GIO_CFLAGS)
libmulticast_transmitter_la_LDFLAGS = $(FS_PLUGIN_LDFLAGS)
+libmulticast_transmitter_la_LIBTOOLFLAGS = $(PLUGIN_LIBTOOLFLAGS)
libmulticast_transmitter_la_LIBADD = \
$(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
$(FS_LIBS) \
diff --git a/transmitters/multicast/fs-multicast-stream-transmitter.c b/transmitters/multicast/fs-multicast-stream-transmitter.c
index eb134b4f..ba0d3bcc 100644
--- a/transmitters/multicast/fs-multicast-stream-transmitter.c
+++ b/transmitters/multicast/fs-multicast-stream-transmitter.c
@@ -166,7 +166,7 @@ fs_multicast_stream_transmitter_get_type (void)
}
GType
-fs_multicast_stream_transmitter_register_type (FsPlugin *module)
+fs_multicast_stream_transmitter_register_type (FsPlugin *module G_GNUC_UNUSED)
{
static const GTypeInfo info = {
sizeof (FsMulticastStreamTransmitterClass),
@@ -180,8 +180,8 @@ fs_multicast_stream_transmitter_register_type (FsPlugin *module)
(GInstanceInitFunc) fs_multicast_stream_transmitter_init
};
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_STREAM_TRANSMITTER, "FsMulticastStreamTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_STREAM_TRANSMITTER,
+ "FsMulticastStreamTransmitter", &info, 0);
return type;
}
diff --git a/transmitters/multicast/fs-multicast-transmitter.c b/transmitters/multicast/fs-multicast-transmitter.c
index 1f9eaf1d..7918c1ac 100644
--- a/transmitters/multicast/fs-multicast-transmitter.c
+++ b/transmitters/multicast/fs-multicast-transmitter.c
@@ -173,13 +173,13 @@ fs_multicast_transmitter_register_type (FsPlugin *module)
fs_multicast_stream_transmitter_register_type (module);
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_TRANSMITTER, "FsMulticastTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_TRANSMITTER,
+ "FsMulticastTransmitter", &info, 0);
return type;
}
-FS_INIT_PLUGIN (fs_multicast_transmitter_register_type)
+FS_INIT_PLUGIN (multicast, transmitter)
static void
fs_multicast_transmitter_class_init (FsMulticastTransmitterClass *klass)
diff --git a/transmitters/nice/Makefile.am b/transmitters/nice/Makefile.am
index 051a17d3..cdacde42 100644
--- a/transmitters/nice/Makefile.am
+++ b/transmitters/nice/Makefile.am
@@ -17,6 +17,7 @@ libnice_transmitter_la_CFLAGS = \
$(GST_CFLAGS) \
$(NICE_CFLAGS)
libnice_transmitter_la_LDFLAGS = $(FS_PLUGIN_LDFLAGS)
+libnice_transmitter_la_LIBTOOLFLAGS = $(PLUGIN_LIBTOOLFLAGS)
libnice_transmitter_la_LIBADD = \
$(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
$(FS_LIBS) \
diff --git a/transmitters/nice/fs-nice-agent.c b/transmitters/nice/fs-nice-agent.c
index d95126dc..b94e7138 100644
--- a/transmitters/nice/fs-nice-agent.c
+++ b/transmitters/nice/fs-nice-agent.c
@@ -116,7 +116,7 @@ fs_nice_agent_get_type (void)
}
GType
-fs_nice_agent_register_type (FsPlugin *module)
+fs_nice_agent_register_type (FsPlugin *module G_GNUC_UNUSED)
{
static const GTypeInfo info = {
sizeof (FsNiceAgentClass),
@@ -130,8 +130,7 @@ fs_nice_agent_register_type (FsPlugin *module)
(GInstanceInitFunc) fs_nice_agent_init
};
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- G_TYPE_OBJECT, "FsNiceAgent", &info, 0);
+ type = g_type_register_static (G_TYPE_OBJECT, "FsNiceAgent", &info, 0);
return type;
}
diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index 9040635b..e126d9ae 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -203,7 +203,7 @@ fs_nice_stream_transmitter_get_type (void)
}
GType
-fs_nice_stream_transmitter_register_type (FsPlugin *module)
+fs_nice_stream_transmitter_register_type (FsPlugin *module G_GNUC_UNUSED)
{
static const GTypeInfo info = {
sizeof (FsNiceStreamTransmitterClass),
@@ -217,8 +217,8 @@ fs_nice_stream_transmitter_register_type (FsPlugin *module)
(GInstanceInitFunc) fs_nice_stream_transmitter_init
};
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_STREAM_TRANSMITTER, "FsNiceStreamTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_STREAM_TRANSMITTER,
+ "FsNiceStreamTransmitter", &info, 0);
return type;
}
diff --git a/transmitters/nice/fs-nice-transmitter.c b/transmitters/nice/fs-nice-transmitter.c
index 41545373..51f2371e 100644
--- a/transmitters/nice/fs-nice-transmitter.c
+++ b/transmitters/nice/fs-nice-transmitter.c
@@ -147,13 +147,13 @@ fs_nice_transmitter_register_type (FsPlugin *module)
fs_nice_stream_transmitter_register_type (module);
fs_nice_agent_register_type (module);
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_TRANSMITTER, "FsNiceTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_TRANSMITTER,
+ "FsNiceTransmitter", &info, 0);
return type;
}
-FS_INIT_PLUGIN (fs_nice_transmitter_register_type)
+FS_INIT_PLUGIN (nice, transmitter)
static void
fs_nice_transmitter_class_init (FsNiceTransmitterClass *klass)
diff --git a/transmitters/rawudp/Makefile.am b/transmitters/rawudp/Makefile.am
index 5fb562ac..1e99722a 100644
--- a/transmitters/rawudp/Makefile.am
+++ b/transmitters/rawudp/Makefile.am
@@ -20,6 +20,7 @@ librawudp_transmitter_la_CFLAGS = \
$(GIO_CFLAGS)
librawudp_transmitter_la_LDFLAGS = $(FS_PLUGIN_LDFLAGS)
+librawudp_transmitter_la_LIBTOOLFLAGS = $(PLUGIN_LIBTOOLFLAGS)
librawudp_transmitter_la_LIBADD = \
$(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
$(FS_LIBS) \
diff --git a/transmitters/rawudp/fs-rawudp-component.c b/transmitters/rawudp/fs-rawudp-component.c
index f9043df8..9281e3fa 100644
--- a/transmitters/rawudp/fs-rawudp-component.c
+++ b/transmitters/rawudp/fs-rawudp-component.c
@@ -235,7 +235,7 @@ fs_rawudp_component_get_type (void)
}
GType
-fs_rawudp_component_register_type (FsPlugin *module)
+fs_rawudp_component_register_type (FsPlugin *module G_GNUC_UNUSED)
{
static const GTypeInfo info = {
sizeof (FsRawUdpComponentClass),
@@ -251,8 +251,7 @@ fs_rawudp_component_register_type (FsPlugin *module)
/* Required because the GST type registration is not thread safe */
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- G_TYPE_OBJECT, "FsRawUdpComponent", &info, 0);
+ type = g_type_register_static (G_TYPE_OBJECT, "FsRawUdpComponent", &info, 0);
return type;
}
diff --git a/transmitters/rawudp/fs-rawudp-stream-transmitter.c b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
index f64a7d0a..0ab7f86a 100644
--- a/transmitters/rawudp/fs-rawudp-stream-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
@@ -226,8 +226,8 @@ fs_rawudp_stream_transmitter_register_type (FsPlugin *module)
fs_rawudp_component_register_type (module);
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_STREAM_TRANSMITTER, "FsRawUdpStreamTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_STREAM_TRANSMITTER,
+ "FsRawUdpStreamTransmitter", &info, 0);
return type;
}
diff --git a/transmitters/rawudp/fs-rawudp-transmitter.c b/transmitters/rawudp/fs-rawudp-transmitter.c
index 4372f150..24f6763b 100644
--- a/transmitters/rawudp/fs-rawudp-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-transmitter.c
@@ -162,14 +162,14 @@ fs_rawudp_transmitter_register_type (FsPlugin *module)
fs_rawudp_stream_transmitter_register_type (module);
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_TRANSMITTER, "FsRawUdpTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_TRANSMITTER, "FsRawUdpTransmitter",
+ &info, 0);
return type;
}
-FS_INIT_PLUGIN (fs_rawudp_transmitter_register_type)
+FS_INIT_PLUGIN (rawudp, transmitter)
static void
fs_rawudp_transmitter_class_init (FsRawUdpTransmitterClass *klass)
diff --git a/transmitters/shm/Makefile.am b/transmitters/shm/Makefile.am
index 4b5c6b21..e56a1b9c 100644
--- a/transmitters/shm/Makefile.am
+++ b/transmitters/shm/Makefile.am
@@ -15,6 +15,7 @@ libshm_transmitter_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS)
libshm_transmitter_la_LDFLAGS = $(FS_PLUGIN_LDFLAGS)
+libshm_transmitter_la_LIBTOOLFLAGS = $(PLUGIN_LIBTOOLFLAGS)
libshm_transmitter_la_LIBADD = \
$(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
$(FS_LIBS) \
diff --git a/transmitters/shm/fs-shm-stream-transmitter.c b/transmitters/shm/fs-shm-stream-transmitter.c
index 796e898b..e745480b 100644
--- a/transmitters/shm/fs-shm-stream-transmitter.c
+++ b/transmitters/shm/fs-shm-stream-transmitter.c
@@ -176,7 +176,7 @@ fs_shm_stream_transmitter_get_type (void)
}
GType
-fs_shm_stream_transmitter_register_type (FsPlugin *module)
+fs_shm_stream_transmitter_register_type (FsPlugin *module G_GNUC_UNUSED)
{
static const GTypeInfo info = {
sizeof (FsShmStreamTransmitterClass),
@@ -190,8 +190,8 @@ fs_shm_stream_transmitter_register_type (FsPlugin *module)
(GInstanceInitFunc) fs_shm_stream_transmitter_init
};
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_STREAM_TRANSMITTER, "FsShmStreamTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_STREAM_TRANSMITTER,
+ "FsShmStreamTransmitter", &info, 0);
return type;
}
diff --git a/transmitters/shm/fs-shm-transmitter.c b/transmitters/shm/fs-shm-transmitter.c
index 917eccff..28a6ad48 100644
--- a/transmitters/shm/fs-shm-transmitter.c
+++ b/transmitters/shm/fs-shm-transmitter.c
@@ -241,16 +241,16 @@ fs_shm_transmitter_register_type (FsPlugin *module)
fs_shm_stream_transmitter_register_type (module);
- type = g_type_module_register_type (G_TYPE_MODULE (module),
- FS_TYPE_TRANSMITTER, "FsShmTransmitter", &info, 0);
+ type = g_type_register_static (FS_TYPE_TRANSMITTER, "FsShmTransmitter",
+ &info, 0);
- shm_bin_type = g_type_module_register_type (G_TYPE_MODULE (module),
+ shm_bin_type = g_type_register_static (
GST_TYPE_BIN, "FsShmBin", &bin_info, 0);
return type;
}
-FS_INIT_PLUGIN (fs_shm_transmitter_register_type)
+FS_INIT_PLUGIN (shm, transmitter)
static void
fs_shm_transmitter_class_init (FsShmTransmitterClass *klass)