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;
|
2002-09-12 20:52:03 +00:00
|
|
|
GList *plugins, *features, *padtemplates;
|
|
|
|
const GList *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);
|
|
|
|
|
2002-09-20 03:29:38 +00:00
|
|
|
plugins = g_list_copy(gst_registry_pool_plugin_list());
|
2001-05-25 21:00:07 +00:00
|
|
|
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);
|
|
|
|
|
2002-09-20 03:29:38 +00:00
|
|
|
features = g_list_copy(gst_plugin_get_feature_list(plugin));
|
2001-08-21 20:16:48 +00:00
|
|
|
while (features) {
|
|
|
|
GstPluginFeature *feature;
|
|
|
|
GstElementFactory *factory;
|
|
|
|
|
|
|
|
feature = GST_PLUGIN_FEATURE (features->data);
|
|
|
|
features = g_list_next (features);
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
if (!GST_IS_ELEMENT_FACTORY (feature))
|
2001-08-21 20:16:48 +00:00
|
|
|
continue;
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
factory = GST_ELEMENT_FACTORY (feature);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
factorynode = xmlNewChild (doc->xmlRootNode, NULL, "element", NULL);
|
2002-09-20 03:29:38 +00:00
|
|
|
xmlNewChild (factorynode, NULL, "name",
|
2002-11-01 22:05:28 +00:00
|
|
|
GST_PLUGIN_FEATURE_NAME(factory));
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2002-09-20 03:29:38 +00:00
|
|
|
element = gst_element_factory_create(factory,NULL);
|
2002-03-24 22:07:09 +00:00
|
|
|
GST_DEBUG(GST_CAT_PLUGIN_LOADING, "adding factory %s",
|
2002-11-01 22:05:28 +00:00
|
|
|
GST_PLUGIN_FEATURE_NAME(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
|
2002-11-28 13:29:52 +00:00
|
|
|
xmlSaveFormatFile(GST_CACHE_DIR "/compreg.xml",doc,1);
|
2001-12-26 06:58:25 +00:00
|
|
|
#else
|
2002-11-28 13:29:52 +00:00
|
|
|
xmlSaveFile(GST_CACHE_DIR "/compreg.xml",doc);
|
2001-12-26 06:58:25 +00:00
|
|
|
#endif
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|