2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2004 Thomas Vander Stichele <thomas@apestaart.org>
6 * gst-inspect.c: tool to inspect the GStreamer registry
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
28 #include <gst/controller/gstcontroller.h>
35 #include <glib/gprintf.h>
39 static int print_element_info (GstElementFactory * factory,
40 gboolean print_names);
43 n_print (const char *format, ...)
51 va_start (args, format);
52 retval = g_vprintf (format, args);
57 print_field (GQuark field, const GValue * value, gpointer pfx)
59 gchar *str = gst_value_serialize (value);
61 n_print ("%s %15s: %s\n", (gchar *) pfx, g_quark_to_string (field), str);
67 print_caps (const GstCaps * caps, const gchar * pfx)
71 g_return_if_fail (caps != NULL);
73 if (gst_caps_is_any (caps)) {
74 n_print ("%sANY\n", pfx);
77 if (gst_caps_is_empty (caps)) {
78 n_print ("%sEMPTY\n", pfx);
82 for (i = 0; i < gst_caps_get_size (caps); i++) {
83 GstStructure *structure = gst_caps_get_structure (caps, i);
85 n_print ("%s%s\n", pfx, gst_structure_get_name (structure));
86 gst_structure_foreach (structure, print_field, (gpointer) pfx);
92 print_formats (const GstFormat * formats)
94 while (formats && *formats) {
95 const GstFormatDefinition *definition;
97 definition = gst_format_get_details (*formats);
99 n_print ("\t\t(%d):\t%s (%s)\n", *formats,
100 definition->nick, definition->description);
102 n_print ("\t\t(%d):\tUnknown format\n", *formats);
110 print_query_types (const GstQueryType * types)
112 while (types && *types) {
113 const GstQueryTypeDefinition *definition;
115 definition = gst_query_type_get_details (*types);
117 n_print ("\t\t(%d):\t%s (%s)\n", *types,
118 definition->nick, definition->description);
120 n_print ("\t\t(%d):\tUnknown query format\n", *types);
126 #ifndef GST_DISABLE_ENUMTYPES
129 print_event_masks (const GstEventMask * masks)
134 GFlagsClass *flags_class = NULL;
136 event_type = gst_event_type_get_type ();
137 klass = (GEnumClass *) g_type_class_ref (event_type);
139 while (masks && masks->type) {
141 gint flags = 0, index = 0;
143 switch (masks->type) {
145 flags = masks->flags;
146 event_flags = gst_seek_type_get_type ();
147 flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
153 value = g_enum_get_value (klass, masks->type);
154 g_print ("\t\t%s ", value->value_nick);
160 value = g_flags_get_first_value (flags_class, 1 << index);
163 g_print ("| %s ", value->value_nick);
178 print_event_masks (const GstEventMask * masks)
184 get_rank_name (gint rank)
189 case GST_RANK_MARGINAL:
191 case GST_RANK_SECONDARY:
193 case GST_RANK_PRIMARY:
201 print_factory_details_info (GstElementFactory * factory)
203 n_print ("Factory Details:\n");
204 n_print (" Long name:\t%s\n", factory->details.longname);
205 n_print (" Class:\t%s\n", factory->details.klass);
206 n_print (" Description:\t%s\n", factory->details.description);
207 n_print (" Author(s):\t%s\n", factory->details.author);
208 n_print (" Rank:\t\t%s (%d)\n",
209 get_rank_name (GST_PLUGIN_FEATURE (factory)->rank),
210 GST_PLUGIN_FEATURE (factory)->rank);
215 print_hierarchy (GType type, gint level, gint * maxlevel)
220 parent = g_type_parent (type);
222 *maxlevel = *maxlevel + 1;
226 print_hierarchy (parent, level, maxlevel);
231 for (i = 1; i < *maxlevel - level; i++)
233 if (*maxlevel - level)
236 g_print ("%s\n", g_type_name (type));
243 print_interfaces (GType type)
246 GType *iface, *ifaces = g_type_interfaces (type, &n_ifaces);
250 g_print ("%s", _name);
251 g_print (_("Implemented Interfaces:\n"));
254 g_print ("%s %s\n", _name, g_type_name (*iface));
257 g_print ("%s\n", _name);
264 print_element_properties_info (GstElement * element)
266 GParamSpec **property_specs;
267 guint num_properties, i;
271 property_specs = g_object_class_list_properties
272 (G_OBJECT_GET_CLASS (element), &num_properties);
274 n_print ("Element Properties:\n");
276 for (i = 0; i < num_properties; i++) {
277 GValue value = { 0, };
278 GParamSpec *param = property_specs[i];
282 g_value_init (&value, param->value_type);
284 n_print (" %-20s: %s\n", g_param_spec_get_name (param),
285 g_param_spec_get_blurb (param));
288 n_print ("%-23.23s flags: ", "");
289 if (param->flags & G_PARAM_READABLE) {
290 g_object_get_property (G_OBJECT (element), param->name, &value);
292 g_print ((first_flag ? "" : ", "));
293 g_print (_("readable"));
296 if (param->flags & G_PARAM_WRITABLE) {
297 g_print ((first_flag ? "" : ", "));
298 g_print (_("writable"));
301 if (param->flags & GST_PARAM_CONTROLLABLE) {
302 g_print ((first_flag ? "" : ", "));
303 g_print (_("controllable"));
308 switch (G_VALUE_TYPE (&value)) {
311 GParamSpecString *pstring = G_PARAM_SPEC_STRING (param);
313 n_print ("%-23.23s String. ", "");
315 if (pstring->default_value == NULL)
316 g_print ("Default: null ");
318 g_print ("Default: \"%s\" ", pstring->default_value);
321 const char *string_val = g_value_get_string (&value);
323 if (string_val == NULL)
324 g_print ("Current: null");
326 g_print ("Current: \"%s\"", string_val);
332 GParamSpecBoolean *pboolean = G_PARAM_SPEC_BOOLEAN (param);
334 n_print ("%-23.23s Boolean. ", "");
335 g_print ("Default: %s ", (pboolean->default_value ? "true" : "false"));
337 g_print ("Current: %s",
338 (g_value_get_boolean (&value) ? "true" : "false"));
343 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
345 n_print ("%-23.23s Unsigned Long. ", "");
346 g_print ("Range: %lu - %lu Default: %lu ",
347 pulong->minimum, pulong->maximum, pulong->default_value);
349 g_print ("Current: %lu", g_value_get_ulong (&value));
354 GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
356 n_print ("%-23.23s Long. ", "");
357 g_print ("Range: %ld - %ld Default: %ld ",
358 plong->minimum, plong->maximum, plong->default_value);
360 g_print ("Current: %ld", g_value_get_long (&value));
365 GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
367 n_print ("%-23.23s Unsigned Integer. ", "");
368 g_print ("Range: %u - %u Default: %u ",
369 puint->minimum, puint->maximum, puint->default_value);
371 g_print ("Current: %u", g_value_get_uint (&value));
376 GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
378 n_print ("%-23.23s Integer. ", "");
379 g_print ("Range: %d - %d Default: %d ",
380 pint->minimum, pint->maximum, pint->default_value);
382 g_print ("Current: %d", g_value_get_int (&value));
387 GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
389 n_print ("%-23.23s Unsigned Integer64. ", "");
390 g_print ("Range: %" G_GUINT64_FORMAT " - %" G_GUINT64_FORMAT
391 " Default: %" G_GUINT64_FORMAT " ",
392 puint64->minimum, puint64->maximum, puint64->default_value);
394 g_print ("Current: %" G_GUINT64_FORMAT, g_value_get_uint64 (&value));
399 GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
401 n_print ("%-23.23s Integer64. ", "");
402 g_print ("Range: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT
403 " Default: %" G_GINT64_FORMAT " ",
404 pint64->minimum, pint64->maximum, pint64->default_value);
406 g_print ("Current: %" G_GINT64_FORMAT, g_value_get_int64 (&value));
411 GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
413 n_print ("%-23.23s Float. ", "");
414 g_print ("Range: %15.7g - %15.7g Default: %15.7g ",
415 pfloat->minimum, pfloat->maximum, pfloat->default_value);
417 g_print ("Current: %15.7g", g_value_get_float (&value));
422 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
424 n_print ("%-23.23s Double. ", "");
425 g_print ("Range: %15.7g - %15.7g Default: %15.7g ",
426 pdouble->minimum, pdouble->maximum, pdouble->default_value);
428 g_print ("Current: %15.7g", g_value_get_double (&value));
432 if (param->value_type == GST_TYPE_CAPS) {
433 const GstCaps *caps = gst_value_get_caps (&value);
436 n_print ("%-23.23s Caps (NULL)", "");
438 print_caps (caps, " ");
440 } else if (G_IS_PARAM_SPEC_ENUM (param)) {
445 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
446 enum_value = g_value_get_enum (&value);
448 while (values[j].value_name) {
449 if (values[j].value == enum_value)
454 n_print ("%-23.23s Enum \"%s\" Current: %d, \"%s\"", "",
455 g_type_name (G_VALUE_TYPE (&value)),
456 enum_value, values[j].value_nick);
459 while (values[j].value_name) {
460 g_print ("\n%s%-23.23s %d) %-16s - %s", "",
461 _name, values[j].value, values[j].value_nick,
462 values[j].value_name);
465 /* g_type_class_unref (ec); */
466 } else if (G_IS_PARAM_SPEC_FLAGS (param)) {
470 GString *flags = NULL;
472 values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
473 flags_value = g_value_get_flags (&value);
475 while (values[j].value_name) {
476 if (values[j].value & flags_value) {
478 g_string_append_printf (flags, " | %s", values[j].value_nick);
480 flags = g_string_new (values[j].value_nick);
486 n_print ("%-23.23s Flags \"%s\" Current: %d, \"%s\"", "",
487 g_type_name (G_VALUE_TYPE (&value)),
488 flags_value, (flags ? flags->str : "(none)"));
491 while (values[j].value_name) {
492 g_print ("\n%s%-23.23s (%d): \t%s", "",
493 _name, values[j].value, values[j].value_nick);
498 g_string_free (flags, TRUE);
499 } else if (G_IS_PARAM_SPEC_OBJECT (param)) {
500 n_print ("%-23.23s Object of type \"%s\"", "",
501 g_type_name (param->value_type));
502 } else if (G_IS_PARAM_SPEC_BOXED (param)) {
503 n_print ("%-23.23s Boxed pointer of type \"%s\"", "",
504 g_type_name (param->value_type));
505 } else if (G_IS_PARAM_SPEC_POINTER (param)) {
506 if (param->value_type != G_TYPE_POINTER) {
507 n_print ("%-23.23s Pointer of type \"%s\".", "",
508 g_type_name (param->value_type));
510 n_print ("%-23.23s Pointer.", "");
513 n_print ("%-23.23s Unknown type %ld \"%s\"", "", param->value_type,
514 g_type_name (param->value_type));
519 g_print (" Write only\n");
523 if (num_properties == 0)
526 g_free (property_specs);
530 print_pad_templates_info (GstElement * element, GstElementFactory * factory)
532 GstElementClass *gstelement_class;
534 GstStaticPadTemplate *padtemplate;
536 n_print ("Pad Templates:\n");
537 if (!factory->numpadtemplates) {
542 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
544 pads = factory->staticpadtemplates;
546 padtemplate = (GstStaticPadTemplate *) (pads->data);
547 pads = g_list_next (pads);
549 if (padtemplate->direction == GST_PAD_SRC)
550 n_print (" SRC template: '%s'\n", padtemplate->name_template);
551 else if (padtemplate->direction == GST_PAD_SINK)
552 n_print (" SINK template: '%s'\n", padtemplate->name_template);
554 n_print (" UNKNOWN!!! template: '%s'\n", padtemplate->name_template);
556 if (padtemplate->presence == GST_PAD_ALWAYS)
557 n_print (" Availability: Always\n");
558 else if (padtemplate->presence == GST_PAD_SOMETIMES)
559 n_print (" Availability: Sometimes\n");
560 else if (padtemplate->presence == GST_PAD_REQUEST) {
561 n_print (" Availability: On request\n");
562 n_print (" Has request_new_pad() function: %s\n",
563 GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
565 n_print (" Availability: UNKNOWN!!!\n");
567 if (padtemplate->static_caps.string) {
568 n_print (" Capabilities:\n");
569 print_caps (gst_static_caps_get (&padtemplate->static_caps), " ");
577 print_element_flag_info (GstElement * element)
579 gboolean have_flags = FALSE;
582 n_print ("Element Flags:\n");
585 n_print (" no flags set\n");
587 if (GST_IS_BIN (element)) {
589 n_print ("Bin Flags:\n");
591 n_print (" no flags set\n");
596 print_implementation_info (GstElement * element)
598 GstObjectClass *gstobject_class;
599 GstElementClass *gstelement_class;
601 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
602 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
605 n_print ("Element Implementation:\n");
607 n_print (" No loopfunc(), must be chain-based or not configured yet\n");
609 n_print (" Has change_state() function: %s\n",
610 GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
611 #ifndef GST_DISABLE_LOADSAVE
612 n_print (" Has custom save_thyself() function: %s\n",
613 GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
614 n_print (" Has custom restore_thyself() function: %s\n",
615 GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
620 print_clocking_info (GstElement * element)
622 if (!gst_element_requires_clock (element) &&
623 !(gst_element_provides_clock (element) &&
624 gst_element_get_clock (element))) {
626 n_print ("Element has no clocking capabilities.");
631 n_print ("Clocking Interaction:\n");
632 if (gst_element_requires_clock (element)) {
633 n_print (" element requires a clock\n");
636 if (gst_element_provides_clock (element)) {
639 clock = gst_element_get_clock (element);
641 n_print (" element provides a clock: %s\n", GST_OBJECT_NAME (clock));
643 n_print (" element is supposed to provide a clock but returned NULL\n");
647 #ifndef GST_DISABLE_INDEX
649 print_index_info (GstElement * element)
651 if (gst_element_is_indexable (element)) {
653 n_print ("Indexing capabilities:\n");
654 n_print (" element can do indexing\n");
657 n_print ("Element has no indexing capabilities.\n");
662 print_index_info (GstElement * element)
668 print_pad_info (GstElement * element)
676 if (!element->numpads) {
681 pads = element->pads;
683 pad = GST_PAD (pads->data);
684 pads = g_list_next (pads);
688 if (gst_pad_get_direction (pad) == GST_PAD_SRC)
689 g_print (" SRC: '%s'", gst_pad_get_name (pad));
690 else if (gst_pad_get_direction (pad) == GST_PAD_SINK)
691 g_print (" SINK: '%s'", gst_pad_get_name (pad));
693 g_print (" UNKNOWN!!!: '%s'", gst_pad_get_name (pad));
697 n_print (" Implementation:\n");
699 n_print (" Has chainfunc(): %s\n",
700 GST_DEBUG_FUNCPTR_NAME (pad->chainfunc));
701 if (pad->getrangefunc)
702 n_print (" Has getrangefunc(): %s\n",
703 GST_DEBUG_FUNCPTR_NAME (pad->getrangefunc));
704 if (pad->eventfunc != gst_pad_event_default)
705 n_print (" Has custom eventfunc(): %s\n",
706 GST_DEBUG_FUNCPTR_NAME (pad->eventfunc));
707 if (pad->queryfunc != gst_pad_query_default)
708 n_print (" Has custom queryfunc(): %s\n",
709 GST_DEBUG_FUNCPTR_NAME (pad->queryfunc));
710 if (pad->querytypefunc != gst_pad_get_query_types_default) {
711 n_print (" Provides query types:\n");
712 print_query_types (gst_pad_get_query_types (pad));
715 if (pad->intlinkfunc != gst_pad_get_internal_links_default)
716 n_print (" Has custom intconnfunc(): %s\n",
717 GST_DEBUG_FUNCPTR_NAME (pad->intlinkfunc));
719 if (pad->bufferallocfunc)
720 n_print (" Has bufferallocfunc(): %s\n",
721 GST_DEBUG_FUNCPTR_NAME (pad->bufferallocfunc));
723 if (pad->padtemplate)
724 n_print (" Pad Template: '%s'\n", pad->padtemplate->name_template);
727 n_print (" Capabilities:\n");
728 print_caps (pad->caps, " ");
735 compare_signal_names (GSignalQuery * a, GSignalQuery * b)
737 return strcmp (a->signal_name, b->signal_name);
742 print_signal_info (GstElement * element)
744 /* Signals/Actions Block */
748 GSignalQuery *query = NULL;
750 GSList *found_signals, *l;
752 for (k = 0; k < 2; k++) {
753 found_signals = NULL;
754 for (type = G_OBJECT_TYPE (element); type; type = g_type_parent (type)) {
755 if (type == GST_TYPE_ELEMENT || type == GST_TYPE_OBJECT)
758 if (type == GST_TYPE_BIN && G_OBJECT_TYPE (element) != GST_TYPE_BIN)
761 signals = g_signal_list_ids (type, &nsignals);
762 for (i = 0; i < nsignals; i++) {
763 query = g_new0 (GSignalQuery, 1);
764 g_signal_query (signals[i], query);
766 if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
767 (k == 1 && (query->signal_flags & G_SIGNAL_ACTION)))
768 found_signals = g_slist_append (found_signals, query);
775 n_print ("Element Signals:\n");
777 n_print ("Element Actions:\n");
782 for (l = found_signals; l; l = l->next) {
786 query = (GSignalQuery *) l->data;
787 indent_len = strlen (query->signal_name) +
788 strlen (g_type_name (query->return_type)) + 24;
790 indent = g_new0 (gchar, indent_len + 1);
791 memset (indent, ' ', indent_len);
793 n_print (" \"%s\" : %s user_function (%s* object",
795 g_type_name (query->return_type), g_type_name (type));
797 for (j = 0; j < query->n_params; j++) {
798 if (G_TYPE_IS_FUNDAMENTAL (query->param_types[j])) {
799 g_print (",\n%s%s%s arg%d", _name, indent,
800 g_type_name (query->param_types[j]), j);
801 } else if (G_TYPE_IS_ENUM (query->param_types[j])) {
802 g_print (",\n%s%s%s arg%d", _name, indent,
803 g_type_name (query->param_types[j]), j);
805 g_print (",\n%s%s%s* arg%d", _name, indent,
806 g_type_name (query->param_types[j]), j);
811 g_print (",\n%s%sgpointer user_data);\n", _name, indent);
819 g_slist_foreach (found_signals, (GFunc) g_free, NULL);
820 g_slist_free (found_signals);
826 print_children_info (GstElement * element)
830 if (!GST_IS_BIN (element))
833 children = (GList *) GST_BIN (element)->children;
836 g_print ("Children:\n");
840 n_print (" %s\n", GST_ELEMENT_NAME (GST_ELEMENT (children->data)));
841 children = g_list_next (children);
846 print_element_list (gboolean print_all)
848 int plugincount = 0, featurecount = 0;
849 GList *plugins, *orig_plugins;
851 orig_plugins = plugins = gst_default_registry_get_plugin_list ();
853 GList *features, *orig_features;
856 plugin = (GstPlugin *) (plugins->data);
857 plugins = g_list_next (plugins);
860 orig_features = features =
861 gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
864 GstPluginFeature *feature;
866 feature = GST_PLUGIN_FEATURE (features->data);
869 if (GST_IS_ELEMENT_FACTORY (feature)) {
870 GstElementFactory *factory;
872 factory = GST_ELEMENT_FACTORY (feature);
874 print_element_info (factory, TRUE);
876 g_print ("%s: %s: %s\n", plugin->desc.name,
877 GST_PLUGIN_FEATURE_NAME (factory), factory->details.longname);
879 #ifndef GST_DISABLE_INDEX
880 else if (GST_IS_INDEX_FACTORY (feature)) {
881 GstIndexFactory *factory;
883 factory = GST_INDEX_FACTORY (feature);
885 g_print ("%s: %s: %s\n", plugin->desc.name,
886 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
889 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
890 GstTypeFindFactory *factory;
892 factory = GST_TYPE_FIND_FACTORY (feature);
894 g_print ("%s: %s: ", plugin->desc.name,
895 gst_plugin_feature_get_name (feature));
896 if (factory->extensions) {
899 while (factory->extensions[i]) {
901 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
908 g_print ("no extensions\n");
912 n_print ("%s: %s (%s)\n", plugin->desc.name,
913 GST_PLUGIN_FEATURE_NAME (feature),
914 g_type_name (G_OBJECT_TYPE (feature)));
917 features = g_list_next (features);
920 gst_plugin_feature_list_free (orig_features);
923 gst_plugin_list_free (orig_plugins);
926 g_print (_("Total count: "));
927 g_print (ngettext ("%d plugin", "%d plugins", plugincount), plugincount);
929 g_print (ngettext ("%d feature", "%d features", featurecount), featurecount);
934 print_plugin_info (GstPlugin * plugin)
936 n_print ("Plugin Details:\n");
937 n_print (" Name:\t\t\t%s\n", plugin->desc.name);
938 n_print (" Description:\t\t%s\n", plugin->desc.description);
939 n_print (" Filename:\t\t%s\n",
940 plugin->filename ? plugin->filename : "(null)");
941 n_print (" Version:\t\t%s\n", plugin->desc.version);
942 n_print (" License:\t\t%s\n", plugin->desc.license);
943 n_print (" Source module:\t%s\n", plugin->desc.source);
944 n_print (" Binary package:\t%s\n", plugin->desc.package);
945 n_print (" Origin URL:\t\t%s\n", plugin->desc.origin);
950 print_plugin_features (GstPlugin * plugin)
953 gint num_features = 0;
954 gint num_elements = 0;
956 gint num_indexes = 0;
960 gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
964 GstPluginFeature *feature;
966 feature = GST_PLUGIN_FEATURE (features->data);
968 if (GST_IS_ELEMENT_FACTORY (feature)) {
969 GstElementFactory *factory;
971 factory = GST_ELEMENT_FACTORY (feature);
972 n_print (" %s: %s\n", GST_PLUGIN_FEATURE_NAME (factory),
973 factory->details.longname);
976 #ifndef GST_DISABLE_INDEX
977 else if (GST_IS_INDEX_FACTORY (feature)) {
978 GstIndexFactory *factory;
980 factory = GST_INDEX_FACTORY (feature);
981 n_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
985 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
986 GstTypeFindFactory *factory;
988 factory = GST_TYPE_FIND_FACTORY (feature);
989 if (factory->extensions) {
992 g_print ("%s type: ", plugin->desc.name);
993 while (factory->extensions[i]) {
994 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
999 g_print ("%s type: N/A\n", plugin->desc.name);
1003 n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
1004 g_type_name (G_OBJECT_TYPE (feature)));
1008 features = g_list_next (features);
1011 n_print (" %d features:\n", num_features);
1012 if (num_elements > 0)
1013 n_print (" +-- %d elements\n", num_elements);
1015 n_print (" +-- %d types\n", num_types);
1016 if (num_indexes > 0)
1017 n_print (" +-- %d indexes\n", num_indexes);
1019 n_print (" +-- %d other objects\n", num_other);
1025 print_element_features (const gchar * element_name)
1027 GstPluginFeature *feature;
1029 /* FIXME implement other pretty print function for these */
1030 #ifndef GST_DISABLE_INDEX
1031 feature = gst_default_registry_find_feature (element_name,
1032 GST_TYPE_INDEX_FACTORY);
1034 n_print ("%s: an index\n", element_name);
1038 feature = gst_default_registry_find_feature (element_name,
1039 GST_TYPE_TYPE_FIND_FACTORY);
1041 n_print ("%s: a typefind function\n", element_name);
1049 print_element_info (GstElementFactory * factory, gboolean print_names)
1051 GstElement *element;
1055 GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
1059 g_print ("element plugin couldn't be loaded\n");
1063 element = gst_element_factory_create (factory, NULL);
1065 g_print ("couldn't construct element for some reason\n");
1070 _name = g_strdup_printf ("%s: ", GST_PLUGIN_FEATURE (factory)->name);
1074 print_factory_details_info (factory);
1075 if (GST_PLUGIN_FEATURE (factory)->plugin_name) {
1078 plugin = gst_registry_find_plugin (gst_registry_get_default (),
1079 GST_PLUGIN_FEATURE (factory)->plugin_name);
1081 print_plugin_info (plugin);
1085 print_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
1086 print_interfaces (G_OBJECT_TYPE (element));
1088 print_pad_templates_info (element, factory);
1089 print_element_flag_info (element);
1090 print_implementation_info (element);
1091 print_clocking_info (element);
1092 print_index_info (element);
1093 print_pad_info (element);
1094 print_element_properties_info (element);
1095 print_signal_info (element);
1096 print_children_info (element);
1098 if (_name[0] != '\0')
1105 main (int argc, char *argv[])
1107 gboolean print_all = FALSE;
1108 GOptionEntry options[] = {
1109 {"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
1110 N_("Print all elements"), NULL},
1111 GST_TOOLS_GOPTION_VERSION,
1114 GOptionContext *ctx;
1118 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
1119 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1120 textdomain (GETTEXT_PACKAGE);
1123 ctx = g_option_context_new ("[ELEMENT-NAME | PLUGIN-NAME]");
1124 g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
1125 g_option_context_add_group (ctx, gst_init_get_option_group ());
1126 if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
1127 g_print ("Error initializing: %s\n", err->message);
1130 g_option_context_free (ctx);
1132 gst_tools_print_version ("gst-inspect");
1134 if (print_all && argc > 2) {
1135 g_print ("-a requires no extra arguments\n");
1139 /* if no arguments, print out list of elements */
1140 if (argc == 1 || print_all) {
1141 print_element_list (print_all);
1142 /* else we try to get a factory */
1144 GstElementFactory *factory;
1146 const char *arg = argv[argc - 1];
1149 factory = gst_element_factory_find (arg);
1150 /* if there's a factory, print out the info */
1152 retval = print_element_info (factory, print_all);
1153 gst_object_unref (factory);
1155 retval = print_element_features (arg);
1158 /* otherwise check if it's a plugin */
1160 plugin = gst_default_registry_find_plugin (arg);
1162 /* if there is such a plugin, print out info */
1164 print_plugin_info (plugin);
1165 print_plugin_features (plugin);
1167 GError *error = NULL;
1169 if (g_file_test (arg, G_FILE_TEST_EXISTS)) {
1170 plugin = gst_plugin_load_file (arg, &error);
1173 print_plugin_info (plugin);
1174 print_plugin_features (plugin);
1176 g_print (_("Could not load plugin file: %s\n"), error->message);
1177 g_error_free (error);
1181 g_print (_("No such element or plugin '%s'\n"), arg);