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_prop (GstPropsEntry *prop, gint pfx)
53 type = gst_props_entry_get_props_type (prop);
56 case GST_PROPS_INT_TYPE:
59 gst_props_entry_get_int (prop, &val);
60 PUT_STRING (pfx, "<int name=\"%s\" value=\"%d\"/>",
61 gst_props_entry_get_name (prop), val);
64 case GST_PROPS_INT_RANGE_TYPE:
67 gst_props_entry_get_int_range (prop, &min, &max);
68 PUT_STRING (pfx, "<range name=\"%s\" min=\"%d\" max=\"%d\"/>",
69 gst_props_entry_get_name (prop), min, max);
72 case GST_PROPS_FLOAT_TYPE:
75 gst_props_entry_get_float (prop, &val);
76 PUT_STRING (pfx, "<float name=\"%s\" value=\"%f\"/>",
77 gst_props_entry_get_name (prop), val);
80 case GST_PROPS_FLOAT_RANGE_TYPE:
83 gst_props_entry_get_float_range (prop, &min, &max);
84 PUT_STRING (pfx, "<floatrange name=\"%s\" min=\"%f\" max=\"%f\"/>",
85 gst_props_entry_get_name (prop), min, max);
88 case GST_PROPS_BOOLEAN_TYPE:
91 gst_props_entry_get_boolean (prop, &val);
92 PUT_STRING (pfx, "<boolean name=\"%s\" value=\"%s\"/>",
93 gst_props_entry_get_name (prop), val ? "true" : "false");
96 case GST_PROPS_STRING_TYPE:
99 gst_props_entry_get_string (prop, &val);
100 PUT_STRING (pfx, "<string name=\"%s\" value=\"%s\"/>",
101 gst_props_entry_get_name (prop), val);
104 case GST_PROPS_FOURCC_TYPE:
107 gst_props_entry_get_fourcc_int (prop, &val);
108 PUT_STRING (pfx, "<!--%c%c%c%c-->",
109 (gchar)( val & 0xff),
110 (gchar)((val >> 8) & 0xff),
111 (gchar)((val >> 16) & 0xff),
112 (gchar)((val >> 24) & 0xff));
113 PUT_STRING (pfx, "<fourcc name=\"%s\" hexvalue=\"%08x\"/>",
114 gst_props_entry_get_name (prop), val);
117 case GST_PROPS_LIST_TYPE:
121 gst_props_entry_get_list (prop, &list);
122 PUT_STRING (pfx, "<list name=\"%s\">", gst_props_entry_get_name (prop));
124 GstPropsEntry *listentry;
126 listentry = (GstPropsEntry*) (list->data);
127 print_prop (listentry, pfx + 1);
129 list = g_list_next (list);
131 PUT_END_TAG (pfx, "list");
140 print_props (GstProps *properties, gint pfx)
145 props = properties->properties;
150 PUT_START_TAG (pfx, "properties");
153 prop = (GstPropsEntry*) (props->data);
154 props = g_list_next (props);
156 print_prop (prop, pfx + 1);
158 PUT_END_TAG (pfx, "properties");
162 print_caps (GstCaps *caps, gint pfx)
167 PUT_START_TAG (pfx, "capscomp");
170 PUT_START_TAG (pfx + 1, "caps");
171 PUT_ESCAPED (pfx + 2, "name", caps->name);
173 PUT_ESCAPED (pfx + 2, "type", gst_caps_get_mime (caps));
175 if (caps->properties) {
176 print_props(caps->properties, pfx + 2);
178 PUT_END_TAG (pfx + 1, "caps");
182 PUT_END_TAG (pfx, "capscomp");
186 print_formats (const GstFormat *formats, gint pfx)
188 while (formats && *formats) {
189 const GstFormatDefinition *definition;
191 definition = gst_format_get_details (*formats);
193 PUT_STRING (pfx, "<format id=\"%d\" nick=\"%s\">%s</format>",
194 *formats, definition->nick, definition->description);
196 PUT_STRING (pfx, "<format id=\"%d\">unkown</format>",
204 print_query_types (const GstQueryType *types, gint pfx)
206 while (types && *types) {
207 const GstQueryTypeDefinition *definition;
209 definition = gst_query_type_get_details (*types);
211 PUT_STRING (pfx, "<query-type id=\"%d\" nick=\"%s\">%s</query-type>",
212 *types, definition->nick, definition->description);
214 PUT_STRING (pfx, "<query-type id=\"%d\">unkown</query-type>",
222 print_event_masks (const GstEventMask *masks, gint pfx)
224 #ifndef GST_DISABLE_ENUMTYPES
228 GFlagsClass *flags_class = NULL;
230 event_type = gst_event_type_get_type();
231 klass = (GEnumClass *) g_type_class_ref (event_type);
233 while (masks && masks->type) {
235 gint flags = 0, index = 0;
237 switch (masks->type) {
239 flags = masks->flags;
240 event_flags = gst_seek_type_get_type ();
241 flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
247 value = g_enum_get_value (klass, masks->type);
248 PUT_STRING (pfx, "<event type=\"%s\">",
255 value = g_flags_get_first_value (flags_class, 1 << index);
258 PUT_ESCAPED (pfx + 1, "flag", value->value_nick);
260 PUT_ESCAPED (pfx + 1, "flag", "?");
265 PUT_END_TAG (pfx, "event");
273 output_hierarchy (GType type, gint level, gint *maxlevel)
277 parent = g_type_parent (type);
279 *maxlevel = *maxlevel + 1;
282 PUT_STRING (level, "<object name=\"%s\">", g_type_name (type));
285 output_hierarchy (parent, level, maxlevel);
287 PUT_END_TAG (level, "object");
291 print_element_properties (GstElement *element, gint pfx)
293 GParamSpec **property_specs;
294 gint num_properties,i;
297 property_specs = g_object_class_list_properties
298 (G_OBJECT_GET_CLASS (element), &num_properties);
300 PUT_START_TAG (pfx, "element-properties");
302 for (i = 0; i < num_properties; i++) {
303 GValue value = { 0, };
304 GParamSpec *param = property_specs[i];
307 g_value_init (&value, param->value_type);
308 if (param->flags & G_PARAM_READABLE) {
309 g_object_get_property (G_OBJECT (element), param->name, &value);
312 PUT_START_TAG (pfx + 1, "element-property");
313 PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (param));
314 PUT_ESCAPED (pfx + 2, "type", g_type_name (param->value_type));
315 PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (param));
316 PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (param));
318 PUT_ESCAPED (pfx + 2, "flags", "RW");
321 PUT_ESCAPED (pfx + 2, "flags", "W");
324 switch (G_VALUE_TYPE (&value)) {
326 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
329 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
333 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
334 PUT_STRING (pfx + 2, "<range min=\"%lu\" max=\"%lu\"/>",
335 pulong->minimum, pulong->maximum);
336 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
341 GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
342 PUT_STRING (pfx + 2, "<range min=\"%ld\" max=\"%ld\"/>",
343 plong->minimum, plong->maximum);
344 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
349 GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
350 PUT_STRING (pfx + 2, "<range min=\"%u\" max=\"%u\"/>",
351 puint->minimum, puint->maximum);
352 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
357 GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
358 PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
359 pint->minimum, pint->maximum);
360 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
365 GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
366 PUT_STRING (pfx + 2, "<range min=\"%"G_GUINT64_FORMAT"\" max=\"%"G_GUINT64_FORMAT"\"/>",
367 puint64->minimum, puint64->maximum);
368 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
373 GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
374 PUT_STRING (pfx + 2, "<range min=\"%"G_GINT64_FORMAT"\" max=\"%"G_GINT64_FORMAT"\"/>",
375 pint64->minimum, pint64->maximum);
376 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
381 GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
382 PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
383 pfloat->minimum, pfloat->maximum);
384 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
389 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
390 PUT_STRING (pfx + 2, "<range min=\"%g\" max=\"%g\"/>",
391 pdouble->minimum, pdouble->maximum);
392 PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
396 if (param->value_type == GST_TYPE_CAPS) {
397 GstCaps *caps = g_value_peek_pointer (&value);
400 PUT_ESCAPED (pfx + 2, "default", "NULL");
402 print_caps (caps, 2);
405 else if (G_IS_PARAM_SPEC_ENUM (param)) {
410 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
411 enum_value = g_value_get_enum (&value);
413 while (values[j].value_name) {
414 if (values[j].value == enum_value)
418 PUT_STRING (pfx + 2, "<default>%d</default>", values[j].value);
420 PUT_START_TAG (pfx + 2, "enum-values");
422 while (values[j].value_name) {
423 PUT_STRING (pfx + 3, "<value value=\"%d\" nick=\"%s\"/>",
424 values[j].value, values[j].value_nick);
427 PUT_END_TAG (pfx + 2, "enum-values");
429 else if (G_IS_PARAM_SPEC_FLAGS (param)) {
434 values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
435 flags_value = g_value_get_flags (&value);
437 PUT_STRING (pfx + 2, "<default>%d</default>", flags_value);
439 PUT_START_TAG (pfx + 2, "flags");
441 while (values[j].value_name) {
442 PUT_STRING (pfx + 3, "<flag value=\"%d\" nick=\"%s\"/>",
443 values[j].value, values[j].value_nick);
446 PUT_END_TAG (pfx + 2, "flags");
448 else if (G_IS_PARAM_SPEC_OBJECT (param)) {
449 PUT_ESCAPED (pfx + 2, "object-type",
450 g_type_name(param->value_type));
455 PUT_END_TAG (pfx + 1, "element-property");
457 PUT_END_TAG (pfx, "element-properties");
461 print_element_dynparamaters (GstElement *element, gint pfx)
463 GstDParamManager* dpman;
467 PUT_START_TAG (pfx, "dyn-params");
469 if((dpman = gst_dpman_get_manager (element))) {
470 specs = gst_dpman_list_dparam_specs (dpman);
471 for (x = 0; specs[x] != NULL; x++) {
472 PUT_START_TAG (pfx + 1, "dyn-param");
474 PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (specs[x]));
475 PUT_ESCAPED (pfx + 2, "type", g_type_name (specs[x]->value_type));
476 PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (specs[x]));
477 PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (specs[x]));
479 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
481 PUT_STRING (pfx + 2, "<range min=\"%"G_GINT64_FORMAT"\" max=\"%"G_GINT64_FORMAT"\"/>",
482 ((GParamSpecInt64 *) specs[x])->minimum,
483 ((GParamSpecInt64 *) specs[x])->maximum);
484 PUT_STRING (pfx + 2, "<default>%"G_GINT64_FORMAT"</default>",
485 ((GParamSpecInt64 *) specs[x])->default_value);
488 PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
489 ((GParamSpecInt *) specs[x])->minimum,
490 ((GParamSpecInt *) specs[x])->maximum);
491 PUT_STRING (pfx + 2, "<default>%d</default>",
492 ((GParamSpecInt *) specs[x])->default_value);
495 PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
496 ((GParamSpecFloat *) specs[x])->minimum,
497 ((GParamSpecFloat *) specs[x])->maximum);
498 PUT_STRING (pfx + 2, "<default>%f</default>",
499 ((GParamSpecFloat *) specs[x])->default_value);
504 PUT_END_TAG (pfx + 1, "dyn-param");
508 PUT_END_TAG (pfx, "dyn-params");
512 print_element_signals (GstElement *element, gint pfx)
519 signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
520 for (k = 0; k < 2; k++) {
524 PUT_START_TAG (pfx, "element-signals");
526 PUT_START_TAG (pfx, "element-actions");
528 for (i = 0; i < nsignals; i++) {
531 const GType *param_types;
534 query = g_new0 (GSignalQuery,1);
535 g_signal_query (signals[i], query);
537 if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
538 (k == 1 && (query->signal_flags & G_SIGNAL_ACTION))) {
539 n_params = query->n_params;
540 return_type = query->return_type;
541 param_types = query->param_types;
543 PUT_START_TAG (pfx + 1, "signal");
544 PUT_ESCAPED (pfx + 2, "name", query->signal_name);
545 PUT_ESCAPED (pfx + 2, "return-type", g_type_name (return_type));
546 PUT_ESCAPED (pfx + 2, "object-type", g_type_name (G_OBJECT_TYPE (element)));
548 PUT_START_TAG (pfx + 2, "params");
549 for (j = 0; j < n_params; j++) {
550 PUT_ESCAPED (pfx + 3, "type", g_type_name (param_types[j]));
553 PUT_END_TAG (pfx + 2, "params");
555 PUT_END_TAG (pfx + 1, "signal");
563 PUT_END_TAG (pfx, "element-signals");
565 PUT_END_TAG (pfx, "element-actions");
570 print_element_info (GstElementFactory *factory)
573 GstObjectClass *gstobject_class;
574 GstElementClass *gstelement_class;
578 GstPadTemplate *padtemplate;
583 element = gst_element_factory_create (factory, "element");
585 g_print ("couldn't construct element for some reason\n");
588 PUT_START_TAG (0, "element");
589 PUT_ESCAPED (1, "name", GST_PLUGIN_FEATURE_NAME (factory));
591 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
592 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
594 PUT_START_TAG (1, "details");
595 PUT_ESCAPED (2, "long-name", factory->details.longname);
596 PUT_ESCAPED (2, "class", factory->details.klass);
597 PUT_ESCAPED (2, "description",factory->details.description);
598 PUT_ESCAPED (2, "authors", factory->details.author);
599 PUT_END_TAG (1, "details");
601 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
603 PUT_START_TAG (1, "pad-templates");
604 if (factory->numpadtemplates) {
605 pads = factory->padtemplates;
607 padtemplate = (GstPadTemplate*)(pads->data);
608 pads = g_list_next(pads);
610 PUT_START_TAG (2, "pad-template");
611 PUT_ESCAPED (3, "name", padtemplate->name_template);
613 if (padtemplate->direction == GST_PAD_SRC)
614 PUT_ESCAPED (3, "direction", "src");
615 else if (padtemplate->direction == GST_PAD_SINK)
616 PUT_ESCAPED (3, "direction", "sink");
618 PUT_ESCAPED (3, "direction", "unkown");
620 if (padtemplate->presence == GST_PAD_ALWAYS)
621 PUT_ESCAPED (3, "presence", "always");
622 else if (padtemplate->presence == GST_PAD_SOMETIMES)
623 PUT_ESCAPED (3, "presence", "sometimes");
624 else if (padtemplate->presence == GST_PAD_REQUEST) {
625 PUT_ESCAPED (3, "presence", "request");
626 PUT_ESCAPED (3, "request-function",
627 GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
630 PUT_ESCAPED (3, "presence", "unkown");
632 if (padtemplate->caps) {
633 print_caps (padtemplate->caps, 3);
635 PUT_END_TAG (2, "pad-template");
638 PUT_END_TAG (1, "pad-templates");
640 PUT_START_TAG (1, "element-flags");
641 if (GST_FLAG_IS_SET (element, GST_ELEMENT_COMPLEX)) {
642 PUT_ESCAPED (2, "flag", "GST_ELEMENT_COMPLEX");
644 if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
645 PUT_ESCAPED (2, "flag", "GST_ELEMENT_DECOUPLED");
647 if (GST_FLAG_IS_SET (element, GST_ELEMENT_THREAD_SUGGESTED)) {
648 PUT_ESCAPED (2, "flag", "GST_ELEMENT_THREADSUGGESTED");
650 if (GST_FLAG_IS_SET (element, GST_ELEMENT_EVENT_AWARE)) {
651 PUT_ESCAPED (2, "flag", "GST_ELEMENT_EVENT_AWARE");
653 PUT_END_TAG (1, "element-flags");
655 if (GST_IS_BIN (element)) {
656 PUT_START_TAG (1, "bin-flags");
658 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
659 PUT_ESCAPED (2, "flag", "GST_BIN_FLAG_MANAGER");
661 if (GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE)) {
662 PUT_ESCAPED (2, "flag", "GST_BIN_SELF_SCHEDULABLE");
664 if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_PREFER_COTHREADS)) {
665 PUT_ESCAPED (2, "flag", "GST_BIN_FLAG_PREFER_COTHREADS");
667 PUT_END_TAG (1, "bin-flags");
671 PUT_START_TAG (1, "element-implementation");
672 if (element->loopfunc)
673 PUT_STRING (2, "<loop-based function=\"%s\"/>",
674 GST_DEBUG_FUNCPTR_NAME (element->loopfunc));
676 PUT_STRING (2, "<state-change function=\"%s\"/>",
677 GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
679 #ifndef GST_DISABLE_LOADSAVE
680 PUT_STRING (2, "<save function=\"%s\"/>",
681 GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
682 PUT_STRING (2, "<load function=\"%s\"/>",
683 GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
685 PUT_END_TAG (1, "element-implementation");
687 PUT_START_TAG (1, "clocking-interaction");
688 if (gst_element_requires_clock (element)) {
689 PUT_STRING (2, "<requires-clock/>");
691 if (gst_element_provides_clock (element)) {
694 clock = gst_element_get_clock (element);
696 PUT_STRING (2, "<provides-clock name=\"%s\"/>", GST_OBJECT_NAME (clock));
698 PUT_END_TAG (1, "clocking-interaction");
700 #ifndef GST_DISABLE_INDEX
701 if (gst_element_is_indexable (element)) {
702 PUT_STRING (1, "<indexing-capabilities/>");
706 PUT_START_TAG (1, "pads");
707 if (element->numpads) {
709 pads = gst_element_get_pad_list (element);
711 pad = GST_PAD (pads->data);
712 pads = g_list_next (pads);
713 realpad = GST_PAD_REALIZE (pad);
715 PUT_START_TAG (2, "pad");
716 PUT_ESCAPED (3, "name", gst_pad_get_name (pad));
718 if (gst_pad_get_direction (pad) == GST_PAD_SRC)
719 PUT_ESCAPED (3, "direction", "src");
720 else if (gst_pad_get_direction (pad) == GST_PAD_SINK)
721 PUT_ESCAPED (3, "direction", "sink");
723 PUT_ESCAPED (3, "direction", "unkown");
725 if (GST_IS_GHOST_PAD (pad))
726 PUT_ESCAPED (3, "ghost", gst_pad_get_name (pad));
728 if (pad->padtemplate)
729 PUT_ESCAPED (3, "template",
730 pad->padtemplate->name_template);
732 PUT_START_TAG (3, "implementation");
733 if (realpad->chainfunc)
734 PUT_STRING (4, "<chain-based function=\"%s\"/>",
735 GST_DEBUG_FUNCPTR_NAME (realpad->chainfunc));
736 if (realpad->getfunc)
737 PUT_STRING (4, "<get-based function=\"%s\"/>",
738 GST_DEBUG_FUNCPTR_NAME (realpad->getfunc));
739 if (realpad->formatsfunc != gst_pad_get_formats_default) {
740 PUT_STRING (4, "<formats-function function=\"%s\">",
741 GST_DEBUG_FUNCPTR_NAME (realpad->formatsfunc));
742 print_formats (gst_pad_get_formats (GST_PAD (realpad)), 5);
743 PUT_END_TAG (4, "formats-function");
745 if (realpad->convertfunc != gst_pad_convert_default)
746 PUT_STRING (4, "<convert-function function=\"%s\"/>",
747 GST_DEBUG_FUNCPTR_NAME (realpad->convertfunc));
748 if (realpad->eventfunc != gst_pad_event_default)
749 PUT_STRING (4, "<event-function function=\"%s\"/>",
750 GST_DEBUG_FUNCPTR_NAME (realpad->eventfunc));
751 if (realpad->eventmaskfunc != gst_pad_get_event_masks_default) {
752 PUT_STRING (4, "<event-mask-func function=\"%s\">",
753 GST_DEBUG_FUNCPTR_NAME (realpad->eventmaskfunc));
754 print_event_masks (gst_pad_get_event_masks (GST_PAD (realpad)), 5);
755 PUT_END_TAG (4, "event-mask-func");
757 if (realpad->queryfunc != gst_pad_query_default)
758 PUT_STRING (4, "<query-function function=\"%s\"/>",
759 GST_DEBUG_FUNCPTR_NAME (realpad->queryfunc));
760 if (realpad->querytypefunc != gst_pad_get_query_types_default) {
761 PUT_STRING (4, "<query-type-func function=\"%s\">",
762 GST_DEBUG_FUNCPTR_NAME (realpad->querytypefunc));
763 print_query_types (gst_pad_get_query_types (GST_PAD (realpad)), 5);
764 PUT_END_TAG (4, "query-type-func");
767 if (realpad->intlinkfunc != gst_pad_get_internal_links_default)
768 PUT_STRING (4, "<intlink-function function=\"%s\"/>",
769 GST_DEBUG_FUNCPTR_NAME(realpad->intlinkfunc));
771 if (realpad->bufferpoolfunc)
772 PUT_STRING (4, "<bufferpool-function function=\"%s\"/>",
773 GST_DEBUG_FUNCPTR_NAME(realpad->bufferpoolfunc));
774 PUT_END_TAG (3, "implementation");
777 print_caps (realpad->caps, 3);
779 PUT_END_TAG (2, "pad");
782 PUT_END_TAG (1, "pads");
784 print_element_properties (element, 1);
785 print_element_dynparamaters (element, 1);
786 print_element_signals (element, 1);
788 /* for compound elements */
789 if (GST_IS_BIN (element)) {
790 PUT_START_TAG (1, "children");
791 children = (GList *) gst_bin_get_list (GST_BIN (element));
793 child = GST_ELEMENT (children->data);
794 children = g_list_next (children);
796 PUT_ESCAPED (2, "child", GST_ELEMENT_NAME (child));
798 PUT_END_TAG (1, "children");
800 PUT_END_TAG (0, "element");
806 print_element_list (void)
810 plugins = gst_registry_pool_plugin_list();
815 plugin = (GstPlugin*)(plugins->data);
816 plugins = g_list_next (plugins);
818 features = gst_plugin_get_feature_list (plugin);
820 GstPluginFeature *feature;
822 feature = GST_PLUGIN_FEATURE (features->data);
824 if (GST_IS_ELEMENT_FACTORY (feature)) {
825 GstElementFactory *factory;
827 factory = GST_ELEMENT_FACTORY (feature);
828 g_print ("%s: %s: %s\n", plugin->desc.name,
829 GST_PLUGIN_FEATURE_NAME (factory) ,factory->details.longname);
831 #ifndef GST_DISABLE_INDEX
832 else if (GST_IS_INDEX_FACTORY (feature)) {
833 GstIndexFactory *factory;
835 factory = GST_INDEX_FACTORY (feature);
836 g_print ("%s: %s: %s\n", plugin->desc.name,
837 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
840 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
841 GstTypeFindFactory *factory;
843 factory = GST_TYPE_FIND_FACTORY (feature);
844 if (factory->extensions) {
846 g_print ("%s type: ", plugin->desc.name);
847 while (factory->extensions[i]) {
848 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
852 g_print ("%s type: N/A\n", plugin->desc.name);
854 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
855 GstSchedulerFactory *factory;
857 factory = GST_SCHEDULER_FACTORY (feature);
858 g_print ("%s: %s: %s\n", plugin->desc.name,
859 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
862 g_print ("%s: %s (%s)\n", plugin->desc.name,
863 GST_PLUGIN_FEATURE_NAME (feature),
864 g_type_name (G_OBJECT_TYPE (feature)));
867 features = g_list_next (features);
873 print_plugin_info (GstPlugin *plugin)
876 gint num_features = 0;
877 gint num_elements = 0;
878 gint num_autoplug = 0;
880 gint num_schedulers = 0;
881 gint num_indexes = 0;
884 g_print ("Plugin Details:\n");
885 g_print (" Name:\t\t%s\n", plugin->desc.name);
886 g_print (" Description:\t%s\n", plugin->desc.description);
887 g_print (" Filename:\t%s\n", plugin->filename);
888 g_print (" Version:\t%s\n", plugin->desc.version);
889 g_print (" License:\t%s\n", plugin->desc.license);
890 g_print (" Copyright:\t%s\n", plugin->desc.copyright);
891 g_print (" Package:\t%s\n", plugin->desc.package);
892 g_print (" Origin URL:\t%s\n", plugin->desc.origin);
895 features = gst_plugin_get_feature_list (plugin);
898 GstPluginFeature *feature;
900 feature = GST_PLUGIN_FEATURE (features->data);
902 if (GST_IS_ELEMENT_FACTORY (feature)) {
903 GstElementFactory *factory;
905 factory = GST_ELEMENT_FACTORY (feature);
906 g_print (" %s: %s\n", GST_OBJECT_NAME (factory),
907 factory->details.longname);
910 #ifndef GST_DISABLE_INDEX
911 else if (GST_IS_INDEX_FACTORY (feature)) {
912 GstIndexFactory *factory;
914 factory = GST_INDEX_FACTORY (feature);
915 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
919 else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
920 GstTypeFindFactory *factory;
922 factory = GST_TYPE_FIND_FACTORY (feature);
923 if (factory->extensions) {
925 g_print ("%s type: ", plugin->desc.name);
926 while (factory->extensions[i]) {
927 g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
931 g_print ("%s type: N/A\n", plugin->desc.name);
934 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
935 GstSchedulerFactory *factory;
937 factory = GST_SCHEDULER_FACTORY (feature);
938 g_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
942 g_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
943 g_type_name (G_OBJECT_TYPE (feature)));
947 features = g_list_next (features);
949 g_print ("\n %d features:\n", num_features);
950 if (num_elements > 0)
951 g_print (" +-- %d elements\n", num_elements);
952 if (num_autoplug > 0)
953 g_print (" +-- %d autopluggers\n", num_autoplug);
955 g_print (" +-- %d types\n", num_types);
956 if (num_schedulers > 0)
957 g_print (" +-- %d schedulers\n", num_schedulers);
959 g_print (" +-- %d indexes\n", num_indexes);
961 g_print (" +-- %d other objects\n", num_other);
968 main (int argc, char *argv[])
970 GstElementFactory *factory;
973 struct poptOption options[] = {
974 {"gst-inspect-plugin", 'p', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
975 "Show plugin details", NULL},
976 {"gst-inspect-scheduler", 's', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, 0,
977 "Show scheduler details", NULL},
981 setlocale (LC_ALL, "");
983 gst_init_with_popt_table (&argc, &argv, options);
984 gst_control_init (&argc, &argv);
986 PUT_STRING (0, "<?xml version=\"1.0\"?>");
988 /* if no arguments, print out list of elements */
990 print_element_list();
992 /* else we try to get a factory */
994 /* first check for help */
995 if (strstr (argv[1], "-help")) {
996 g_print ("Usage: %s\t\t\tList all registered elements\n", argv[0]);
997 g_print (" %s element-name\tShow element details\n", argv[0]);
998 g_print (" %s plugin-name[.so]\tShow information about plugin\n",
1003 /* only search for a factory if there's not a '.so' */
1004 if (! strstr (argv[1], ".so")) {
1005 factory = gst_element_factory_find (argv[1]);
1007 /* if there's a factory, print out the info */
1009 return print_element_info (factory);
1011 GstPluginFeature* feature;
1013 /* FIXME implement other pretty print function for these */
1014 feature = gst_registry_pool_find_feature (argv[1],
1015 GST_TYPE_SCHEDULER_FACTORY);
1017 g_print ("%s: a scheduler\n", argv[1]);
1020 #ifndef GST_DISABLE_INDEX
1021 feature = gst_registry_pool_find_feature (argv[1],
1022 GST_TYPE_INDEX_FACTORY);
1024 g_print ("%s: an index\n", argv[1]);
1028 feature = gst_registry_pool_find_feature (argv[1],
1029 GST_TYPE_TYPE_FIND_FACTORY);
1031 g_print ("%s: a type find function\n", argv[1]);
1034 #ifndef GST_DISABLE_URI
1035 feature = gst_registry_pool_find_feature (argv[1],
1036 GST_TYPE_URI_HANDLER);
1038 g_print ("%s: an uri handler\n", argv[1]);
1045 so = strstr(argv[1],".so");
1049 /* otherwise assume it's a plugin */
1050 plugin = gst_registry_pool_find_plugin (argv[1]);
1052 /* if there is such a plugin, print out info */
1055 print_plugin_info (plugin);
1057 g_print("no such element or plugin '%s'\n", argv[1]);