6 #include <gst/control/control.h>
10 #define PUT_START_TAG(pfx,tag) \
12 g_print ("%*.*s<%s>\n", pfx, pfx, "", tag); \
15 #define PUT_END_TAG(pfx,tag) \
17 g_print ("%*.*s</%s>\n", pfx, pfx, "", tag); \
20 #define PUT_ESCAPED(pfx,tag,value) \
22 const gchar *toconv = value; \
24 gchar *v = g_markup_escape_text (toconv, strlen (toconv)); \
25 g_print ("%*.*s<%s>%s</%s>\n", pfx, pfx, "", tag, v, tag); \
30 #ifdef G_HAVE_ISO_VARARGS
32 #define PUT_STRING(pfx, ...) \
34 gchar *ps_val = g_strdup_printf(__VA_ARGS__); \
35 g_print ("%*.*s%s\n", pfx, pfx, "", ps_val); \
39 #elif defined(G_HAVE_GNUC_VARARGS)
41 #define PUT_STRING(pfx, str, a...) \
43 g_print ("%*.*s"str"\n", pfx, pfx, "" , ##a); \
49 print_caps (const GstCaps *caps, gint pfx)
56 s = gst_caps_to_string (caps);
57 PUT_ESCAPED (pfx, "caps", s);
62 print_formats (const GstFormat *formats, gint pfx)
64 while (formats && *formats) {
65 const GstFormatDefinition *definition;
67 definition = gst_format_get_details (*formats);
69 PUT_STRING (pfx, "<format id=\"%d\" nick=\"%s\">%s</format>",
70 *formats, definition->nick, definition->description);
72 PUT_STRING (pfx, "<format id=\"%d\">unknown</format>",
80 print_query_types (const GstQueryType *types, gint pfx)
82 while (types && *types) {
83 const GstQueryTypeDefinition *definition;
85 definition = gst_query_type_get_details (*types);
87 PUT_STRING (pfx, "<query-type id=\"%d\" nick=\"%s\">%s</query-type>",
88 *types, definition->nick, definition->description);
90 PUT_STRING (pfx, "<query-type id=\"%d\">unknown</query-type>",
98 print_event_masks (const GstEventMask *masks, gint pfx)
100 #ifndef GST_DISABLE_ENUMTYPES
104 GFlagsClass *flags_class = NULL;
106 event_type = gst_event_type_get_type();
107 klass = (GEnumClass *) g_type_class_ref (event_type);
109 while (masks && masks->type) {
111 gint flags = 0, index = 0;
113 switch (masks->type) {
115 flags = masks->flags;
116 event_flags = gst_seek_type_get_type ();
117 flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
123 value = g_enum_get_value (klass, masks->type);
124 PUT_STRING (pfx, "<event type=\"%s\">",
131 value = g_flags_get_first_value (flags_class, 1 << index);
134 PUT_ESCAPED (pfx + 1, "flag", value->value_nick);
136 PUT_ESCAPED (pfx + 1, "flag", "?");
141 PUT_END_TAG (pfx, "event");
149 output_hierarchy (GType type, gint level, gint *maxlevel)
153 parent = g_type_parent (type);
155 *maxlevel = *maxlevel + 1;
158 PUT_STRING (level, "<object name=\"%s\">", g_type_name (type));
161 output_hierarchy (parent, level, maxlevel);
163 PUT_END_TAG (level, "object");
167 print_element_properties (GstElement *element, gint pfx)
169 GParamSpec **property_specs;
170 gint num_properties,i;
173 property_specs = g_object_class_list_properties
174 (G_OBJECT_GET_CLASS (element), &num_properties);
176 PUT_START_TAG (pfx, "element-properties");
178 for (i = 0; i < num_properties; i++) {
179 GValue value = { 0, };
180 GParamSpec *param = property_specs[i];
183 g_value_init (&value, param->value_type);
184 if (param->flags & G_PARAM_READABLE) {
185 g_object_get_property (G_OBJECT (element), param->name, &value);
188 PUT_START_TAG (pfx + 1, "element-property");
189 PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (param));
190 PUT_ESCAPED (pfx + 2, "type", g_type_name (param->value_type));
191 PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (param));
192 PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (param));
194 PUT_ESCAPED (pfx + 2, "flags", "RW");
197 PUT_ESCAPED (pfx + 2, "flags", "W");
200 switch (G_VALUE_TYPE (&value)) {
202 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
205 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
209 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
210 PUT_STRING (pfx + 2, "<range min=\"%lu\" max=\"%lu\"/>",
211 pulong->minimum, pulong->maximum);
212 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
217 GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
218 PUT_STRING (pfx + 2, "<range min=\"%ld\" max=\"%ld\"/>",
219 plong->minimum, plong->maximum);
220 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
225 GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
226 PUT_STRING (pfx + 2, "<range min=\"%u\" max=\"%u\"/>",
227 puint->minimum, puint->maximum);
228 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
233 GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
234 PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
235 pint->minimum, pint->maximum);
236 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
241 GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
242 PUT_STRING (pfx + 2, "<range min=\"%"G_GUINT64_FORMAT"\" max=\"%"G_GUINT64_FORMAT"\"/>",
243 puint64->minimum, puint64->maximum);
244 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
249 GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
250 PUT_STRING (pfx + 2, "<range min=\"%"G_GINT64_FORMAT"\" max=\"%"G_GINT64_FORMAT"\"/>",
251 pint64->minimum, pint64->maximum);
252 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
257 GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
258 PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
259 pfloat->minimum, pfloat->maximum);
260 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
265 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
266 PUT_STRING (pfx + 2, "<range min=\"%g\" max=\"%g\"/>",
267 pdouble->minimum, pdouble->maximum);
268 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
272 if (param->value_type == GST_TYPE_CAPS) {
273 GstCaps *caps = g_value_peek_pointer (&value);
276 PUT_ESCAPED (pfx + 2, "default", "NULL");
278 print_caps (caps, 2);
281 else if (G_IS_PARAM_SPEC_ENUM (param)) {
286 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
287 enum_value = g_value_get_enum (&value);
289 while (values[j].value_name) {
290 if (values[j].value == enum_value)
294 PUT_STRING (pfx + 2, "<default>%d</default>", values[j].value);
296 PUT_START_TAG (pfx + 2, "enum-values");
298 while (values[j].value_name) {
299 PUT_STRING (pfx + 3, "<value value=\"%d\" nick=\"%s\"/>",
300 values[j].value, values[j].value_nick);
303 PUT_END_TAG (pfx + 2, "enum-values");
305 else if (G_IS_PARAM_SPEC_FLAGS (param)) {
310 values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
311 flags_value = g_value_get_flags (&value);
313 PUT_STRING (pfx + 2, "<default>%d</default>", flags_value);
315 PUT_START_TAG (pfx + 2, "flags");
317 while (values[j].value_name) {
318 PUT_STRING (pfx + 3, "<flag value=\"%d\" nick=\"%s\"/>",
319 values[j].value, values[j].value_nick);
322 PUT_END_TAG (pfx + 2, "flags");
324 else if (G_IS_PARAM_SPEC_OBJECT (param)) {
325 PUT_ESCAPED (pfx + 2, "object-type",
326 g_type_name(param->value_type));
331 PUT_END_TAG (pfx + 1, "element-property");
333 PUT_END_TAG (pfx, "element-properties");
337 print_element_dynparamaters (GstElement *element, gint pfx)
339 GstDParamManager* dpman;
343 PUT_START_TAG (pfx, "dyn-params");
345 if((dpman = gst_dpman_get_manager (element))) {
346 specs = gst_dpman_list_dparam_specs (dpman);
347 for (x = 0; specs[x] != NULL; x++) {
348 PUT_START_TAG (pfx + 1, "dyn-param");
350 PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (specs[x]));
351 PUT_ESCAPED (pfx + 2, "type", g_type_name (specs[x]->value_type));
352 PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (specs[x]));
353 PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (specs[x]));
355 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
357 PUT_STRING (pfx + 2, "<range min=\"%"G_GINT64_FORMAT"\" max=\"%"G_GINT64_FORMAT"\"/>",
358 ((GParamSpecInt64 *) specs[x])->minimum,
359 ((GParamSpecInt64 *) specs[x])->maximum);
360 PUT_STRING (pfx + 2, "<default>%"G_GINT64_FORMAT"</default>",
361 ((GParamSpecInt64 *) specs[x])->default_value);
364 PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
365 ((GParamSpecInt *) specs[x])->minimum,
366 ((GParamSpecInt *) specs[x])->maximum);
367 PUT_STRING (pfx + 2, "<default>%d</default>",
368 ((GParamSpecInt *) specs[x])->default_value);
371 PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
372 ((GParamSpecFloat *) specs[x])->minimum,
373 ((GParamSpecFloat *) specs[x])->maximum);
374 PUT_STRING (pfx + 2, "<default>%f</default>",
375 ((GParamSpecFloat *) specs[x])->default_value);
380 PUT_END_TAG (pfx + 1, "dyn-param");
384 PUT_END_TAG (pfx, "dyn-params");
388 print_element_signals (GstElement *element, gint pfx)
395 signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
396 for (k = 0; k < 2; k++) {
400 PUT_START_TAG (pfx, "element-signals");
402 PUT_START_TAG (pfx, "element-actions");
404 for (i = 0; i < nsignals; i++) {
407 const GType *param_types;
410 query = g_new0 (GSignalQuery,1);
411 g_signal_query (signals[i], query);
413 if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
414 (k == 1 && (query->signal_flags & G_SIGNAL_ACTION))) {
415 n_params = query->n_params;
416 return_type = query->return_type;
417 param_types = query->param_types;
419 PUT_START_TAG (pfx + 1, "signal");
420 PUT_ESCAPED (pfx + 2, "name", query->signal_name);
421 PUT_ESCAPED (pfx + 2, "return-type", g_type_name (return_type));
422 PUT_ESCAPED (pfx + 2, "object-type", g_type_name (G_OBJECT_TYPE (element)));
424 PUT_START_TAG (pfx + 2, "params");
425 for (j = 0; j < n_params; j++) {
426 PUT_ESCAPED (pfx + 3, "type", g_type_name (param_types[j]));
429 PUT_END_TAG (pfx + 2, "params");
431 PUT_END_TAG (pfx + 1, "signal");
439 PUT_END_TAG (pfx, "element-signals");
441 PUT_END_TAG (pfx, "element-actions");
446 print_element_info (GstElementFactory *factory)
449 GstObjectClass *gstobject_class;
450 GstElementClass *gstelement_class;
454 GstPadTemplate *padtemplate;
459 element = gst_element_factory_create (factory, "element");
461 g_print ("couldn't construct element for some reason\n");
464 PUT_START_TAG (0, "element");
465 PUT_ESCAPED (1, "name", GST_PLUGIN_FEATURE_NAME (factory));
467 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
468 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
470 PUT_START_TAG (1, "details");
471 PUT_ESCAPED (2, "long-name", factory->details.longname);
472 PUT_ESCAPED (2, "class", factory->details.klass);
473 PUT_ESCAPED (2, "description",factory->details.description);
474 PUT_ESCAPED (2, "authors", factory->details.author);
475 PUT_END_TAG (1, "details");
477 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
479 PUT_START_TAG (1, "pad-templates");
480 if (factory->numpadtemplates) {
481 pads = factory->padtemplates;
483 padtemplate = (GstPadTemplate*)(pads->data);
484 pads = g_list_next(pads);
486 PUT_START_TAG (2, "pad-template");
487 PUT_ESCAPED (3, "name", padtemplate->name_template);
489 if (padtemplate->direction == GST_PAD_SRC)
490 PUT_ESCAPED (3, "direction", "src");
491 else if (padtemplate->direction == GST_PAD_SINK)
492 PUT_ESCAPED (3, "direction", "sink");
494 PUT_ESCAPED (3, "direction", "unkown");
496 if (padtemplate->presence == GST_PAD_ALWAYS)
497 PUT_ESCAPED (3, "presence", "always");
498 else if (padtemplate->presence == GST_PAD_SOMETIMES)
499 PUT_ESCAPED (3, "presence", "sometimes");
500 else if (padtemplate->presence == GST_PAD_REQUEST) {
501 PUT_ESCAPED (3, "presence", "request");
502 PUT_ESCAPED (3, "request-function",
503 GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
506 PUT_ESCAPED (3, "presence", "unkown");
508 if (padtemplate->caps) {
509 print_caps (padtemplate->caps, 3);
511 PUT_END_TAG (2, "pad-template");
514 PUT_END_TAG (1, "pad-templates");
516 PUT_START_TAG (1, "element-flags");
517 if (GST_FLAG_IS_SET (element, GST_ELEMENT_COMPLEX)) {
518 PUT_ESCAPED (2, "flag", "GST_ELEMENT_COMPLEX");
520 if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
521 PUT_ESCAPED (2, "flag", "GST_ELEMENT_DECOUPLED");
523 if (GST_FLAG_IS_SET (element, GST_ELEMENT_THREAD_SUGGESTED)) {
524 PUT_ESCAPED (2, "flag", "GST_ELEMENT_THREADSUGGESTED");
526 if (GST_FLAG_IS_SET (element, GST_ELEMENT_EVENT_AWARE)) {
527 PUT_ESCAPED (2, "flag", "GST_ELEMENT_EVENT_AWARE");
529 PUT_END_TAG (1, "element-flags");
531 if (GST_IS_BIN (element)) {
532 PUT_START_TAG (1, "bin-flags");
534 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
535 PUT_ESCAPED (2, "flag", "GST_BIN_FLAG_MANAGER");
537 if (GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE)) {
538 PUT_ESCAPED (2, "flag", "GST_BIN_SELF_SCHEDULABLE");
540 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_PREFER_COTHREADS)) {
541 PUT_ESCAPED (2, "flag", "GST_BIN_FLAG_PREFER_COTHREADS");
543 PUT_END_TAG (1, "bin-flags");
547 PUT_START_TAG (1, "element-implementation");
548 if (element->loopfunc)
549 PUT_STRING (2, "<loop-based function=\"%s\"/>",
550 GST_DEBUG_FUNCPTR_NAME (element->loopfunc));
552 PUT_STRING (2, "<state-change function=\"%s\"/>",
553 GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
555 #ifndef GST_DISABLE_LOADSAVE
556 PUT_STRING (2, "<save function=\"%s\"/>",
557 GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
558 PUT_STRING (2, "<load function=\"%s\"/>",
559 GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
561 PUT_END_TAG (1, "element-implementation");
563 PUT_START_TAG (1, "clocking-interaction");
564 if (gst_element_requires_clock (element)) {
565 PUT_STRING (2, "<requires-clock/>");
567 if (gst_element_provides_clock (element)) {
570 clock = gst_element_get_clock (element);
572 PUT_STRING (2, "<provides-clock name=\"%s\"/>", GST_OBJECT_NAME (clock));
574 PUT_END_TAG (1, "clocking-interaction");
576 #ifndef GST_DISABLE_INDEX
577 if (gst_element_is_indexable (element)) {
578 PUT_STRING (1, "<indexing-capabilities/>");
582 PUT_START_TAG (1, "pads");
583 if (element->numpads) {
585 pads = gst_element_get_pad_list (element);
587 pad = GST_PAD (pads->data);
588 pads = g_list_next (pads);
589 realpad = GST_PAD_REALIZE (pad);
591 PUT_START_TAG (2, "pad");
592 PUT_ESCAPED (3, "name", gst_pad_get_name (pad));
594 if (gst_pad_get_direction (pad) == GST_PAD_SRC)
595 PUT_ESCAPED (3, "direction", "src");
596 else if (gst_pad_get_direction (pad) == GST_PAD_SINK)
597 PUT_ESCAPED (3, "direction", "sink");
599 PUT_ESCAPED (3, "direction", "unkown");
601 if (GST_IS_GHOST_PAD (pad))
602 PUT_ESCAPED (3, "ghost", gst_pad_get_name (pad));
604 if (pad->padtemplate)
605 PUT_ESCAPED (3, "template",
606 pad->padtemplate->name_template);
608 PUT_START_TAG (3, "implementation");
609 if (realpad->chainfunc)
610 PUT_STRING (4, "<chain-based function=\"%s\"/>",
611 GST_DEBUG_FUNCPTR_NAME (realpad->chainfunc));
612 if (realpad->getfunc)
613 PUT_STRING (4, "<get-based function=\"%s\"/>",
614 GST_DEBUG_FUNCPTR_NAME (realpad->getfunc));
615 if (realpad->formatsfunc != gst_pad_get_formats_default) {
616 PUT_STRING (4, "<formats-function function=\"%s\">",
617 GST_DEBUG_FUNCPTR_NAME (realpad->formatsfunc));
618 print_formats (gst_pad_get_formats (GST_PAD (realpad)), 5);
619 PUT_END_TAG (4, "formats-function");
621 if (realpad->convertfunc != gst_pad_convert_default)
622 PUT_STRING (4, "<convert-function function=\"%s\"/>",
623 GST_DEBUG_FUNCPTR_NAME (realpad->convertfunc));
624 if (realpad->eventfunc != gst_pad_event_default)
625 PUT_STRING (4, "<event-function function=\"%s\"/>",
626 GST_DEBUG_FUNCPTR_NAME (realpad->eventfunc));
627 if (realpad->eventmaskfunc != gst_pad_get_event_masks_default) {
628 PUT_STRING (4, "<event-mask-func function=\"%s\">",
629 GST_DEBUG_FUNCPTR_NAME (realpad->eventmaskfunc));
630 print_event_masks (gst_pad_get_event_masks (GST_PAD (realpad)), 5);
631 PUT_END_TAG (4, "event-mask-func");
633 if (realpad->queryfunc != gst_pad_query_default)
634 PUT_STRING (4, "<query-function function=\"%s\"/>",
635 GST_DEBUG_FUNCPTR_NAME (realpad->queryfunc));
636 if (realpad->querytypefunc != gst_pad_get_query_types_default) {
637 PUT_STRING (4, "<query-type-func function=\"%s\">",
638 GST_DEBUG_FUNCPTR_NAME (realpad->querytypefunc));
639 print_query_types (gst_pad_get_query_types (GST_PAD (realpad)), 5);
640 PUT_END_TAG (4, "query-type-func");
643 if (realpad->intlinkfunc != gst_pad_get_internal_links_default)
644 PUT_STRING (4, "<intlink-function function=\"%s\"/>",
645 GST_DEBUG_FUNCPTR_NAME(realpad->intlinkfunc));
647 if (realpad->bufferallocfunc)
648 PUT_STRING (4, "<bufferalloc-function function=\"%s\"/>",
649 GST_DEBUG_FUNCPTR_NAME(realpad->bufferallocfunc));
650 PUT_END_TAG (3, "implementation");
653 print_caps (realpad->caps, 3);
655 PUT_END_TAG (2, "pad");
658 PUT_END_TAG (1, "pads");
660 print_element_properties (element, 1);
661 print_element_dynparamaters (element, 1);
662 print_element_signals (element, 1);
664 /* for compound elements */
665 if (GST_IS_BIN (element)) {
666 PUT_START_TAG (1, "children");
667 children = (GList *) gst_bin_get_list (GST_BIN (element));
669 child = GST_ELEMENT (children->data);
670 children = g_list_next (children);
672 PUT_ESCAPED (2, "child", GST_ELEMENT_NAME (child));
674 PUT_END_TAG (1, "children");
676 PUT_END_TAG (0, "element");
682 print_element_list (void)
686 plugins = gst_registry_pool_plugin_list();
691 plugin = (GstPlugin*)(plugins->data);
692 plugins = g_list_next (plugins);
694 features = gst_plugin_get_feature_list (plugin);
696 GstPluginFeature *feature;
698 feature = GST_PLUGIN_FEATURE (features->data);
700 if (GST_IS_ELEMENT_FACTORY (feature)) {
701 GstElementFactory *factory;
703 factory = GST_ELEMENT_FACTORY (feature);
704 g_print ("%s: %s: %s\n", plugin->desc.name,
705 GST_PLUGIN_FEATURE_NAME (factory) ,factory->details.longname);
707 #ifndef GST_DISABLE_INDEX
708 else if (GST_IS_INDEX_FACTORY (feature)) {
709 GstIndexFactory *factory;
711 factory = GST_INDEX_FACTORY (feature);
712 g_print ("%s: %s: %s\n", plugin->desc.name,
713 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
716 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
717 GstTypeFindFactory *factory;
719 factory = GST_TYPE_FIND_FACTORY (feature);
720 if (factory->extensions) {
722 g_print ("%s type: ", plugin->desc.name);
723 while (factory->extensions[i]) {
724 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
728 g_print ("%s type: N/A\n", plugin->desc.name);
730 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
731 GstSchedulerFactory *factory;
733 factory = GST_SCHEDULER_FACTORY (feature);
734 g_print ("%s: %s: %s\n", plugin->desc.name,
735 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
738 g_print ("%s: %s (%s)\n", plugin->desc.name,
739 GST_PLUGIN_FEATURE_NAME (feature),
740 g_type_name (G_OBJECT_TYPE (feature)));
743 features = g_list_next (features);
749 print_plugin_info (GstPlugin *plugin)
752 gint num_features = 0;
753 gint num_elements = 0;
754 gint num_autoplug = 0;
756 gint num_schedulers = 0;
757 gint num_indexes = 0;
760 g_print ("Plugin Details:\n");
761 g_print (" Name:\t\t%s\n", plugin->desc.name);
762 g_print (" Description:\t%s\n", plugin->desc.description);
763 g_print (" Filename:\t%s\n", plugin->filename);
764 g_print (" Version:\t%s\n", plugin->desc.version);
765 g_print (" License:\t%s\n", plugin->desc.license);
766 g_print (" Package:\t%s\n", plugin->desc.package);
767 g_print (" Origin URL:\t%s\n", plugin->desc.origin);
770 features = gst_plugin_get_feature_list (plugin);
773 GstPluginFeature *feature;
775 feature = GST_PLUGIN_FEATURE (features->data);
777 if (GST_IS_ELEMENT_FACTORY (feature)) {
778 GstElementFactory *factory;
780 factory = GST_ELEMENT_FACTORY (feature);
781 g_print (" %s: %s\n", GST_OBJECT_NAME (factory),
782 factory->details.longname);
785 #ifndef GST_DISABLE_INDEX
786 else if (GST_IS_INDEX_FACTORY (feature)) {
787 GstIndexFactory *factory;
789 factory = GST_INDEX_FACTORY (feature);
790 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
794 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
795 GstTypeFindFactory *factory;
797 factory = GST_TYPE_FIND_FACTORY (feature);
798 if (factory->extensions) {
800 g_print ("%s type: ", plugin->desc.name);
801 while (factory->extensions[i]) {
802 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
806 g_print ("%s type: N/A\n", plugin->desc.name);
809 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
810 GstSchedulerFactory *factory;
812 factory = GST_SCHEDULER_FACTORY (feature);
813 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
817 g_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
818 g_type_name (G_OBJECT_TYPE (feature)));
822 features = g_list_next (features);
824 g_print ("\n %d features:\n", num_features);
825 if (num_elements > 0)
826 g_print (" +-- %d elements\n", num_elements);
827 if (num_autoplug > 0)
828 g_print (" +-- %d autopluggers\n", num_autoplug);
830 g_print (" +-- %d types\n", num_types);
831 if (num_schedulers > 0)
832 g_print (" +-- %d schedulers\n", num_schedulers);
834 g_print (" +-- %d indexes\n", num_indexes);
836 g_print (" +-- %d other objects\n", num_other);
843 main (int argc, char *argv[])
845 GstElementFactory *factory;
848 struct poptOption options[] = {
849 {"gst-inspect-plugin", 'p', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
850 "Show plugin details", NULL},
851 {"gst-inspect-scheduler", 's', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
852 "Show scheduler details", NULL},
856 setlocale (LC_ALL, "");
858 gst_init_with_popt_table (&argc, &argv, options);
859 gst_control_init (&argc, &argv);
861 PUT_STRING (0, "<?xml version=\"1.0\"?>");
863 /* if no arguments, print out list of elements */
865 print_element_list();
867 /* else we try to get a factory */
869 /* first check for help */
870 if (strstr (argv[1], "-help")) {
871 g_print ("Usage: %s\t\t\tList all registered elements\n", argv[0]);
872 g_print (" %s element-name\tShow element details\n", argv[0]);
873 g_print (" %s plugin-name[.so]\tShow information about plugin\n",
878 /* only search for a factory if there's not a '.so' */
879 if (! strstr (argv[1], ".so")) {
880 factory = gst_element_factory_find (argv[1]);
882 /* if there's a factory, print out the info */
884 return print_element_info (factory);
886 GstPluginFeature* feature;
888 /* FIXME implement other pretty print function for these */
889 feature = gst_registry_pool_find_feature (argv[1],
890 GST_TYPE_SCHEDULER_FACTORY);
892 g_print ("%s: a scheduler\n", argv[1]);
895 #ifndef GST_DISABLE_INDEX
896 feature = gst_registry_pool_find_feature (argv[1],
897 GST_TYPE_INDEX_FACTORY);
899 g_print ("%s: an index\n", argv[1]);
903 feature = gst_registry_pool_find_feature (argv[1],
904 GST_TYPE_TYPE_FIND_FACTORY);
906 g_print ("%s: a type find function\n", argv[1]);
909 #ifndef GST_DISABLE_URI
910 feature = gst_registry_pool_find_feature (argv[1],
911 GST_TYPE_URI_HANDLER);
913 g_print ("%s: an uri handler\n", argv[1]);
920 so = strstr(argv[1],".so");
924 /* otherwise assume it's a plugin */
925 plugin = gst_registry_pool_find_plugin (argv[1]);
927 /* if there is such a plugin, print out info */
930 print_plugin_info (plugin);
932 g_print("no such element or plugin '%s'\n", argv[1]);