mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
d6386e096a
Original commit message from CVS: Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> * examples/typefind/typefind.c: (type_found): * examples/xml/createxml.c: (object_saved): * examples/xml/runxml.c: (xml_loaded), (main): * gst/elements/gstaggregator.c: (gst_aggregator_loop), (gst_aggregator_chain): * gst/elements/gstmd5sink.c: (gst_md5sink_get_property): * gst/elements/gsttypefindelement.c: (find_element_get_length), (gst_type_find_element_handle_event): * gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush): * gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc), (gst_xml_parse_file), (gst_xml_parse_memory), (gst_xml_get_element), (gst_xml_make_element): * gst/indexers/gstfileindex.c: (gst_file_index_load), (_file_index_id_save_xml), (gst_file_index_commit): * gst/schedulers/gstoptimalscheduler.c: (group_inc_links_for_element): * libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps), (gst_dp_packet_from_event), (gst_dp_caps_from_packet): * tools/gst-complete.c: (main): * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_element_properties_info): * tools/gst-launch.c: (xmllaunch_parse_cmdline): * tools/gst-xmlinspect.c: (print_element_properties): More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
153 lines
4.5 KiB
C
153 lines
4.5 KiB
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#include <locale.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (debug_compprep);
|
|
#define GST_CAT_DEFAULT debug_compprep
|
|
#define GST_COMPREG_FILE (GST_CACHE_DIR "/compreg.xml")
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
#if LIBXML_VERSION >= 20600
|
|
void
|
|
handle_xmlerror (void *userData, xmlErrorPtr error)
|
|
{
|
|
g_print ("Error writing the completion registry: %s, %s\n", GST_COMPREG_FILE,
|
|
error->message);
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
xmlDocPtr doc;
|
|
xmlNodePtr factorynode, padnode, argnode, optionnode;
|
|
GList *plugins, *features, *padtemplates;
|
|
const GList *pads;
|
|
GstElement *element;
|
|
GstPad *pad;
|
|
GstPadTemplate *padtemplate;
|
|
GParamSpec **property_specs;
|
|
guint num_properties, i;
|
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
gst_init (&argc, &argv);
|
|
GST_DEBUG_CATEGORY_INIT (debug_compprep, "compprep", GST_DEBUG_BOLD,
|
|
"gst-compprep application");
|
|
|
|
doc = xmlNewDoc ((guchar *) "1.0");
|
|
doc->xmlRootNode =
|
|
xmlNewDocNode (doc, NULL, (guchar *) "GST-CompletionRegistry", NULL);
|
|
|
|
plugins = g_list_copy (gst_registry_pool_plugin_list ());
|
|
while (plugins) {
|
|
GstPlugin *plugin;
|
|
|
|
plugin = (GstPlugin *) (plugins->data);
|
|
plugins = g_list_next (plugins);
|
|
|
|
features = g_list_copy (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_ELEMENT_FACTORY (feature))
|
|
continue;
|
|
|
|
factory = GST_ELEMENT_FACTORY (feature);
|
|
|
|
factorynode =
|
|
xmlNewChild (doc->xmlRootNode, NULL, (guchar *) "element", NULL);
|
|
xmlNewChild (factorynode, NULL, (guchar *) "name",
|
|
(guchar *) GST_PLUGIN_FEATURE_NAME (factory));
|
|
|
|
element = gst_element_factory_create (factory, NULL);
|
|
GST_DEBUG ("adding factory %s", GST_PLUGIN_FEATURE_NAME (factory));
|
|
if (element == NULL) {
|
|
GST_ERROR ("couldn't construct element from factory %s\n",
|
|
gst_object_get_name (GST_OBJECT (factory)));
|
|
return 1;
|
|
}
|
|
|
|
/* write out the padtemplates */
|
|
padtemplates = factory->padtemplates;
|
|
while (padtemplates) {
|
|
padtemplate = (GstPadTemplate *) (padtemplates->data);
|
|
padtemplates = g_list_next (padtemplates);
|
|
|
|
if (padtemplate->direction == GST_PAD_SRC)
|
|
padnode =
|
|
xmlNewChild (factorynode, NULL, (guchar *) "srcpadtemplate",
|
|
(guchar *) padtemplate->name_template);
|
|
else if (padtemplate->direction == GST_PAD_SINK)
|
|
padnode =
|
|
xmlNewChild (factorynode, NULL, (guchar *) "sinkpadtemplate",
|
|
(guchar *) 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, (guchar *) "srcpad",
|
|
(guchar *) GST_PAD_NAME (pad));
|
|
else if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
|
|
padnode =
|
|
xmlNewChild (factorynode, NULL, (guchar *) "sinkpad",
|
|
(guchar *) GST_PAD_NAME (pad));
|
|
}
|
|
|
|
/* write out the args */
|
|
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, (guchar *) "argument",
|
|
(guchar *) param->name);
|
|
if (param->value_type == GST_TYPE_URI) {
|
|
xmlNewChild (argnode, NULL, (guchar *) "filename", NULL);
|
|
} else if (G_IS_PARAM_SPEC_ENUM (param) == G_TYPE_ENUM) {
|
|
GEnumValue *values;
|
|
gint j;
|
|
|
|
values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
|
|
for (j = 0; values[j].value_name; j++) {
|
|
gchar *value = g_strdup_printf ("%d", values[j].value);
|
|
|
|
optionnode =
|
|
xmlNewChild (argnode, NULL, (guchar *) "option",
|
|
(guchar *) value);
|
|
xmlNewChild (optionnode, NULL, (guchar *) "value_nick",
|
|
(guchar *) values[j].value_nick);
|
|
g_free (value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
#if LIBXML_VERSION >= 20600
|
|
xmlSetStructuredErrorFunc (NULL, handle_xmlerror);
|
|
#endif
|
|
xmlSaveFormatFile (GST_COMPREG_FILE, doc, 1);
|
|
#else
|
|
xmlSaveFile (GST_COMPREG_FILE, doc);
|
|
#endif
|
|
|
|
return 0;
|
|
}
|