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"
37 print_caps (const GstCaps *caps, const gchar *pfx)
42 s = gst_caps_to_string (caps);
44 tmp = g_strdup_printf ("\n %s", pfx);
45 v = g_strsplit (s, ", ", -1);
47 s = g_strjoinv (tmp, v);
51 tmp = g_strdup_printf ("\n%s", pfx);
52 v = g_strsplit (s, "; ", -1);
54 s = g_strjoinv (tmp, v);
58 g_print ("%s%s\n", pfx, s);
63 print_formats (const GstFormat *formats)
65 while (formats && *formats) {
66 const GstFormatDefinition *definition;
68 definition = gst_format_get_details (*formats);
70 g_print ("\t\t(%d):\t%s (%s)\n", *formats,
71 definition->nick, definition->description);
73 g_print ("\t\t(%d):\tUnknown format\n", *formats);
80 print_query_types (const GstQueryType *types)
82 while (types && *types) {
83 const GstQueryTypeDefinition *definition;
85 definition = gst_query_type_get_details (*types);
87 g_print ("\t\t(%d):\t%s (%s)\n", *types,
88 definition->nick, definition->description);
90 g_print ("\t\t(%d):\tUnknown query format\n", *types);
97 print_event_masks (const GstEventMask *masks)
99 #ifndef GST_DISABLE_ENUMTYPES
103 GFlagsClass *flags_class = NULL;
105 event_type = gst_event_type_get_type();
106 klass = (GEnumClass *) g_type_class_ref (event_type);
108 while (masks && masks->type) {
110 gint flags = 0, index = 0;
112 switch (masks->type) {
114 flags = masks->flags;
115 event_flags = gst_seek_type_get_type ();
116 flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
122 value = g_enum_get_value (klass, masks->type);
123 g_print ("\t\t%s ", value->value_nick);
129 value = g_flags_get_first_value (flags_class, 1 << index);
132 g_print ("| %s ", value->value_nick);
147 output_hierarchy (GType type, gint level, gint *maxlevel)
152 parent = g_type_parent (type);
154 *maxlevel = *maxlevel + 1;
158 output_hierarchy (parent, level, maxlevel);
160 for (i=1; i<*maxlevel-level; i++)
165 g_print ("%s\n", g_type_name (type));
172 print_element_properties (GstElement *element)
174 GParamSpec **property_specs;
175 gint num_properties,i;
177 const char *string_val;
179 property_specs = g_object_class_list_properties
180 (G_OBJECT_GET_CLASS (element), &num_properties);
181 g_print("\nElement Properties:\n");
183 for (i = 0; i < num_properties; i++) {
184 GValue value = { 0, };
185 GParamSpec *param = property_specs[i];
188 g_value_init (&value, param->value_type);
189 if (param->flags & G_PARAM_READABLE) {
190 g_object_get_property (G_OBJECT (element), param->name, &value);
194 g_print(" %-20s: %s\n", g_param_spec_get_name (param),
195 g_param_spec_get_blurb (param));
197 switch (G_VALUE_TYPE (&value)) {
199 string_val = g_value_get_string (&value);
200 g_print ("%-23.23s String. ", "");
202 if (string_val == NULL)
203 g_print ("(Default \"\")");
205 g_print ("(Default \"%s\")", g_value_get_string (&value));
209 g_print ("%-23.23s Boolean. ", "");
210 if (readable) g_print ("(Default %s)", (g_value_get_boolean (&value) ? "true" : "false"));
214 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
215 g_print("%-23.23s Unsigned Long. ", "");
216 if (readable) g_print("Range: %lu - %lu (Default %lu)",
217 pulong->minimum, pulong->maximum, g_value_get_ulong (&value));
222 GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
223 g_print("%-23.23s Long. ", "");
224 if (readable) g_print("Range: %ld - %ld (Default %ld)",
225 plong->minimum, plong->maximum, g_value_get_long (&value));
230 GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
231 g_print("%-23.23s Unsigned Integer. ", "");
232 if (readable) g_print("Range: %u - %u (Default %u)",
233 puint->minimum, puint->maximum, g_value_get_uint (&value));
238 GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
239 g_print("%-23.23s Integer. ", "");
240 if (readable) g_print("Range: %d - %d (Default %d)",
241 pint->minimum, pint->maximum, g_value_get_int (&value));
246 GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
247 g_print("%-23.23s Unsigned Integer64. ", "");
248 if (readable) g_print("Range: %" G_GUINT64_FORMAT " - %"
249 G_GUINT64_FORMAT " (Default %" G_GUINT64_FORMAT ")",
250 puint64->minimum, puint64->maximum,
251 g_value_get_uint64 (&value));
256 GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
257 g_print("%-23.23s Integer64. ", "");
258 if (readable) g_print("Range: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT " (Default %" G_GINT64_FORMAT ")", pint64->minimum,
259 pint64->maximum, g_value_get_int64 (&value));
264 GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
265 g_print("%-23.23s Float. Default: %-8.8s %15.7g\n", "", "",
266 g_value_get_float (&value));
267 g_print("%-23.23s Range: %15.7g - %15.7g", "",
268 pfloat->minimum, pfloat->maximum);
273 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
274 g_print("%-23.23s Double. Default: %-8.8s %15.7g\n", "", "",
275 g_value_get_double (&value));
276 g_print("%-23.23s Range: %15.7g - %15.7g", "",
277 pdouble->minimum, pdouble->maximum);
281 if (param->value_type == GST_TYPE_URI) {
282 g_print("%-23.23s URI", "");
284 if (param->value_type == GST_TYPE_CAPS) {
285 const GstCaps *caps = gst_value_get_caps (&value);
288 g_print("%-23.23s Caps (NULL)", "");
290 print_caps (caps, " ");
293 else if (G_IS_PARAM_SPEC_ENUM (param)) {
298 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
299 enum_value = g_value_get_enum (&value);
301 while (values[j].value_name) {
302 if (values[j].value == enum_value)
307 g_print ("%-23.23s Enum \"%s\" (default %d, \"%s\")", "",
308 g_type_name (G_VALUE_TYPE (&value)),
309 enum_value, values[j].value_nick);
312 while (values[j].value_name) {
313 g_print("\n%-23.23s (%d): \t%s", "",
314 values[j].value, values[j].value_nick);
317 /* g_type_class_unref (ec); */
319 else if (G_IS_PARAM_SPEC_FLAGS (param)) {
323 GString *flags = NULL;
325 values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
326 flags_value = g_value_get_flags (&value);
328 while (values[j].value_name) {
329 if (values[j].value & flags_value) {
331 g_string_append_printf (flags, " | %s", values[j].value_nick);
334 flags = g_string_new (values[j].value_nick);
340 g_print("%-23.23s Flags \"%s\" (default %d, \"%s\")", "",
341 g_type_name (G_VALUE_TYPE (&value)),
342 flags_value, (flags ? flags->str : "(none)"));
345 while (values[j].value_name) {
346 g_print("\n%-23.23s (%d): \t%s", "",
347 values[j].value, values[j].value_nick);
352 g_string_free (flags, TRUE);
354 else if (G_IS_PARAM_SPEC_OBJECT (param)) {
355 g_print("%-23.23s Object of type \"%s\"", "",
356 g_type_name(param->value_type));
359 g_print ("%-23.23s Unknown type %ld \"%s\"", "", param->value_type,
360 g_type_name(param->value_type));
365 g_print (" Write only\n");
369 if (num_properties == 0)
374 get_rank_name (gint rank)
379 case GST_RANK_MARGINAL:
381 case GST_RANK_SECONDARY:
383 case GST_RANK_PRIMARY:
391 print_element_info (GstElementFactory *factory)
394 GstObjectClass *gstobject_class;
395 GstElementClass *gstelement_class;
398 GstPadTemplate *padtemplate;
404 element = gst_element_factory_create (factory, "element");
406 g_print ("couldn't construct element for some reason\n");
410 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
411 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
413 g_print ("Factory Details:\n");
414 g_print (" Long name:\t%s\n", factory->details.longname);
415 g_print (" Class:\t%s\n", factory->details.klass);
416 g_print (" Description:\t%s\n", factory->details.description);
417 g_print (" Author(s):\t%s\n", factory->details.author);
418 g_print (" Rank:\t\t%s\n", get_rank_name(GST_PLUGIN_FEATURE(factory)->rank));
421 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
423 g_print ("Pad Templates:\n");
424 if (factory->numpadtemplates) {
427 pads = factory->padtemplates;
429 padtemplate = (GstPadTemplate*)(pads->data);
430 pads = g_list_next(pads);
432 if (padtemplate->direction == GST_PAD_SRC)
433 g_print (" SRC template: '%s'\n", padtemplate->name_template);
434 else if (padtemplate->direction == GST_PAD_SINK)
435 g_print (" SINK template: '%s'\n", padtemplate->name_template);
437 g_print (" UNKNOWN!!! template: '%s'\n", padtemplate->name_template);
439 if (padtemplate->presence == GST_PAD_ALWAYS)
440 g_print (" Availability: Always\n");
441 else if (padtemplate->presence == GST_PAD_SOMETIMES)
442 g_print (" Availability: Sometimes\n");
443 else if (padtemplate->presence == GST_PAD_REQUEST) {
444 g_print (" Availability: On request\n");
445 g_print (" Has request_new_pad() function: %s\n",
446 GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
449 g_print (" Availability: UNKNOWN!!!\n");
451 if (padtemplate->caps) {
452 g_print (" Capabilities:\n");
453 print_caps (padtemplate->caps, " ");
463 g_print ("\nElement Flags:\n");
464 if (GST_FLAG_IS_SET (element, GST_ELEMENT_COMPLEX)) {
465 g_print (" GST_ELEMENT_COMPLEX\n");
468 if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
469 g_print (" GST_ELEMENT_DECOUPLED\n");
472 if (GST_FLAG_IS_SET (element, GST_ELEMENT_THREAD_SUGGESTED)) {
473 g_print (" GST_ELEMENT_THREADSUGGESTED\n");
476 if (GST_FLAG_IS_SET (element, GST_ELEMENT_EVENT_AWARE)) {
477 g_print(" GST_ELEMENT_EVENT_AWARE\n");
481 g_print(" no flags set\n");
483 if (GST_IS_BIN (element)) {
484 g_print ("\nBin Flags:\n");
485 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
486 g_print (" GST_BIN_FLAG_MANAGER\n");
489 if (GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE)) {
490 g_print (" GST_BIN_SELF_SCHEDULABLE\n");
493 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_PREFER_COTHREADS)) {
494 g_print (" GST_BIN_FLAG_PREFER_COTHREADS\n");
498 g_print (" no flags set\n");
503 g_print ("\nElement Implementation:\n");
505 if (element->loopfunc)
506 g_print (" loopfunc()-based element: %s\n",
507 GST_DEBUG_FUNCPTR_NAME (element->loopfunc));
509 g_print (" No loopfunc(), must be chain-based or not configured yet\n");
511 g_print (" Has change_state() function: %s\n",
512 GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
513 #ifndef GST_DISABLE_LOADSAVE
514 g_print (" Has custom save_thyself() function: %s\n",
515 GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
516 g_print (" Has custom restore_thyself() function: %s\n",
517 GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
522 g_print ("\nClocking Interaction:\n");
523 if (gst_element_requires_clock (element)) {
524 g_print (" element requires a clock\n");
527 if (gst_element_provides_clock (element)) {
530 clock = gst_element_get_clock (element);
532 g_print (" element provides a clock: %s\n", GST_OBJECT_NAME(clock));
534 g_print (" element is supposed to provide a clock but returned NULL\n");
541 #ifndef GST_DISABLE_INDEX
542 g_print ("\nIndexing capabilities:\n");
543 if (gst_element_is_indexable (element)) {
544 g_print (" element can do indexing\n");
551 g_print ("\nPads:\n");
552 if (element->numpads) {
554 pads = gst_element_get_pad_list (element);
556 pad = GST_PAD (pads->data);
557 pads = g_list_next (pads);
558 realpad = GST_PAD_REALIZE (pad);
560 if (gst_pad_get_direction (pad) == GST_PAD_SRC)
561 g_print (" SRC: '%s'", gst_pad_get_name (pad));
562 else if (gst_pad_get_direction (pad) == GST_PAD_SINK)
563 g_print (" SINK: '%s'", gst_pad_get_name (pad));
565 g_print (" UNKNOWN!!!: '%s'\n", gst_pad_get_name (pad));
567 if (GST_IS_GHOST_PAD (pad))
568 g_print (", ghost of real pad %s:%s\n", GST_DEBUG_PAD_NAME (realpad));
572 g_print (" Implementation:\n");
573 if (realpad->chainfunc)
574 g_print (" Has chainfunc(): %s\n",
575 GST_DEBUG_FUNCPTR_NAME (realpad->chainfunc));
576 if (realpad->getfunc)
577 g_print (" Has getfunc(): %s\n",
578 GST_DEBUG_FUNCPTR_NAME (realpad->getfunc));
579 if (realpad->formatsfunc != gst_pad_get_formats_default) {
580 g_print (" Supports seeking/conversion/query formats:\n");
581 print_formats (gst_pad_get_formats (GST_PAD (realpad)));
583 if (realpad->convertfunc != gst_pad_convert_default)
584 g_print (" Has custom convertfunc(): %s\n",
585 GST_DEBUG_FUNCPTR_NAME (realpad->convertfunc));
586 if (realpad->eventfunc != gst_pad_event_default)
587 g_print (" Has custom eventfunc(): %s\n",
588 GST_DEBUG_FUNCPTR_NAME (realpad->eventfunc));
589 if (realpad->eventmaskfunc != gst_pad_get_event_masks_default) {
590 g_print (" Provides event masks:\n");
591 print_event_masks (gst_pad_get_event_masks (GST_PAD (realpad)));
593 if (realpad->queryfunc != gst_pad_query_default)
594 g_print (" Has custom queryfunc(): %s\n",
595 GST_DEBUG_FUNCPTR_NAME (realpad->queryfunc));
596 if (realpad->querytypefunc != gst_pad_get_query_types_default) {
597 g_print (" Provides query types:\n");
598 print_query_types (gst_pad_get_query_types (GST_PAD (realpad)));
601 if (realpad->intlinkfunc != gst_pad_get_internal_links_default)
602 g_print (" Has custom intconnfunc(): %s\n",
603 GST_DEBUG_FUNCPTR_NAME(realpad->intlinkfunc));
605 if (realpad->bufferallocfunc)
606 g_print (" Has bufferallocfunc(): %s\n",
607 GST_DEBUG_FUNCPTR_NAME(realpad->bufferallocfunc));
609 if (pad->padtemplate)
610 g_print (" Pad Template: '%s'\n",
611 pad->padtemplate->name_template);
614 g_print (" Capabilities:\n");
615 print_caps (realpad->caps, " ");
621 print_element_properties (element);
623 /* Dynamic Parameters block */
625 GstDParamManager* dpman;
629 g_print ("\nDynamic Parameters:\n");
630 if((dpman = gst_dpman_get_manager (element))) {
631 specs = gst_dpman_list_dparam_specs (dpman);
632 for (x = 0; specs[x] != NULL; x++) {
633 g_print (" %-20.20s: ", g_param_spec_get_name (specs[x]));
635 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
637 g_print ("64 Bit Integer (Default %" G_GINT64_FORMAT ", Range %"
638 G_GINT64_FORMAT " -> %" G_GINT64_FORMAT ")",
639 ((GParamSpecInt64 *) specs[x])->default_value,
640 ((GParamSpecInt64 *) specs[x])->minimum,
641 ((GParamSpecInt64 *) specs[x])->maximum);
644 g_print ("Integer (Default %d, Range %d -> %d)",
645 ((GParamSpecInt *) specs[x])->default_value,
646 ((GParamSpecInt *) specs[x])->minimum,
647 ((GParamSpecInt *) specs[x])->maximum);
650 g_print ("Float. Default: %-8.8s %15.7g\n", "",
651 ((GParamSpecFloat *) specs[x])->default_value);
652 g_print ("%-23.23s Range: %15.7g - %15.7g", "",
653 ((GParamSpecFloat *) specs[x])->minimum,
654 ((GParamSpecFloat *) specs[x])->maximum);
657 g_print ("Double. Default: %-8.8s %15.7g\n", "",
658 ((GParamSpecDouble *) specs[x])->default_value);
659 g_print ("%-23.23s Range: %15.7g - %15.7g", "",
660 ((GParamSpecDouble *) specs[x])->minimum,
661 ((GParamSpecDouble *) specs[x])->maximum);
663 default: g_print ("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
674 /* Signals/Actions Block */
682 for (k = 0; k < 2; k++) {
686 g_print ("\nElement Signals:\n");
688 g_print ("\nElement Actions:\n");
690 for(type = G_OBJECT_TYPE(element); type; type = g_type_parent(type)){
691 signals = g_signal_list_ids (type, &nsignals);
693 for (i = 0; i < nsignals; i++) {
696 const GType *param_types;
699 query = g_new0 (GSignalQuery,1);
700 g_signal_query (signals[i], query);
702 if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
703 (k == 1 && (query->signal_flags & G_SIGNAL_ACTION))) {
704 n_params = query->n_params;
705 return_type = query->return_type;
706 param_types = query->param_types;
708 g_print (" \"%s\" :\t %s user_function (%s* object",
709 query->signal_name, g_type_name (return_type),
712 for (j = 0; j < n_params; j++) {
713 g_print (",\n \t\t\t\t%s arg%d", g_type_name(param_types[j]), j);
716 g_print (",\n \t\t\t\tgpointer user_data);\n");
726 if (counted == 0) g_print (" none\n");
730 /* for compound elements */
731 if (GST_IS_BIN (element)) {
732 g_print ("\nChildren:\n");
733 children = (GList *) gst_bin_get_list (GST_BIN (element));
738 child = GST_ELEMENT (children->data);
739 children = g_list_next (children);
741 g_print (" %s\n", GST_ELEMENT_NAME (child));
750 print_element_list (void)
754 plugins = gst_registry_pool_plugin_list();
759 plugin = (GstPlugin*)(plugins->data);
760 plugins = g_list_next (plugins);
762 features = gst_plugin_get_feature_list (plugin);
764 GstPluginFeature *feature;
766 feature = GST_PLUGIN_FEATURE (features->data);
768 if (GST_IS_ELEMENT_FACTORY (feature)) {
769 GstElementFactory *factory;
771 factory = GST_ELEMENT_FACTORY (feature);
772 g_print ("%s: %s: %s\n", plugin->desc.name,
773 GST_PLUGIN_FEATURE_NAME (factory) ,factory->details.longname);
775 #ifndef GST_DISABLE_INDEX
776 else if (GST_IS_INDEX_FACTORY (feature)) {
777 GstIndexFactory *factory;
779 factory = GST_INDEX_FACTORY (feature);
780 g_print ("%s: %s: %s\n", plugin->desc.name,
781 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
784 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
785 GstTypeFindFactory *factory;
787 factory = GST_TYPE_FIND_FACTORY (feature);
788 g_print ("%s: %s: ", plugin->desc.name, gst_plugin_feature_get_name (feature));
789 if (factory->extensions) {
791 while (factory->extensions[i]) {
792 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
797 g_print ("no extensions\n");
800 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
801 GstSchedulerFactory *factory;
803 factory = GST_SCHEDULER_FACTORY (feature);
804 g_print ("%s: %s: %s\n", plugin->desc.name,
805 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
808 g_print ("%s: %s (%s)\n", plugin->desc.name,
809 GST_PLUGIN_FEATURE_NAME (feature),
810 g_type_name (G_OBJECT_TYPE (feature)));
813 features = g_list_next (features);
819 print_plugin_info (GstPlugin *plugin)
822 gint num_features = 0;
823 gint num_elements = 0;
825 gint num_schedulers = 0;
826 gint num_indexes = 0;
829 g_print ("Plugin Details:\n");
830 g_print (" Name:\t\t%s\n", plugin->desc.name);
831 g_print (" Description:\t%s\n", plugin->desc.description);
832 g_print (" Filename:\t%s\n", plugin->filename);
833 g_print (" Version:\t%s\n", plugin->desc.version);
834 g_print (" License:\t%s\n", plugin->desc.license);
835 g_print (" Package:\t%s\n", plugin->desc.package);
836 g_print (" Origin URL:\t%s\n", plugin->desc.origin);
839 features = gst_plugin_get_feature_list (plugin);
842 GstPluginFeature *feature;
844 feature = GST_PLUGIN_FEATURE (features->data);
846 if (GST_IS_ELEMENT_FACTORY (feature)) {
847 GstElementFactory *factory;
849 factory = GST_ELEMENT_FACTORY (feature);
850 g_print (" %s: %s\n", GST_OBJECT_NAME (factory),
851 factory->details.longname);
854 #ifndef GST_DISABLE_INDEX
855 else if (GST_IS_INDEX_FACTORY (feature)) {
856 GstIndexFactory *factory;
858 factory = GST_INDEX_FACTORY (feature);
859 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
863 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
864 GstTypeFindFactory *factory;
866 factory = GST_TYPE_FIND_FACTORY (feature);
867 if (factory->extensions) {
869 g_print ("%s type: ", plugin->desc.name);
870 while (factory->extensions[i]) {
871 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
875 g_print ("%s type: N/A\n", plugin->desc.name);
879 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
880 GstSchedulerFactory *factory;
882 factory = GST_SCHEDULER_FACTORY (feature);
883 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
887 g_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
888 g_type_name (G_OBJECT_TYPE (feature)));
892 features = g_list_next (features);
894 g_print ("\n %d features:\n", num_features);
895 if (num_elements > 0)
896 g_print (" +-- %d elements\n", num_elements);
898 g_print (" +-- %d types\n", num_types);
899 if (num_schedulers > 0)
900 g_print (" +-- %d schedulers\n", num_schedulers);
902 g_print (" +-- %d indexes\n", num_indexes);
904 g_print (" +-- %d other objects\n", num_other);
910 main (int argc, char *argv[])
912 GstElementFactory *factory;
915 struct poptOption options[] = {
916 {"gst-inspect-plugin", 'p', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
917 N_("Show plugin details"), NULL},
918 {"gst-inspect-scheduler", 's', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
919 N_("Show scheduler details"), NULL},
923 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
924 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
925 textdomain (GETTEXT_PACKAGE);
927 gst_init_with_popt_table (&argc, &argv, options);
928 gst_control_init (&argc, &argv);
930 /* if no arguments, print out list of elements */
932 print_element_list();
934 /* else we try to get a factory */
936 /* first check for help */
937 if (strstr (argv[1], "-help")) {
938 g_print ("Usage: %s\t\t\tList all registered elements\n",argv[0]);
939 g_print (" %s element-name\tShow element details\n",argv[0]);
940 g_print (" %s plugin-name[.so]\tShow information about plugin\n",
945 /* only search for a factory if there's not a '.so' */
946 if (! strstr (argv[1], ".so")) {
947 factory = gst_element_factory_find (argv[1]);
949 /* if there's a factory, print out the info */
951 return print_element_info (factory);
953 GstPluginFeature* feature;
955 /* FIXME implement other pretty print function for these */
956 feature = gst_registry_pool_find_feature (argv[1],
957 GST_TYPE_SCHEDULER_FACTORY);
959 g_print ("%s: a scheduler\n", argv[1]);
962 #ifndef GST_DISABLE_INDEX
963 feature = gst_registry_pool_find_feature (argv[1],
964 GST_TYPE_INDEX_FACTORY);
966 g_print ("%s: an index\n", argv[1]);
970 feature = gst_registry_pool_find_feature (argv[1],
971 GST_TYPE_TYPE_FIND_FACTORY);
973 g_print ("%s: a typefind function\n", argv[1]);
976 #ifndef GST_DISABLE_URI
977 feature = gst_registry_pool_find_feature (argv[1],
978 GST_TYPE_URI_HANDLER);
980 g_print ("%s: an uri handler\n", argv[1]);
987 so = strstr(argv[1],".so");
991 /* otherwise assume it's a plugin */
992 plugin = gst_registry_pool_find_plugin (argv[1]);
994 /* if there is such a plugin, print out info */
997 print_plugin_info (plugin);
1000 g_print("no such element or plugin '%s'\n", argv[1]);