Git init
[framework/multimedia/gstreamer0.10.git] / tools / gst-xmlinspect.c
1 /* GStreamer gst-xmlinspect
2  * Copyright (C) 2003 Wim Taymans <wtay@chello.be>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /* FIXME 0.11: remove gst-xmlinspect and gst-feedback etc. */
21 #ifdef HAVE_CONFIG_H
22 #  include "config.h"
23 #endif
24
25 #include <string.h>
26 #include <locale.h>
27 #include <glib/gprintf.h>
28
29 #include "tools.h"
30
31 #define PUT_START_TAG(pfx,tag)                                  \
32 G_STMT_START{                                                   \
33   g_print ("%*.*s<%s>\n", pfx, pfx, "", tag);                   \
34 }G_STMT_END
35
36 #define PUT_END_TAG(pfx,tag)                                    \
37 G_STMT_START{                                                   \
38   g_print ("%*.*s</%s>\n", pfx, pfx, "", tag);                  \
39 }G_STMT_END
40
41 #define PUT_ESCAPED(pfx,tag,value)                              \
42 G_STMT_START{                                                   \
43   const gchar *toconv = value;                                  \
44   if (value) {                                                  \
45     gchar *v = g_markup_escape_text (toconv, strlen (toconv));  \
46     g_print ("%*.*s<%s>%s</%s>\n", pfx, pfx, "", tag, v, tag);  \
47     g_free (v);                                                 \
48   }                                                             \
49 }G_STMT_END
50
51 #ifdef G_HAVE_ISO_VARARGS
52
53 #define PUT_STRING(pfx, ...)                                    \
54 G_STMT_START{                                                   \
55   gchar *ps_val = g_strdup_printf(__VA_ARGS__);                 \
56   g_print ("%*.*s%s\n", pfx, pfx, "", ps_val);                  \
57   g_free(ps_val);                                               \
58 }G_STMT_END
59
60 #elif defined(G_HAVE_GNUC_VARARGS)
61
62 #define PUT_STRING(pfx, str, a...)                              \
63 G_STMT_START{                                                   \
64   g_print ("%*.*s"str"\n", pfx, pfx, "" , ##a);                 \
65 }G_STMT_END
66
67 #else
68
69 static inline void
70 PUT_STRING (int pfx, const char *format, ...)
71 {
72   va_list varargs;
73
74   g_print ("%*.*s", pfx, pfx, "");
75   va_start (varargs, format);
76   g_vprintf (format, varargs);
77   va_end (varargs);
78   g_print ("\n");
79 }
80
81 #endif
82
83 static void
84 print_caps (const GstCaps * caps, gint pfx)
85 {
86   char *s;
87
88   if (!caps)
89     return;
90
91   s = gst_caps_to_string (caps);
92   PUT_ESCAPED (pfx, "caps", s);
93   g_free (s);
94 }
95
96 #if 0
97 static void
98 print_formats (const GstFormat * formats, gint pfx)
99 {
100   while (formats && *formats) {
101     const GstFormatDefinition *definition;
102
103     definition = gst_format_get_details (*formats);
104     if (definition)
105       PUT_STRING (pfx, "<format id=\"%d\" nick=\"%s\">%s</format>",
106           *formats, definition->nick, definition->description);
107     else
108       PUT_STRING (pfx, "<format id=\"%d\">unknown</format>", *formats);
109
110     formats++;
111   }
112 }
113 #endif
114
115 static void
116 print_query_types (const GstQueryType * types, gint pfx)
117 {
118   while (types && *types) {
119     const GstQueryTypeDefinition *definition;
120
121     definition = gst_query_type_get_details (*types);
122     if (definition)
123       PUT_STRING (pfx, "<query-type id=\"%d\" nick=\"%s\">%s</query-type>",
124           *types, definition->nick, definition->description);
125     else
126       PUT_STRING (pfx, "<query-type id=\"%d\">unknown</query-type>", *types);
127
128     types++;
129   }
130 }
131
132 #if 0
133 static void
134 print_event_masks (const GstEventMask * masks, gint pfx)
135 {
136   GType event_type;
137   GEnumClass *klass;
138   GType event_flags;
139   GFlagsClass *flags_class = NULL;
140
141   event_type = gst_event_type_get_type ();
142   klass = (GEnumClass *) g_type_class_ref (event_type);
143
144   while (masks && masks->type) {
145     GEnumValue *value;
146     gint flags = 0, index = 0;
147
148     switch (masks->type) {
149       case GST_EVENT_SEEK:
150         flags = masks->flags;
151         event_flags = gst_seek_type_get_type ();
152         flags_class = (GFlagsClass *) g_type_class_ref (event_flags);
153         break;
154       default:
155         break;
156     }
157
158     value = g_enum_get_value (klass, masks->type);
159     PUT_STRING (pfx, "<event type=\"%s\">", value->value_nick);
160
161     while (flags) {
162       GFlagsValue *value;
163
164       if (flags & 1) {
165         value = g_flags_get_first_value (flags_class, 1 << index);
166
167         if (value)
168           PUT_ESCAPED (pfx + 1, "flag", value->value_nick);
169         else
170           PUT_ESCAPED (pfx + 1, "flag", "?");
171       }
172       flags >>= 1;
173       index++;
174     }
175     PUT_END_TAG (pfx, "event");
176
177     masks++;
178   }
179 }
180 #endif
181
182 static void
183 output_hierarchy (GType type, gint level, gint * maxlevel)
184 {
185   GType parent;
186
187   parent = g_type_parent (type);
188
189   *maxlevel = *maxlevel + 1;
190   level++;
191
192   PUT_STRING (level, "<object name=\"%s\">", g_type_name (type));
193
194   if (parent)
195     output_hierarchy (parent, level, maxlevel);
196
197   PUT_END_TAG (level, "object");
198 }
199
200 static void
201 print_element_properties (GstElement * element, gint pfx)
202 {
203   GParamSpec **property_specs;
204   guint num_properties;
205   gint i;
206   gboolean readable;
207
208   property_specs = g_object_class_list_properties
209       (G_OBJECT_GET_CLASS (element), &num_properties);
210
211   PUT_START_TAG (pfx, "element-properties");
212
213   for (i = 0; i < num_properties; i++) {
214     GValue value = { 0, };
215     GParamSpec *param = property_specs[i];
216
217     readable = FALSE;
218
219     g_value_init (&value, param->value_type);
220     if (param->flags & G_PARAM_READABLE) {
221       g_object_get_property (G_OBJECT (element), param->name, &value);
222       readable = TRUE;
223     }
224     PUT_START_TAG (pfx + 1, "element-property");
225     PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (param));
226     PUT_ESCAPED (pfx + 2, "type", g_type_name (param->value_type));
227     PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (param));
228     PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (param));
229     if (readable) {
230       PUT_ESCAPED (pfx + 2, "flags", "RW");
231     } else {
232       PUT_ESCAPED (pfx + 2, "flags", "W");
233     }
234
235     switch (G_VALUE_TYPE (&value)) {
236       case G_TYPE_STRING:
237         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
238         break;
239       case G_TYPE_BOOLEAN:
240         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
241         break;
242       case G_TYPE_ULONG:
243       {
244         GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
245
246         PUT_STRING (pfx + 2, "<range min=\"%lu\" max=\"%lu\"/>",
247             pulong->minimum, pulong->maximum);
248         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
249         break;
250       }
251       case G_TYPE_LONG:
252       {
253         GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
254
255         PUT_STRING (pfx + 2, "<range min=\"%ld\" max=\"%ld\"/>",
256             plong->minimum, plong->maximum);
257         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
258         break;
259       }
260       case G_TYPE_UINT:
261       {
262         GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
263
264         PUT_STRING (pfx + 2, "<range min=\"%u\" max=\"%u\"/>",
265             puint->minimum, puint->maximum);
266         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
267         break;
268       }
269       case G_TYPE_INT:
270       {
271         GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
272
273         PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
274             pint->minimum, pint->maximum);
275         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
276         break;
277       }
278       case G_TYPE_UINT64:
279       {
280         GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
281
282         PUT_STRING (pfx + 2,
283             "<range min=\"%" G_GUINT64_FORMAT "\" max=\"%" G_GUINT64_FORMAT
284             "\"/>", puint64->minimum, puint64->maximum);
285         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
286         break;
287       }
288       case G_TYPE_INT64:
289       {
290         GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
291
292         PUT_STRING (pfx + 2,
293             "<range min=\"%" G_GINT64_FORMAT "\" max=\"%" G_GINT64_FORMAT
294             "\"/>", pint64->minimum, pint64->maximum);
295         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
296         break;
297       }
298       case G_TYPE_FLOAT:
299       {
300         GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
301
302         PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
303             pfloat->minimum, pfloat->maximum);
304         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
305         break;
306       }
307       case G_TYPE_DOUBLE:
308       {
309         GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
310
311         PUT_STRING (pfx + 2, "<range min=\"%g\" max=\"%g\"/>",
312             pdouble->minimum, pdouble->maximum);
313         PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
314         break;
315       }
316       default:
317         if (param->value_type == GST_TYPE_CAPS) {
318           GstCaps *caps = g_value_peek_pointer (&value);
319
320           if (!caps)
321             PUT_ESCAPED (pfx + 2, "default", "NULL");
322           else {
323             print_caps (caps, 2);
324           }
325         } else if (G_IS_PARAM_SPEC_ENUM (param)) {
326           GEnumValue *values;
327           guint j = 0;
328           gint enum_value;
329
330           values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
331           enum_value = g_value_get_enum (&value);
332
333           while (values[j].value_name) {
334             if (values[j].value == enum_value)
335               break;
336             j++;
337           }
338           PUT_STRING (pfx + 2, "<default>%d</default>", values[j].value);
339
340           PUT_START_TAG (pfx + 2, "enum-values");
341           j = 0;
342           while (values[j].value_name) {
343             PUT_STRING (pfx + 3, "<value value=\"%d\" nick=\"%s\"/>",
344                 values[j].value, values[j].value_nick);
345             j++;
346           }
347           PUT_END_TAG (pfx + 2, "enum-values");
348         } else if (G_IS_PARAM_SPEC_FLAGS (param)) {
349           GFlagsValue *values;
350           guint j = 0;
351           gint flags_value;
352
353           values = G_FLAGS_CLASS (g_type_class_ref (param->value_type))->values;
354           flags_value = g_value_get_flags (&value);
355
356           PUT_STRING (pfx + 2, "<default>%d</default>", flags_value);
357
358           PUT_START_TAG (pfx + 2, "flags");
359           j = 0;
360           while (values[j].value_name) {
361             PUT_STRING (pfx + 3, "<flag value=\"%d\" nick=\"%s\"/>",
362                 values[j].value, values[j].value_nick);
363             j++;
364           }
365           PUT_END_TAG (pfx + 2, "flags");
366         } else if (G_IS_PARAM_SPEC_OBJECT (param)) {
367           PUT_ESCAPED (pfx + 2, "object-type", g_type_name (param->value_type));
368         }
369         break;
370     }
371
372     PUT_END_TAG (pfx + 1, "element-property");
373   }
374   PUT_END_TAG (pfx, "element-properties");
375   g_free (property_specs);
376 }
377
378 static void
379 print_element_signals (GstElement * element, gint pfx)
380 {
381   guint *signals;
382   guint nsignals;
383   gint i, k;
384   GSignalQuery *query;
385
386   signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
387   for (k = 0; k < 2; k++) {
388     gint counted = 0;
389
390     if (k == 0)
391       PUT_START_TAG (pfx, "element-signals");
392     else
393       PUT_START_TAG (pfx, "element-actions");
394
395     for (i = 0; i < nsignals; i++) {
396       gint n_params;
397       GType return_type;
398       const GType *param_types;
399       gint j;
400
401       query = g_new0 (GSignalQuery, 1);
402       g_signal_query (signals[i], query);
403
404       if ((k == 0 && !(query->signal_flags & G_SIGNAL_ACTION)) ||
405           (k == 1 && (query->signal_flags & G_SIGNAL_ACTION))) {
406         n_params = query->n_params;
407         return_type = query->return_type;
408         param_types = query->param_types;
409
410         PUT_START_TAG (pfx + 1, "signal");
411         PUT_ESCAPED (pfx + 2, "name", query->signal_name);
412         PUT_ESCAPED (pfx + 2, "return-type", g_type_name (return_type));
413         PUT_ESCAPED (pfx + 2, "object-type",
414             g_type_name (G_OBJECT_TYPE (element)));
415
416         PUT_START_TAG (pfx + 2, "params");
417         for (j = 0; j < n_params; j++) {
418           PUT_ESCAPED (pfx + 3, "type", g_type_name (param_types[j]));
419         }
420
421         PUT_END_TAG (pfx + 2, "params");
422
423         PUT_END_TAG (pfx + 1, "signal");
424
425         counted++;
426       }
427
428       g_free (query);
429     }
430     if (k == 0)
431       PUT_END_TAG (pfx, "element-signals");
432     else
433       PUT_END_TAG (pfx, "element-actions");
434   }
435 }
436
437 static gint
438 print_element_info (GstElementFactory * factory)
439 {
440   GstElement *element;
441   GstObjectClass *gstobject_class;
442   GstElementClass *gstelement_class;
443   GList *pads;
444   GstPad *pad;
445   GstStaticPadTemplate *padtemplate;
446   gint maxlevel = 0;
447
448   element = gst_element_factory_create (factory, "element");
449   if (!element) {
450     g_print ("couldn't construct element for some reason\n");
451     return -1;
452   }
453   PUT_START_TAG (0, "element");
454   PUT_ESCAPED (1, "name", GST_PLUGIN_FEATURE_NAME (factory));
455
456   gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
457   gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
458
459   PUT_START_TAG (1, "details");
460   PUT_ESCAPED (2, "long-name", factory->details.longname);
461   PUT_ESCAPED (2, "class", factory->details.klass);
462   PUT_ESCAPED (2, "description", factory->details.description);
463   PUT_ESCAPED (2, "authors", factory->details.author);
464   PUT_END_TAG (1, "details");
465
466   output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
467
468   PUT_START_TAG (1, "pad-templates");
469   if (factory->numpadtemplates) {
470     pads = factory->staticpadtemplates;
471     while (pads) {
472       padtemplate = (GstStaticPadTemplate *) (pads->data);
473       pads = g_list_next (pads);
474
475       PUT_START_TAG (2, "pad-template");
476       PUT_ESCAPED (3, "name", padtemplate->name_template);
477
478       if (padtemplate->direction == GST_PAD_SRC)
479         PUT_ESCAPED (3, "direction", "src");
480       else if (padtemplate->direction == GST_PAD_SINK)
481         PUT_ESCAPED (3, "direction", "sink");
482       else
483         PUT_ESCAPED (3, "direction", "unknown");
484
485       if (padtemplate->presence == GST_PAD_ALWAYS)
486         PUT_ESCAPED (3, "presence", "always");
487       else if (padtemplate->presence == GST_PAD_SOMETIMES)
488         PUT_ESCAPED (3, "presence", "sometimes");
489       else if (padtemplate->presence == GST_PAD_REQUEST) {
490         PUT_ESCAPED (3, "presence", "request");
491         PUT_ESCAPED (3, "request-function",
492             GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad));
493       } else
494         PUT_ESCAPED (3, "presence", "unknown");
495
496       if (padtemplate->static_caps.string) {
497         print_caps (gst_static_caps_get (&padtemplate->static_caps), 3);
498       }
499       PUT_END_TAG (2, "pad-template");
500     }
501   }
502   PUT_END_TAG (1, "pad-templates");
503
504   PUT_START_TAG (1, "element-flags");
505   PUT_END_TAG (1, "element-flags");
506
507   if (GST_IS_BIN (element)) {
508     PUT_START_TAG (1, "bin-flags");
509
510     PUT_END_TAG (1, "bin-flags");
511   }
512
513
514   PUT_START_TAG (1, "element-implementation");
515
516   PUT_STRING (2, "<state-change function=\"%s\"/>",
517       GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state));
518
519 #ifndef GST_DISABLE_LOADSAVE
520   PUT_STRING (2, "<save function=\"%s\"/>",
521       GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself));
522   PUT_STRING (2, "<load function=\"%s\"/>",
523       GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself));
524 #endif
525   PUT_END_TAG (1, "element-implementation");
526
527   PUT_START_TAG (1, "clocking-interaction");
528   if (gst_element_requires_clock (element)) {
529     PUT_STRING (2, "<requires-clock/>");
530   }
531   if (gst_element_provides_clock (element)) {
532     GstClock *clock;
533
534     clock = gst_element_get_clock (element);
535     if (clock)
536       PUT_STRING (2, "<provides-clock name=\"%s\"/>", GST_OBJECT_NAME (clock));
537   }
538   PUT_END_TAG (1, "clocking-interaction");
539
540   if (gst_element_is_indexable (element)) {
541     PUT_STRING (1, "<indexing-capabilities/>");
542   }
543
544   PUT_START_TAG (1, "pads");
545   if (element->numpads) {
546     const GList *pads;
547
548     pads = element->pads;
549     while (pads) {
550       pad = GST_PAD (pads->data);
551       pads = g_list_next (pads);
552
553       PUT_START_TAG (2, "pad");
554       PUT_ESCAPED (3, "name", gst_pad_get_name (pad));
555
556       if (gst_pad_get_direction (pad) == GST_PAD_SRC)
557         PUT_ESCAPED (3, "direction", "src");
558       else if (gst_pad_get_direction (pad) == GST_PAD_SINK)
559         PUT_ESCAPED (3, "direction", "sink");
560       else
561         PUT_ESCAPED (3, "direction", "unknown");
562
563       if (pad->padtemplate)
564         PUT_ESCAPED (3, "template", pad->padtemplate->name_template);
565
566       PUT_START_TAG (3, "implementation");
567       if (pad->chainfunc)
568         PUT_STRING (4, "<chain-based function=\"%s\"/>",
569             GST_DEBUG_FUNCPTR_NAME (pad->chainfunc));
570       if (pad->getrangefunc)
571         PUT_STRING (4, "<get-range-based function=\"%s\"/>",
572             GST_DEBUG_FUNCPTR_NAME (pad->getrangefunc));
573       if (pad->eventfunc != gst_pad_event_default)
574         PUT_STRING (4, "<event-function function=\"%s\"/>",
575             GST_DEBUG_FUNCPTR_NAME (pad->eventfunc));
576       if (pad->queryfunc != gst_pad_query_default)
577         PUT_STRING (4, "<query-function function=\"%s\"/>",
578             GST_DEBUG_FUNCPTR_NAME (pad->queryfunc));
579       if (pad->querytypefunc != gst_pad_get_query_types_default) {
580         PUT_STRING (4, "<query-type-func function=\"%s\">",
581             GST_DEBUG_FUNCPTR_NAME (pad->querytypefunc));
582         print_query_types (gst_pad_get_query_types (pad), 5);
583         PUT_END_TAG (4, "query-type-func");
584       }
585
586       if (pad->iterintlinkfunc != gst_pad_iterate_internal_links_default)
587         PUT_STRING (4, "<iterintlink-function function=\"%s\"/>",
588             GST_DEBUG_FUNCPTR_NAME (pad->iterintlinkfunc));
589
590       if (pad->bufferallocfunc)
591         PUT_STRING (4, "<bufferalloc-function function=\"%s\"/>",
592             GST_DEBUG_FUNCPTR_NAME (pad->bufferallocfunc));
593       PUT_END_TAG (3, "implementation");
594
595       if (pad->caps) {
596         print_caps (pad->caps, 3);
597       }
598       PUT_END_TAG (2, "pad");
599     }
600   }
601   PUT_END_TAG (1, "pads");
602
603   print_element_properties (element, 1);
604   print_element_signals (element, 1);
605
606   /* for compound elements */
607   /* FIXME: gst_bin_get_list does not exist anymore
608      if (GST_IS_BIN (element)) {
609      GList *children;
610      GstElement *child;
611      PUT_START_TAG (1, "children");
612      children = (GList *) gst_bin_get_list (GST_BIN (element));
613      while (children) {
614      child = GST_ELEMENT (children->data);
615      children = g_list_next (children);
616
617      PUT_ESCAPED (2, "child", GST_ELEMENT_NAME (child));
618      }
619      PUT_END_TAG (1, "children");
620      }
621    */
622   PUT_END_TAG (0, "element");
623
624   return 0;
625 }
626
627 int
628 main (int argc, char *argv[])
629 {
630   GstElementFactory *factory;
631   GOptionEntry options[] = {
632     GST_TOOLS_GOPTION_VERSION,
633     {NULL}
634   };
635   GOptionContext *ctx;
636   GError *err = NULL;
637
638   setlocale (LC_ALL, "");
639
640   g_thread_init (NULL);
641
642   gst_tools_set_prgname ("gst-xmlinspect");
643
644   ctx = g_option_context_new ("[ELEMENT-NAME]");
645   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
646   g_option_context_add_group (ctx, gst_init_get_option_group ());
647   if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
648     g_print ("Error initializing: %s\n", err->message);
649     exit (1);
650   }
651   g_option_context_free (ctx);
652
653   gst_tools_print_version ("gst-xmlinspect");
654
655   /* if no arguments, print out all elements */
656   if (argc == 1) {
657     GList *features, *f;
658
659     features = gst_registry_get_feature_list (gst_registry_get_default (),
660         GST_TYPE_ELEMENT_FACTORY);
661
662     PUT_STRING (0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
663
664     for (f = features; f != NULL; f = f->next)
665       print_element_info (GST_ELEMENT_FACTORY (f->data));
666
667     gst_plugin_feature_list_free (features);
668     return 0;
669   }
670
671   /* else we try to get a factory */
672   factory = gst_element_factory_find (argv[1]);
673
674   /* if there's a factory, print out the info */
675   if (factory) {
676     PUT_STRING (0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
677     return print_element_info (factory);
678   }
679
680   /* otherwise, error out */
681   g_printerr ("no such element '%s'\n", argv[1]);
682   return -1;
683 }