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.
29 #include <gst/control/control.h>
31 #include "gst/gst-i18n-app.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);
91 print_formats (const GstFormat * formats)
93 while (formats && *formats) {
94 const GstFormatDefinition *definition;
96 definition = gst_format_get_details (*formats);
98 n_print ("\t\t(%d):\t%s (%s)\n", *formats,
99 definition->nick, definition->description);
101 n_print ("\t\t(%d):\tUnknown format\n", *formats);
108 print_query_types (const GstQueryType * types)
110 while (types && *types) {
111 const GstQueryTypeDefinition *definition;
113 definition = gst_query_type_get_details (*types);
115 n_print ("\t\t(%d):\t%s (%s)\n", *types,
116 definition->nick, definition->description);
118 n_print ("\t\t(%d):\tUnknown query format\n", *types);
124 #ifndef GST_DISABLE_ENUMTYPES
126 print_event_masks (const GstEventMask * masks)
131 GFlagsClass *flags_class = NULL;
133 event_type = gst_event_type_get_type ();
134 klass = (GEnumClass *) g_type_class_ref (event_type);
136 while (masks && masks->type) {
138 gint flags = 0, index = 0;
140 switch (masks->type) {
142 flags = masks->flags;
143 event_flags = gst_seek_type_get_type ();
144 flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
150 value = g_enum_get_value (klass, masks->type);
151 g_print ("\t\t%s ", value->value_nick);
157 value = g_flags_get_first_value (flags_class, 1 << index);
160 g_print ("| %s ", value->value_nick);
174 print_event_masks (const GstEventMask * masks)
180 get_rank_name (gint rank)
185 case GST_RANK_MARGINAL:
187 case GST_RANK_SECONDARY:
189 case GST_RANK_PRIMARY:
197 print_factory_details_info (GstElementFactory * factory)
199 n_print ("Factory Details:\n");
200 n_print (" Long name:\t%s\n", factory->details.longname);
201 n_print (" Class:\t%s\n", factory->details.klass);
202 n_print (" Description:\t%s\n", factory->details.description);
203 n_print (" Author(s):\t%s\n", factory->details.author);
204 n_print (" Rank:\t\t%s (%d)\n",
205 get_rank_name (GST_PLUGIN_FEATURE (factory)->rank),
206 GST_PLUGIN_FEATURE (factory)->rank);
211 print_hierarchy (GType type, gint level, gint * maxlevel)
216 parent = g_type_parent (type);
218 *maxlevel = *maxlevel + 1;
222 print_hierarchy (parent, level, maxlevel);
227 for (i = 1; i < *maxlevel - level; i++)
229 if (*maxlevel - level)
232 g_print ("%s\n", g_type_name (type));
239 print_element_properties_info (GstElement * element)
241 GParamSpec **property_specs;
242 gint num_properties, i;
244 const char *string_val;
246 property_specs = g_object_class_list_properties
247 (G_OBJECT_GET_CLASS (element), &num_properties);
249 n_print ("Element Properties:\n");
251 for (i = 0; i < num_properties; i++) {
252 GValue value = { 0, };
253 GParamSpec *param = property_specs[i];
257 g_value_init (&value, param->value_type);
258 if (param->flags & G_PARAM_READABLE) {
259 g_object_get_property (G_OBJECT (element), param->name, &value);
263 n_print (" %-20s: %s\n", g_param_spec_get_name (param),
264 g_param_spec_get_blurb (param));
266 switch (G_VALUE_TYPE (&value)) {
268 string_val = g_value_get_string (&value);
269 n_print ("%-23.23s String. ", "");
271 if (string_val == NULL)
272 g_print ("(Default \"\")");
274 g_print ("(Default \"%s\")", g_value_get_string (&value));
278 n_print ("%-23.23s Boolean. ", "");
280 g_print ("(Default %s)",
281 (g_value_get_boolean (&value) ? "true" : "false"));
285 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
287 n_print ("%-23.23s Unsigned Long. ", "");
289 g_print ("Range: %lu - %lu (Default %lu)",
290 pulong->minimum, pulong->maximum, g_value_get_ulong (&value));
295 GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
297 n_print ("%-23.23s Long. ", "");
299 g_print ("Range: %ld - %ld (Default %ld)",
300 plong->minimum, plong->maximum, g_value_get_long (&value));
305 GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
307 n_print ("%-23.23s Unsigned Integer. ", "");
309 g_print ("Range: %u - %u (Default %u)",
310 puint->minimum, puint->maximum, g_value_get_uint (&value));
315 GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
317 n_print ("%-23.23s Integer. ", "");
319 g_print ("Range: %d - %d (Default %d)",
320 pint->minimum, pint->maximum, g_value_get_int (&value));
325 GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
327 n_print ("%-23.23s Unsigned Integer64. ", "");
329 g_print ("Range: %" G_GUINT64_FORMAT " - %"
330 G_GUINT64_FORMAT " (Default %" G_GUINT64_FORMAT ")",
331 puint64->minimum, puint64->maximum, g_value_get_uint64 (&value));
336 GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
338 n_print ("%-23.23s Integer64. ", "");
340 g_print ("Range: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT
341 " (Default %" G_GINT64_FORMAT ")", pint64->minimum,
342 pint64->maximum, g_value_get_int64 (&value));
347 GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
349 n_print ("%-23.23s Float. Default: %-8.8s %15.7g\n", "", "",
350 g_value_get_float (&value));
351 n_print ("%-23.23s Range: %15.7g - %15.7g", "",
352 pfloat->minimum, pfloat->maximum);
357 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
359 n_print ("%-23.23s Double. Default: %-8.8s %15.7g\n", "", "",
360 g_value_get_double (&value));
361 n_print ("%-23.23s Range: %15.7g - %15.7g", "",
362 pdouble->minimum, pdouble->maximum);
366 if (param->value_type == GST_TYPE_URI) {
367 n_print ("%-23.23s URI", "");
369 if (param->value_type == GST_TYPE_CAPS) {
370 const GstCaps *caps = gst_value_get_caps (&value);
373 n_print ("%-23.23s Caps (NULL)", "");
375 print_caps (caps, " ");
377 } else if (G_IS_PARAM_SPEC_ENUM (param)) {
382 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
383 enum_value = g_value_get_enum (&value);
385 while (values[j].value_name) {
386 if (values[j].value == enum_value)
391 n_print ("%-23.23s Enum \"%s\" (default %d, \"%s\")", "",
392 g_type_name (G_VALUE_TYPE (&value)),
393 enum_value, values[j].value_nick);
396 while (values[j].value_name) {
397 g_print ("\n%s%-23.23s (%d): \t%s", "",
398 _name, values[j].value, values[j].value_nick);
401 /* g_type_class_unref (ec); */
402 } else if (G_IS_PARAM_SPEC_FLAGS (param)) {
406 GString *flags = NULL;
408 values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
409 flags_value = g_value_get_flags (&value);
411 while (values[j].value_name) {
412 if (values[j].value & flags_value) {
414 g_string_append_printf (flags, " | %s", values[j].value_nick);
416 flags = g_string_new (values[j].value_nick);
422 n_print ("%-23.23s Flags \"%s\" (default %d, \"%s\")", "",
423 g_type_name (G_VALUE_TYPE (&value)),
424 flags_value, (flags ? flags->str : "(none)"));
427 while (values[j].value_name) {
428 g_print ("\n%s%-23.23s (%d): \t%s", "",
429 _name, values[j].value, values[j].value_nick);
434 g_string_free (flags, TRUE);
435 } else if (G_IS_PARAM_SPEC_OBJECT (param)) {
436 n_print ("%-23.23s Object of type \"%s\"", "",
437 g_type_name (param->value_type));
439 n_print ("%-23.23s Unknown type %ld \"%s\"", "", param->value_type,
440 g_type_name (param->value_type));
445 g_print (" Write only\n");
449 if (num_properties == 0)
454 print_pad_templates_info (GstElement * element, GstElementFactory * factory)
456 GstElementClass *gstelement_class;
458 GstPadTemplate *padtemplate;
460 n_print ("Pad Templates:\n");
461 if (!factory->numpadtemplates) {
466 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
468 pads = factory->padtemplates;
470 padtemplate = (GstPadTemplate *) (pads->data);
471 pads = g_list_next (pads);
473 if (padtemplate->direction == GST_PAD_SRC)
474 n_print (" SRC template: '%s'\n", padtemplate->name_template);
475 else if (padtemplate->direction == GST_PAD_SINK)
476 n_print (" SINK template: '%s'\n", padtemplate->name_template);
478 n_print (" UNKNOWN!!! template: '%s'\n", padtemplate->name_template);
480 if (padtemplate->presence == GST_PAD_ALWAYS)
481 n_print (" Availability: Always\n");
482 else if (padtemplate->presence == GST_PAD_SOMETIMES)
483 n_print (" Availability: Sometimes\n");
484 else if (padtemplate->presence == GST_PAD_REQUEST) {
485 n_print (" Availability: On request\n");
486 n_print (" Has request_new_pad() function: %s\n",
487 GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
489 n_print (" Availability: UNKNOWN!!!\n");
491 if (padtemplate->caps) {
492 n_print (" Capabilities:\n");
493 print_caps (padtemplate->caps, " ");
501 print_element_flag_info (GstElement * element)
503 gboolean have_flags = FALSE;
506 n_print ("Element Flags:\n");
508 if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
509 n_print (" GST_ELEMENT_DECOUPLED\n");
512 if (GST_FLAG_IS_SET (element, GST_ELEMENT_EVENT_AWARE)) {
513 n_print (" GST_ELEMENT_EVENT_AWARE\n");
517 n_print (" no flags set\n");
519 if (GST_IS_BIN (element)) {
521 n_print ("Bin Flags:\n");
522 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
523 n_print (" GST_BIN_FLAG_MANAGER\n");
526 if (GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE)) {
527 n_print (" GST_BIN_SELF_SCHEDULABLE\n");
531 n_print (" no flags set\n");
536 print_implementation_info (GstElement * element)
538 GstObjectClass *gstobject_class;
539 GstElementClass *gstelement_class;
541 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
542 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
545 n_print ("Element Implementation:\n");
547 if (element->loopfunc)
548 n_print (" loopfunc()-based element: %s\n",
549 GST_DEBUG_FUNCPTR_NAME (element->loopfunc));
551 n_print (" No loopfunc(), must be chain-based or not configured yet\n");
553 n_print (" Has change_state() function: %s\n",
554 GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
555 #ifndef GST_DISABLE_LOADSAVE
556 n_print (" Has custom save_thyself() function: %s\n",
557 GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
558 n_print (" Has custom restore_thyself() function: %s\n",
559 GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
564 print_clocking_info (GstElement * element)
566 if (!gst_element_requires_clock (element) &&
567 !(gst_element_provides_clock (element) &&
568 gst_element_get_clock (element))) {
570 n_print ("Element has no clocking capabilities.");
575 n_print ("Clocking Interaction:\n");
576 if (gst_element_requires_clock (element)) {
577 n_print (" element requires a clock\n");
580 if (gst_element_provides_clock (element)) {
583 clock = gst_element_get_clock (element);
585 n_print (" element provides a clock: %s\n", GST_OBJECT_NAME (clock));
587 n_print (" element is supposed to provide a clock but returned NULL\n");
591 #ifndef GST_DISABLE_INDEX
593 print_index_info (GstElement * element)
595 if (gst_element_is_indexable (element)) {
597 n_print ("Indexing capabilities:\n");
598 n_print (" element can do indexing\n");
601 n_print ("Element has no indexing capabilities.\n");
606 print_index_info (GstElement * element)
612 print_pad_info (GstElement * element)
621 if (!element->numpads) {
626 pads = element->pads;
628 pad = GST_PAD (pads->data);
629 pads = g_list_next (pads);
630 realpad = GST_PAD_REALIZE (pad);
634 if (gst_pad_get_direction (GST_PAD (realpad)) == GST_PAD_SRC)
635 g_print (" SRC: '%s'", gst_pad_get_name (pad));
636 else if (gst_pad_get_direction (GST_PAD (realpad)) == GST_PAD_SINK)
637 g_print (" SINK: '%s'", gst_pad_get_name (pad));
639 g_print (" UNKNOWN!!!: '%s'", gst_pad_get_name (pad));
641 if (GST_IS_GHOST_PAD (pad))
642 g_print (", ghost of real pad %s:%s\n", GST_DEBUG_PAD_NAME (realpad));
646 n_print (" Implementation:\n");
647 if (realpad->chainfunc)
648 n_print (" Has chainfunc(): %s\n",
649 GST_DEBUG_FUNCPTR_NAME (realpad->chainfunc));
650 if (realpad->getfunc)
651 n_print (" Has getfunc(): %s\n",
652 GST_DEBUG_FUNCPTR_NAME (realpad->getfunc));
653 if (realpad->formatsfunc != gst_pad_get_formats_default) {
654 n_print (" Supports seeking/conversion/query formats:\n");
655 print_formats (gst_pad_get_formats (GST_PAD (realpad)));
657 if (realpad->convertfunc != gst_pad_convert_default)
658 n_print (" Has custom convertfunc(): %s\n",
659 GST_DEBUG_FUNCPTR_NAME (realpad->convertfunc));
660 if (realpad->eventfunc != gst_pad_event_default)
661 n_print (" Has custom eventfunc(): %s\n",
662 GST_DEBUG_FUNCPTR_NAME (realpad->eventfunc));
663 if (realpad->eventmaskfunc != gst_pad_get_event_masks_default) {
664 n_print (" Provides event masks:\n");
665 print_event_masks (gst_pad_get_event_masks (GST_PAD (realpad)));
667 if (realpad->queryfunc != gst_pad_query_default)
668 n_print (" Has custom queryfunc(): %s\n",
669 GST_DEBUG_FUNCPTR_NAME (realpad->queryfunc));
670 if (realpad->querytypefunc != gst_pad_get_query_types_default) {
671 n_print (" Provides query types:\n");
672 print_query_types (gst_pad_get_query_types (GST_PAD (realpad)));
675 if (realpad->intlinkfunc != gst_pad_get_internal_links_default)
676 n_print (" Has custom intconnfunc(): %s\n",
677 GST_DEBUG_FUNCPTR_NAME (realpad->intlinkfunc));
679 if (realpad->bufferallocfunc)
680 n_print (" Has bufferallocfunc(): %s\n",
681 GST_DEBUG_FUNCPTR_NAME (realpad->bufferallocfunc));
683 if (pad->padtemplate)
684 n_print (" Pad Template: '%s'\n", pad->padtemplate->name_template);
687 n_print (" Capabilities:\n");
688 print_caps (realpad->caps, " ");
694 print_dynamic_parameters_info (GstElement * element)
696 GstDParamManager *dpman;
697 GParamSpec **specs = NULL;
700 if ((dpman = gst_dpman_get_manager (element))) {
701 specs = gst_dpman_list_dparam_specs (dpman);
704 if (specs && specs[0] != NULL) {
706 n_print ("Dynamic Parameters:\n");
708 for (x = 0; specs[x] != NULL; x++) {
709 g_print (" %-20.20s: ", g_param_spec_get_name (specs[x]));
711 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
713 g_print ("64 Bit Integer (Default %" G_GINT64_FORMAT ", Range %"
714 G_GINT64_FORMAT " -> %" G_GINT64_FORMAT ")",
715 ((GParamSpecInt64 *) specs[x])->default_value,
716 ((GParamSpecInt64 *) specs[x])->minimum,
717 ((GParamSpecInt64 *) specs[x])->maximum);
720 g_print ("Integer (Default %d, Range %d -> %d)",
721 ((GParamSpecInt *) specs[x])->default_value,
722 ((GParamSpecInt *) specs[x])->minimum,
723 ((GParamSpecInt *) specs[x])->maximum);
726 g_print ("Float. Default: %-8.8s %15.7g\n", "",
727 ((GParamSpecFloat *) specs[x])->default_value);
728 g_print ("%-23.23s Range: %15.7g - %15.7g", "",
729 ((GParamSpecFloat *) specs[x])->minimum,
730 ((GParamSpecFloat *) specs[x])->maximum);
733 g_print ("Double. Default: %-8.8s %15.7g\n", "",
734 ((GParamSpecDouble *) specs[x])->default_value);
735 g_print ("%-23.23s Range: %15.7g - %15.7g", "",
736 ((GParamSpecDouble *) specs[x])->minimum,
737 ((GParamSpecDouble *) specs[x])->maximum);
740 g_print ("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
750 compare_signal_names (GSignalQuery * a, GSignalQuery * b)
752 return strcmp (a->signal_name, b->signal_name);
757 print_signal_info (GstElement * element)
759 /* Signals/Actions Block */
763 GSignalQuery *query = NULL;
765 GSList *found_signals, *l;
767 for (k = 0; k < 2; k++) {
768 found_signals = NULL;
769 for (type = G_OBJECT_TYPE (element); type; type = g_type_parent (type)) {
770 if (type == GST_TYPE_ELEMENT || type == GST_TYPE_OBJECT)
773 if (type == GST_TYPE_BIN && G_OBJECT_TYPE (element) != GST_TYPE_BIN)
776 signals = g_signal_list_ids (type, &nsignals);
777 for (i = 0; i < nsignals; i++) {
778 query = g_new0 (GSignalQuery, 1);
779 g_signal_query (signals[i], query);
781 if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
782 (k == 1 && (query->signal_flags & G_SIGNAL_ACTION)))
783 found_signals = g_slist_append (found_signals, query);
790 n_print ("Element Signals:\n");
792 n_print ("Element Actions:\n");
797 for (l = found_signals; l; l = l->next) {
801 query = (GSignalQuery *) l->data;
802 indent_len = strlen (query->signal_name) +
803 strlen (g_type_name (query->return_type)) + 24;
805 indent = g_new0 (gchar, indent_len + 1);
806 memset (indent, ' ', indent_len);
808 n_print (" \"%s\" : %s user_function (%s* object",
810 g_type_name (query->return_type), g_type_name (type));
812 for (j = 0; j < query->n_params; j++) {
813 if (G_TYPE_IS_FUNDAMENTAL (query->param_types[j])) {
814 g_print (",\n%s%s%s arg%d", _name, indent,
815 g_type_name (query->param_types[j]), j);
817 g_print (",\n%s%s%s* arg%d", _name, indent,
818 g_type_name (query->param_types[j]), j);
823 g_print (",\n%s%sgpointer user_data);\n", _name, indent);
831 g_slist_foreach (found_signals, (GFunc) g_free, NULL);
832 g_slist_free (found_signals);
838 print_children_info (GstElement * element)
842 if (!GST_IS_BIN (element))
845 children = (GList *) GST_BIN (element)->children;
848 g_print ("Children:\n");
852 n_print (" %s\n", GST_ELEMENT_NAME (GST_ELEMENT (children->data)));
853 children = g_list_next (children);
858 print_element_list (gboolean print_all)
862 plugins = gst_registry_pool_plugin_list ();
867 plugin = (GstPlugin *) (plugins->data);
868 plugins = g_list_next (plugins);
870 features = gst_plugin_get_feature_list (plugin);
872 GstPluginFeature *feature;
874 feature = GST_PLUGIN_FEATURE (features->data);
876 if (GST_IS_ELEMENT_FACTORY (feature)) {
877 GstElementFactory *factory;
879 factory = GST_ELEMENT_FACTORY (feature);
881 print_element_info (factory, TRUE);
883 g_print ("%s: %s: %s\n", plugin->desc.name,
884 GST_PLUGIN_FEATURE_NAME (factory), factory->details.longname);
886 #ifndef GST_DISABLE_INDEX
887 else if (GST_IS_INDEX_FACTORY (feature)) {
888 GstIndexFactory *factory;
890 factory = GST_INDEX_FACTORY (feature);
892 g_print ("%s: %s: %s\n", plugin->desc.name,
893 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
896 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
897 GstTypeFindFactory *factory;
899 factory = GST_TYPE_FIND_FACTORY (feature);
901 g_print ("%s: %s: ", plugin->desc.name,
902 gst_plugin_feature_get_name (feature));
903 if (factory->extensions) {
906 while (factory->extensions[i]) {
908 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
915 g_print ("no extensions\n");
917 } else if (GST_IS_SCHEDULER_FACTORY (feature)) {
918 GstSchedulerFactory *factory;
920 factory = GST_SCHEDULER_FACTORY (feature);
922 g_print ("%s: %s: %s\n", plugin->desc.name,
923 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
926 n_print ("%s: %s (%s)\n", plugin->desc.name,
927 GST_PLUGIN_FEATURE_NAME (feature),
928 g_type_name (G_OBJECT_TYPE (feature)));
931 features = g_list_next (features);
937 print_plugin_info (GstPlugin * plugin)
939 n_print ("Plugin Details:\n");
940 n_print (" Name:\t\t%s\n", plugin->desc.name);
941 n_print (" Description:\t%s\n", plugin->desc.description);
942 n_print (" Filename:\t%s\n", plugin->filename ? plugin->filename : "(null)");
943 n_print (" Version:\t%s\n", plugin->desc.version);
944 n_print (" License:\t%s\n", plugin->desc.license);
945 n_print (" Package:\t%s\n", plugin->desc.package);
946 n_print (" Origin URL:\t%s\n", plugin->desc.origin);
951 print_plugin_features (GstPlugin * plugin)
954 gint num_features = 0;
955 gint num_elements = 0;
957 gint num_schedulers = 0;
958 gint num_indexes = 0;
961 features = gst_plugin_get_feature_list (plugin);
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_OBJECT_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);
1002 } else if (GST_IS_SCHEDULER_FACTORY (feature)) {
1003 GstSchedulerFactory *factory;
1005 factory = GST_SCHEDULER_FACTORY (feature);
1006 n_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
1009 n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
1010 g_type_name (G_OBJECT_TYPE (feature)));
1014 features = g_list_next (features);
1017 n_print (" %d features:\n", num_features);
1018 if (num_elements > 0)
1019 n_print (" +-- %d elements\n", num_elements);
1021 n_print (" +-- %d types\n", num_types);
1022 if (num_schedulers > 0)
1023 n_print (" +-- %d schedulers\n", num_schedulers);
1024 if (num_indexes > 0)
1025 n_print (" +-- %d indexes\n", num_indexes);
1027 n_print (" +-- %d other objects\n", num_other);
1033 print_element_features (const gchar * element_name)
1035 GstPluginFeature *feature;
1037 /* FIXME implement other pretty print function for these */
1038 feature = gst_registry_pool_find_feature (element_name,
1039 GST_TYPE_SCHEDULER_FACTORY);
1041 n_print ("%s: a scheduler\n", element_name);
1044 #ifndef GST_DISABLE_INDEX
1045 feature = gst_registry_pool_find_feature (element_name,
1046 GST_TYPE_INDEX_FACTORY);
1048 n_print ("%s: an index\n", element_name);
1052 feature = gst_registry_pool_find_feature (element_name,
1053 GST_TYPE_TYPE_FIND_FACTORY);
1055 n_print ("%s: a typefind function\n", element_name);
1058 #ifndef GST_DISABLE_URI
1059 feature = gst_registry_pool_find_feature (element_name, GST_TYPE_URI_HANDLER);
1061 n_print ("%s: an uri handler\n", element_name);
1070 print_element_info (GstElementFactory * factory, gboolean print_names)
1072 GstElement *element;
1075 element = gst_element_factory_create (factory, NULL);
1077 g_print ("couldn't construct element for some reason\n");
1082 _name = g_strdup_printf ("%s: ", GST_PLUGIN_FEATURE (factory)->name);
1086 print_factory_details_info (factory);
1087 if (GST_PLUGIN_FEATURE (factory)->manager) {
1088 GstPlugin *plugin = (GstPlugin *) GST_PLUGIN_FEATURE (factory)->manager;
1090 print_plugin_info (plugin);
1093 print_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
1095 print_pad_templates_info (element, factory);
1096 print_element_flag_info (element);
1097 print_implementation_info (element);
1098 print_clocking_info (element);
1099 print_index_info (element);
1100 print_pad_info (element);
1101 print_element_properties_info (element);
1102 print_dynamic_parameters_info (element);
1103 print_signal_info (element);
1104 print_children_info (element);
1113 main (int argc, char *argv[])
1115 gboolean print_all = FALSE;
1116 struct poptOption options[] = {
1117 {"print-all", 'a', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &print_all, 0,
1118 N_("Print all elements"), NULL},
1122 #ifdef GETTEXT_PACKAGE
1123 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
1124 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1125 textdomain (GETTEXT_PACKAGE);
1128 gst_init_with_popt_table (&argc, &argv, options);
1129 gst_control_init (&argc, &argv);
1131 if (print_all && argc > 2) {
1132 g_print ("-a requires no extra arguments\n");
1136 /* if no arguments, print out list of elements */
1137 if (argc == 1 || print_all) {
1138 print_element_list (print_all);
1139 /* else we try to get a factory */
1141 GstElementFactory *factory;
1143 const char *arg = argv[argc - 1];
1146 factory = gst_element_factory_find (arg);
1147 /* if there's a factory, print out the info */
1149 retval = print_element_info (factory, print_all);
1151 retval = print_element_features (arg);
1154 /* otherwise check if it's a plugin */
1156 plugin = gst_registry_pool_find_plugin (arg);
1158 /* if there is such a plugin, print out info */
1160 print_plugin_info (plugin);
1161 print_plugin_features (plugin);
1163 g_print ("No such element or plugin '%s'\n", arg);