mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +00:00
767d9e4681
Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
144 lines
4.2 KiB
C
144 lines
4.2 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 ("1.0");
|
|
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "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, "element", NULL);
|
|
xmlNewChild (factorynode, NULL, "name",
|
|
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, "srcpadtemplate",
|
|
padtemplate->name_template);
|
|
else if (padtemplate->direction == GST_PAD_SINK)
|
|
padnode =
|
|
xmlNewChild (factorynode, NULL, "sinkpadtemplate",
|
|
padtemplate->name_template);
|
|
}
|
|
|
|
pads = element->pads;
|
|
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));
|
|
}
|
|
|
|
/* 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, "argument", param->name);
|
|
if (param->value_type == GST_TYPE_URI) {
|
|
xmlNewChild (argnode, NULL, "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, "option", value);
|
|
xmlNewChild (optionnode, NULL, "value_nick", 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;
|
|
}
|