From 72e5e1342c3ec546976fa8509e6c0c4995a82f2b Mon Sep 17 00:00:00 2001 From: Richard Boulton Date: Sat, 21 Apr 2001 09:30:08 +0000 Subject: [PATCH] Added first attempt at plugin versioning. Original commit message from CVS: Added first attempt at plugin versioning. --- examples/plugins/example.c | 2 +- gst/autoplug/gststaticautoplug.c | 2 +- gst/autoplug/gststaticautoplugrender.c | 2 +- gst/elements/gstelements.c | 2 +- gst/gstplugin.c | 12 ++++++++++-- gst/gstplugin.h | 2 +- gst/types/gsttypes.c | 2 +- plugins/elements/gstelements.c | 2 +- tests/old/examples/plugins/example.c | 2 +- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/examples/plugins/example.c b/examples/plugins/example.c index 75e5c78ce6..340436bb8e 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -342,7 +342,7 @@ plugin_init (GModule *module) GstElementFactory *factory; /* First we try to create a new Plugin structure. */ - plugin = gst_plugin_new("example"); + plugin = gst_plugin_new("example", GST_VERSION_MAJOR, GST_VERSION_MINOR); /* If we get a NULL back, chances are we're already loaded. */ g_return_val_if_fail(plugin != NULL, NULL); diff --git a/gst/autoplug/gststaticautoplug.c b/gst/autoplug/gststaticautoplug.c index ca06fe9398..a6ea726919 100644 --- a/gst/autoplug/gststaticautoplug.c +++ b/gst/autoplug/gststaticautoplug.c @@ -86,7 +86,7 @@ plugin_init (GModule *module) GstPlugin *plugin; GstAutoplugFactory *factory; - plugin = gst_plugin_new("gststaticautoplug"); + plugin = gst_plugin_new("gststaticautoplug", GST_VERSION_MAJOR, GST_VERSION_MINOR); g_return_val_if_fail(plugin != NULL,NULL); gst_plugin_set_longname (plugin, "A static autoplugger"); diff --git a/gst/autoplug/gststaticautoplugrender.c b/gst/autoplug/gststaticautoplugrender.c index ec30e374a2..da9b4f7105 100644 --- a/gst/autoplug/gststaticautoplugrender.c +++ b/gst/autoplug/gststaticautoplugrender.c @@ -86,7 +86,7 @@ plugin_init (GModule *module) GstPlugin *plugin; GstAutoplugFactory *factory; - plugin = gst_plugin_new("gststaticautoplugrender"); + plugin = gst_plugin_new("gststaticautoplugrender", GST_VERSION_MAJOR, GST_VERSION_MINOR); g_return_val_if_fail(plugin != NULL,NULL); gst_plugin_set_longname (plugin, "A static autoplugger"); diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c index 2b5dbf61b8..fc326270b9 100644 --- a/gst/elements/gstelements.c +++ b/gst/elements/gstelements.c @@ -73,7 +73,7 @@ GstPlugin *plugin_init (GModule *module) GstElementFactory *factory; gint i = 0; - plugin = gst_plugin_new("gstelements"); + plugin = gst_plugin_new("gstelements", GST_VERSION_MAJOR, GST_VERSION_MINOR); g_return_val_if_fail(plugin != NULL,NULL); gst_plugin_set_longname (plugin, "Standard GST Elements"); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 2e5362a2ae..a42da9910b 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -27,6 +27,7 @@ #include "gst_private.h" #include "gstplugin.h" +#include "gstversion.h" #include "config.h" @@ -392,16 +393,23 @@ gst_plugin_load_absolute (const gchar *name) /** * gst_plugin_new: * @name: name of new plugin + * @major: major version number of core that plugin is compatible with + * @minor: minor version number of core that plugin is compatible with * * Create a new plugin with given name. * - * Returns: new plugin + * Returns: new plugin, or NULL if plugin couldn't be created, due to + * incompatible version number, or name already being allocated) */ GstPlugin* -gst_plugin_new (const gchar *name) +gst_plugin_new (const gchar *name, gint major, gint minor) { GstPlugin *plugin; + // return NULL if the major and minor version numbers are not compatible + // with ours. + if (major != GST_VERSION_MAJOR || minor != GST_VERSION_MINOR) return NULL; + // return NULL if the plugin is allready loaded plugin = gst_plugin_find (name); if (plugin) return NULL; diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 299d10edc1..ce4fe29995 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -62,7 +62,7 @@ typedef GstPlugin* (*GstPluginInitFunc) (GModule *module); void _gst_plugin_initialize (void); -GstPlugin* gst_plugin_new (const gchar *name); +GstPlugin* gst_plugin_new (const gchar *name, gint major, gint minor); void gst_plugin_add_path (const gchar *path); diff --git a/gst/types/gsttypes.c b/gst/types/gsttypes.c index 9fe885b644..59449fdc13 100644 --- a/gst/types/gsttypes.c +++ b/gst/types/gsttypes.c @@ -34,7 +34,7 @@ plugin_init (GModule *module) GstPlugin *plugin; gint i = 0; - plugin = gst_plugin_new ("gsttypes"); + plugin = gst_plugin_new ("gsttypes", GST_VERSION_MAJOR, GST_VERSION_MINOR); g_return_val_if_fail (plugin != NULL,NULL); while (_factories[i].mime) { diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index 2b5dbf61b8..fc326270b9 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -73,7 +73,7 @@ GstPlugin *plugin_init (GModule *module) GstElementFactory *factory; gint i = 0; - plugin = gst_plugin_new("gstelements"); + plugin = gst_plugin_new("gstelements", GST_VERSION_MAJOR, GST_VERSION_MINOR); g_return_val_if_fail(plugin != NULL,NULL); gst_plugin_set_longname (plugin, "Standard GST Elements"); diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index 75e5c78ce6..340436bb8e 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -342,7 +342,7 @@ plugin_init (GModule *module) GstElementFactory *factory; /* First we try to create a new Plugin structure. */ - plugin = gst_plugin_new("example"); + plugin = gst_plugin_new("example", GST_VERSION_MAJOR, GST_VERSION_MINOR); /* If we get a NULL back, chances are we're already loaded. */ g_return_val_if_fail(plugin != NULL, NULL);