2001-05-25 21:00:07 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
|
|
|
xmlDocPtr doc;
|
|
|
|
xmlNodePtr factorynode, padnode, argnode, optionnode;
|
2001-08-21 20:16:48 +00:00
|
|
|
GList *plugins, *features, *padtemplates, *pads;
|
2001-05-25 21:00:07 +00:00
|
|
|
GstElement *element;
|
|
|
|
GstPad *pad;
|
|
|
|
GstPadTemplate *padtemplate;
|
2001-06-25 01:20:11 +00:00
|
|
|
GParamSpec **property_specs;
|
|
|
|
gint num_properties,i;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
gst_debug_set_categories(0);
|
|
|
|
gst_info_set_categories(0);
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
|
|
|
doc = xmlNewDoc("1.0");
|
|
|
|
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-CompletionRegistry", NULL);
|
|
|
|
|
|
|
|
plugins = gst_plugin_get_list();
|
|
|
|
while (plugins) {
|
2001-08-21 20:16:48 +00:00
|
|
|
GstPlugin *plugin;
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
plugin = (GstPlugin *)(plugins->data);
|
|
|
|
plugins = g_list_next (plugins);
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
features = gst_plugin_get_feature_list(plugin);
|
|
|
|
while (features) {
|
|
|
|
GstPluginFeature *feature;
|
|
|
|
GstElementFactory *factory;
|
|
|
|
|
|
|
|
feature = GST_PLUGIN_FEATURE (features->data);
|
|
|
|
features = g_list_next (features);
|
|
|
|
|
|
|
|
if (!GST_IS_ELEMENTFACTORY (feature))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
factory = GST_ELEMENTFACTORY (feature);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
factorynode = xmlNewChild (doc->xmlRootNode, NULL, "element", NULL);
|
2001-08-21 20:16:48 +00:00
|
|
|
xmlNewChild (factorynode, NULL, "name", gst_object_get_name (GST_OBJECT (factory)));
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
element = gst_elementfactory_create(factory,"element");
|
2002-01-12 01:25:14 +00:00
|
|
|
GST_DEBUG(GST_CAT_PLUGIN_LOADING, "adding factory %s\n",
|
2001-12-25 22:57:31 +00:00
|
|
|
gst_object_get_name (GST_OBJECT (factory)));
|
2001-05-25 21:00:07 +00:00
|
|
|
if (element == NULL) {
|
2001-08-21 20:16:48 +00:00
|
|
|
fprintf(stderr,"couldn't construct element from factory %s\n",
|
|
|
|
gst_object_get_name (GST_OBJECT (factory)));
|
2001-05-25 21:00:07 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* write out the padtemplates */
|
2001-05-25 21:00:07 +00:00
|
|
|
padtemplates = factory->padtemplates;
|
|
|
|
while (padtemplates) {
|
|
|
|
padtemplate = (GstPadTemplate *)(padtemplates->data);
|
|
|
|
padtemplates = g_list_next (padtemplates);
|
|
|
|
|
|
|
|
if (padtemplate->direction == GST_PAD_SRC)
|
|
|
|
padnode = xmlNewChild (factorynode, NULL, "srcpadtemplate", padtemplate->name_template);
|
|
|
|
else if (padtemplate->direction == GST_PAD_SINK)
|
|
|
|
padnode = xmlNewChild (factorynode, NULL, "sinkpadtemplate", padtemplate->name_template);
|
|
|
|
}
|
|
|
|
|
|
|
|
pads = gst_element_get_pad_list (element);
|
|
|
|
while (pads) {
|
|
|
|
pad = (GstPad *)(pads->data);
|
|
|
|
pads = g_list_next (pads);
|
|
|
|
|
|
|
|
if (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
|
|
|
|
padnode = xmlNewChild (factorynode, NULL, "srcpad", GST_PAD_NAME(pad));
|
|
|
|
else if (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
|
|
|
|
padnode = xmlNewChild (factorynode, NULL, "sinkpad", GST_PAD_NAME(pad));
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* write out the args */
|
2001-06-25 01:20:11 +00:00
|
|
|
property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
|
|
|
|
for (i=0;i<num_properties;i++) {
|
|
|
|
GParamSpec *param = property_specs[i];
|
|
|
|
argnode = xmlNewChild (factorynode, NULL, "argument", param->name);
|
|
|
|
if (param->value_type == GST_TYPE_FILENAME) {
|
2001-05-25 21:00:07 +00:00
|
|
|
xmlNewChild (argnode, NULL, "filename", NULL);
|
2001-06-25 01:20:11 +00:00
|
|
|
} else if (G_IS_PARAM_SPEC_ENUM (param) == G_TYPE_ENUM) {
|
|
|
|
GEnumValue *values;
|
2001-05-25 21:00:07 +00:00
|
|
|
gint j;
|
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
|
2001-05-25 21:00:07 +00:00
|
|
|
for (j=0;values[j].value_name;j++) {
|
|
|
|
gchar *value = g_strdup_printf("%d",values[j].value);
|
|
|
|
optionnode = xmlNewChild (argnode, NULL, "option", value);
|
|
|
|
xmlNewChild (optionnode, NULL, "value_nick", values[j].value_nick);
|
|
|
|
g_free(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-26 06:58:25 +00:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
xmlSaveFormatFile(GST_CONFIG_DIR "/compreg.xml",doc,1);
|
|
|
|
#else
|
2001-05-25 21:00:07 +00:00
|
|
|
xmlSaveFile(GST_CONFIG_DIR "/compreg.xml",doc);
|
2001-12-26 06:58:25 +00:00
|
|
|
#endif
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|