gstreamer/test/xml/createreg.c
Wim Taymans 12bbbd5c1e Lots of modifications to the plugin system.
Original commit message from CVS:
Lots of modifications to the plugin system.
- Added a GstPluginfeature object that serves as a base class for all
plugin contents.
- changed the plugin API, everyhting is now added with
gst_plugin_add_feature
- typefactories are named now so that they can be located easily and filled
in at plugin load.
- mime types like "video/raw image/raw" are gone for now.
- lots of plugin updates (style and API changes)
- tested with an without registry.
- updates to various tools.
- added a little testsuite to test/show how you can load plugins (4 modes)

Test this one, Almost everything has changed :-)
2001-08-21 20:16:48 +00:00

67 lines
2.2 KiB
C

#include <glib.h>
#include <gnome-xml/parser.h>
#include <gst/gst.h>
typedef struct _GstRegistryPlugin GstRegistryPlugin;
typedef struct _GstRegistryElement GstRegistryElement;
struct _GstRegistryPlugin {
gchar *name;
gchar *filename;
};
struct _GstRegistryElement {
GstRegistryPlugin *plugin;
gchar *name;
GstElementDetails details;
};
int main(int argc,char *argv[]) {
xmlDocPtr doc;
xmlNodePtr tree, subtree;
GList *plugins = NULL, *features = NULL;
gst_init(&argc,&argv);
gst_plugin_load_all();
doc = xmlNewDoc("1.0");
doc->root = xmlNewDocNode(doc,NULL,"GST-PluginRegistry",NULL);
plugins = gst_plugin_get_list();
while (plugins) {
GstPlugin *plugin = (GstPlugin *)plugins->data;
tree = xmlNewChild(doc->root,NULL,"plugin",NULL);
subtree = xmlNewChild(tree,NULL,"name",plugin->name);
subtree = xmlNewChild(tree,NULL,"longname",plugin->longname);
subtree = xmlNewChild(tree,NULL,"filename",plugin->filename);
features = plugin->features;
while (features) {
GstPluginFeature *feature = GST_PLUGIN_FEATURE (features->data);
if (GST_IS_ELEMENTFACTORY (feature)) {
GstElementFactory *element = GST_ELEMENTFACTORY (feature);
tree = xmlNewChild(doc->root,NULL, "element", NULL);
subtree = xmlNewChild (tree, NULL, "plugin", plugin->name);
subtree = xmlNewChild (tree, NULL, "name", gst_object_get_name (GST_OBJECT (element)));
subtree = xmlNewChild (tree, NULL, "longname",
element->details->longname);
subtree = xmlNewChild (tree, NULL, "class",
element->details->klass);
subtree = xmlNewChild (tree, NULL, "description",
element->details->description);
subtree = xmlNewChild (tree, NULL, "version",
element->details->version);
subtree = xmlNewChild (tree, NULL, "author",
element->details->author);
subtree = xmlNewChild (tree, NULL, "copyright",
element->details->copyright);
}
features = g_list_next (features);
}
plugins = g_list_next(plugins);
}
xmlSaveFile("newreg.xml",doc);
exit(0);
}