Added first attempt at plugin versioning.

Original commit message from CVS:
Added first attempt at plugin versioning.
This commit is contained in:
Richard Boulton 2001-04-21 09:30:08 +00:00
parent 31427072e3
commit 72e5e1342c
9 changed files with 18 additions and 10 deletions

View file

@ -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);

View file

@ -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");

View file

@ -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");

View file

@ -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");

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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");

View file

@ -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);