mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
gst/: Change API of gst_plugin_register_static() to not take a GstPluginDesc, but rather just take all the arguments ...
Original commit message from CVS: * gst/gst.c: (init_post): * gst/gstplugin.c: (_gst_plugin_register_static), (gst_plugin_register_static), (_gst_plugin_initialize): * gst/gstplugin.h: (GstPluginFilter): Change API of gst_plugin_register_static() to not take a GstPluginDesc, but rather just take all the arguments in a GstPluginDesc directly. This is more intuitive and avoids certain mistakes when porting code from GST_PLUGIN_DEFINE_STATIC to gst_plugin_register_static(). Fixes #510187. * tests/check/gst/gstplugin.c: Fix up for changed API.
This commit is contained in:
parent
637128bf69
commit
33cd142292
5 changed files with 71 additions and 40 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2008-01-17 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/gst.c: (init_post):
|
||||||
|
* gst/gstplugin.c: (_gst_plugin_register_static),
|
||||||
|
(gst_plugin_register_static), (_gst_plugin_initialize):
|
||||||
|
* gst/gstplugin.h: (GstPluginFilter):
|
||||||
|
Change API of gst_plugin_register_static() to not take
|
||||||
|
a GstPluginDesc, but rather just take all the arguments
|
||||||
|
in a GstPluginDesc directly. This is more intuitive and
|
||||||
|
avoids certain mistakes when porting code from
|
||||||
|
GST_PLUGIN_DEFINE_STATIC to gst_plugin_register_static().
|
||||||
|
Fixes #510187.
|
||||||
|
|
||||||
|
* tests/check/gst/gstplugin.c:
|
||||||
|
Fix up for changed API.
|
||||||
|
|
||||||
2008-01-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
2008-01-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* docs/faq/legal.xml:
|
* docs/faq/legal.xml:
|
||||||
|
|
20
gst/gst.c
20
gst/gst.c
|
@ -625,21 +625,6 @@ gst_register_core_elements (GstPlugin * plugin)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPluginDesc plugin_desc = {
|
|
||||||
GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"staticelements",
|
|
||||||
"core elements linked into the GStreamer library",
|
|
||||||
gst_register_core_elements,
|
|
||||||
VERSION,
|
|
||||||
GST_LICENSE,
|
|
||||||
PACKAGE,
|
|
||||||
GST_PACKAGE_NAME,
|
|
||||||
GST_PACKAGE_ORIGIN,
|
|
||||||
|
|
||||||
GST_PADDING_INIT
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef GST_DISABLE_REGISTRY
|
#ifndef GST_DISABLE_REGISTRY
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -994,7 +979,10 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
|
||||||
_gst_plugin_initialize ();
|
_gst_plugin_initialize ();
|
||||||
|
|
||||||
/* register core plugins */
|
/* register core plugins */
|
||||||
gst_plugin_register_static (&plugin_desc);
|
gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
|
||||||
|
"staticelements", "core elements linked into the GStreamer library",
|
||||||
|
gst_register_core_elements, VERSION, GST_LICENSE, PACKAGE,
|
||||||
|
GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Any errors happening below this point are non-fatal, we therefore mark
|
* Any errors happening below this point are non-fatal, we therefore mark
|
||||||
|
|
|
@ -179,14 +179,30 @@ _gst_plugin_register_static (GstPluginDesc * desc)
|
||||||
desc->name);
|
desc->name);
|
||||||
_gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
|
_gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
|
||||||
} else {
|
} else {
|
||||||
gst_plugin_register_static (desc);
|
gst_plugin_register_static (desc->major_version, desc->minor_version,
|
||||||
|
desc->name, desc->description, desc->plugin_init, desc->version,
|
||||||
|
desc->license, desc->source, desc->package, desc->origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_plugin_register_static:
|
* gst_plugin_register_static:
|
||||||
* @desc: a #GstPluginDesc describing the plugin.
|
* @major_version: the major version number of the GStreamer core that the
|
||||||
|
* plugin was compiled for, you can just use GST_VERSION_MAJOR here
|
||||||
|
* @minor_version: the minor version number of the GStreamer core that the
|
||||||
|
* plugin was compiled for, you can just use GST_VERSION_MINOR here
|
||||||
|
* @name: a unique name of the plugin (ideally prefixed with an application- or
|
||||||
|
* library-specific namespace prefix in order to avoid name conflicts in
|
||||||
|
* case a similar plugin with the same name ever gets added to GStreamer)
|
||||||
|
* @description: description of the plugin
|
||||||
|
* @init_func: pointer to the init function of this plugin.
|
||||||
|
* @version: version string of the plugin
|
||||||
|
* @license: effective license of plugin. Must be one of the approved licenses
|
||||||
|
* (see #GstPluginDesc above) or the plugin will not be registered.
|
||||||
|
* @source: source module plugin belongs to
|
||||||
|
* @package: shipped package plugin belongs to
|
||||||
|
* @origin: URL to provider of plugin
|
||||||
*
|
*
|
||||||
* Registers a static plugin, ie. a plugin which is private to an application
|
* Registers a static plugin, ie. a plugin which is private to an application
|
||||||
* or library and contained within the application or library (as opposed to
|
* or library and contained within the application or library (as opposed to
|
||||||
|
@ -200,21 +216,35 @@ _gst_plugin_register_static (GstPluginDesc * desc)
|
||||||
* Since: 0.10.16
|
* Since: 0.10.16
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_plugin_register_static (const GstPluginDesc * desc)
|
gst_plugin_register_static (gint major_version, gint minor_version,
|
||||||
|
const gchar * name, gchar * description, GstPluginInitFunc init_func,
|
||||||
|
const gchar * version, const gchar * license, const gchar * source,
|
||||||
|
const gchar * package, const gchar * origin)
|
||||||
{
|
{
|
||||||
|
GstPluginDesc desc = { major_version, minor_version, name, description,
|
||||||
|
init_func, version, license, source, package, origin,
|
||||||
|
};
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (desc != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (description != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (init_func != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (version != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (license != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (source != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (package != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (origin != NULL, FALSE);
|
||||||
|
|
||||||
/* make sure gst_init() has been called */
|
/* make sure gst_init() has been called */
|
||||||
g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
|
g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
|
||||||
|
|
||||||
GST_LOG ("attempting to load static plugin \"%s\" now...", desc->name);
|
GST_LOG ("attempting to load static plugin \"%s\" now...", name);
|
||||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||||
if (gst_plugin_register_func (plugin, desc) != NULL) {
|
if (gst_plugin_register_func (plugin, &desc) != NULL) {
|
||||||
GST_INFO ("loaded static plugin \"%s\"", desc->name);
|
GST_INFO ("registered static plugin \"%s\"", name);
|
||||||
res = gst_default_registry_add_plugin (plugin);
|
res = gst_default_registry_add_plugin (plugin);
|
||||||
|
GST_INFO ("added static plugin \"%s\", result: %d", name, res);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,16 @@ GType gst_plugin_get_type (void);
|
||||||
void _gst_plugin_register_static (GstPluginDesc *desc);
|
void _gst_plugin_register_static (GstPluginDesc *desc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gboolean gst_plugin_register_static (const GstPluginDesc *desc);
|
gboolean gst_plugin_register_static (gint major_version,
|
||||||
|
gint minor_version,
|
||||||
|
const gchar *name,
|
||||||
|
gchar *description,
|
||||||
|
GstPluginInitFunc init_func,
|
||||||
|
const gchar *version,
|
||||||
|
const gchar *license,
|
||||||
|
const gchar *source,
|
||||||
|
const gchar *package,
|
||||||
|
const gchar *origin);
|
||||||
|
|
||||||
G_CONST_RETURN gchar* gst_plugin_get_name (GstPlugin *plugin);
|
G_CONST_RETURN gchar* gst_plugin_get_name (GstPlugin *plugin);
|
||||||
G_CONST_RETURN gchar* gst_plugin_get_description (GstPlugin *plugin);
|
G_CONST_RETURN gchar* gst_plugin_get_description (GstPlugin *plugin);
|
||||||
|
|
|
@ -50,27 +50,15 @@ static GstPluginDesc plugin_desc = {
|
||||||
GST_PADDING_INIT
|
GST_PADDING_INIT
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstPluginDesc plugin_desc2 = {
|
|
||||||
GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"more-elements",
|
|
||||||
"more-elements",
|
|
||||||
register_check_elements,
|
|
||||||
VERSION,
|
|
||||||
GST_LICENSE,
|
|
||||||
PACKAGE,
|
|
||||||
GST_PACKAGE_NAME,
|
|
||||||
GST_PACKAGE_ORIGIN,
|
|
||||||
|
|
||||||
GST_PADDING_INIT
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_START_TEST (test_register_static)
|
GST_START_TEST (test_register_static)
|
||||||
{
|
{
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
|
|
||||||
_gst_plugin_register_static (&plugin_desc);
|
_gst_plugin_register_static (&plugin_desc);
|
||||||
gst_plugin_register_static (&plugin_desc2);
|
fail_unless (gst_plugin_register_static (GST_VERSION_MAJOR,
|
||||||
|
GST_VERSION_MINOR, "more-elements", "more-elements",
|
||||||
|
register_check_elements, VERSION, GST_LICENSE, PACKAGE,
|
||||||
|
GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN));
|
||||||
|
|
||||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue