mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Also allow static plugin registration after calling _gst_plugin_init()
Original commit message from CVS: Also allow static plugin registration after calling _gst_plugin_init()
This commit is contained in:
parent
ef258ceb50
commit
faa67ac4af
1 changed files with 30 additions and 23 deletions
|
@ -32,11 +32,9 @@
|
||||||
#include "gstlog.h"
|
#include "gstlog.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static GModule *main_module;
|
static GModule *main_module = NULL;
|
||||||
|
static GList *_gst_plugin_static = NULL;
|
||||||
|
|
||||||
GList *_gst_plugin_static = NULL;
|
|
||||||
|
|
||||||
static void gst_plugin_register_statics (GModule *module);
|
|
||||||
static GstPlugin* gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin,
|
static GstPlugin* gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin,
|
||||||
GModule *module);
|
GModule *module);
|
||||||
GQuark
|
GQuark
|
||||||
|
@ -48,37 +46,46 @@ gst_plugin_error_quark (void)
|
||||||
return quark;
|
return quark;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/* this function can be called in the GCC constructor extension, before
|
||||||
_gst_plugin_initialize (void)
|
* the _gst_plugin_initialize() was called. In that case, we store the
|
||||||
{
|
* plugin description in a list to initialize it when we open the main
|
||||||
main_module = g_module_open (NULL, G_MODULE_BIND_LAZY);
|
* module later on.
|
||||||
gst_plugin_register_statics (main_module);
|
* When the main module is known, we can register the plugin right away.
|
||||||
}
|
* */
|
||||||
|
|
||||||
void
|
void
|
||||||
_gst_plugin_register_static (GstPluginDesc *desc)
|
_gst_plugin_register_static (GstPluginDesc *desc)
|
||||||
{
|
{
|
||||||
|
if (main_module == NULL) {
|
||||||
_gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
|
_gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
static void
|
|
||||||
gst_plugin_register_statics (GModule *module)
|
|
||||||
{
|
|
||||||
GList *walk = _gst_plugin_static;
|
|
||||||
|
|
||||||
while (walk) {
|
|
||||||
GstPluginDesc *desc = (GstPluginDesc *) walk->data;
|
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
|
|
||||||
plugin = g_new0 (GstPlugin, 1);
|
plugin = g_new0 (GstPlugin, 1);
|
||||||
plugin->filename = NULL;
|
plugin->filename = NULL;
|
||||||
plugin->module = NULL;
|
plugin->module = NULL;
|
||||||
plugin = gst_plugin_register_func (desc, plugin, module);
|
plugin = gst_plugin_register_func (desc, plugin, main_module);
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
plugin->module = module;
|
plugin->module = main_module;
|
||||||
gst_registry_pool_add_plugin (plugin);
|
gst_registry_pool_add_plugin (plugin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gst_plugin_initialize (void)
|
||||||
|
{
|
||||||
|
GList *walk;
|
||||||
|
|
||||||
|
main_module = g_module_open (NULL, G_MODULE_BIND_LAZY);
|
||||||
|
|
||||||
|
/* now register all static plugins */
|
||||||
|
walk = _gst_plugin_static;
|
||||||
|
while (walk) {
|
||||||
|
GstPluginDesc *desc = (GstPluginDesc *) walk->data;
|
||||||
|
|
||||||
|
_gst_plugin_register_static (desc);
|
||||||
|
|
||||||
walk = g_list_next (walk);
|
walk = g_list_next (walk);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue