output cleanups
[platform/upstream/gstreamer.git] / tools / gst-inspect.c
1 #include <gst/gst.h>
2 #include <gst/control/control.h>
3 #include <string.h>
4
5 static void 
6 print_prop (GstPropsEntry *prop, gboolean showname, gchar *pfx) 
7 {
8   GstPropsType type;
9
10   if (showname)
11     printf("%s%s: ", pfx, gst_props_entry_get_name (prop));
12   else
13     printf(pfx);
14
15   type = gst_props_entry_get_type (prop);
16
17   switch (type) {
18     case GST_PROPS_INT_TYPE:
19     {
20       gint val;
21       gst_props_entry_get_int (prop, &val);
22       printf("Integer: %d\n", val);
23       break;
24     }
25     case GST_PROPS_INT_RANGE_TYPE:
26     {
27       gint min, max;
28       gst_props_entry_get_int_range (prop, &min, &max);
29       printf("Integer range: %d - %d\n", min, max);
30       break;
31     }
32     case GST_PROPS_FLOAT_TYPE:
33     {
34       gfloat val;
35       gst_props_entry_get_float (prop, &val);
36       printf("Float: %f\n", val);
37       break;
38     }
39     case GST_PROPS_FLOAT_RANGE_TYPE:
40     {
41       gfloat min, max;
42       gst_props_entry_get_float_range (prop, &min, &max);
43       printf("Float range: %f - %f\n", min, max);
44       break;
45     }
46     case GST_PROPS_BOOL_TYPE:
47     {
48       gboolean val;
49       gst_props_entry_get_boolean (prop, &val);
50       printf("Boolean: %s\n", val ? "TRUE" : "FALSE");
51       break;
52     }
53     case GST_PROPS_STRING_TYPE:
54     {
55       const gchar *val;
56       gst_props_entry_get_string (prop, &val);
57       printf("String: %s\n", val);
58       break;
59     }
60     case GST_PROPS_FOURCC_TYPE:
61     {
62       guint32 val;
63       gst_props_entry_get_fourcc_int (prop, &val);
64       printf("FourCC: '%c%c%c%c'\n",
65              (gchar)( val        & 0xff), 
66              (gchar)((val >> 8)  & 0xff),
67              (gchar)((val >> 16) & 0xff), 
68              (gchar)((val >> 24) & 0xff));
69       break;
70     }
71     case GST_PROPS_LIST_TYPE:
72     {
73       const GList *list;
74       gchar *longprefix;
75
76       gst_props_entry_get_list (prop, &list);
77       printf ("List:\n");
78       longprefix = g_strdup_printf ("%s  ", pfx);
79       while (list) {
80         GstPropsEntry *listentry;
81
82         listentry = (GstPropsEntry*) (list->data);
83         print_prop (listentry, FALSE, longprefix);
84
85         list = g_list_next (list);
86       }
87       g_free (longprefix);
88       break;
89     }
90     default:
91       printf("unknown props %d\n", type);
92   }
93 }
94
95 static void 
96 print_props (GstProps *properties, gchar *pfx) 
97 {
98   GList *props;
99   GstPropsEntry *prop;
100
101   props = properties->properties;
102   while (props) {
103     prop = (GstPropsEntry*)(props->data);
104     props = g_list_next(props);
105
106     print_prop(prop,TRUE,pfx);
107   }
108 }
109
110 static void
111 output_hierarchy (GType type, gint level, gint *maxlevel)
112 {
113   GType parent;
114   gint i;
115
116   parent = g_type_parent (type);
117
118   *maxlevel = *maxlevel + 1;
119   level++;
120
121   if (parent)
122     output_hierarchy (parent, level, maxlevel);
123   
124   for (i=1; i<*maxlevel-level; i++)
125    g_print ("      ");
126   if (*maxlevel-level)
127     g_print (" +----");
128
129   g_print ("%s\n", g_type_name (type));
130           
131   if (level == 1)
132     g_print ("\n");
133 }
134
135 static void
136 print_element_properties (GstElement *element) 
137 {
138   GParamSpec **property_specs;
139   gint num_properties,i;
140
141   property_specs = g_object_class_list_properties 
142                      (G_OBJECT_GET_CLASS (element), &num_properties);
143   printf("\nElement Arguments:\n");
144
145   for (i = 0; i < num_properties; i++) {
146     GValue value = { 0, };
147     GParamSpec *param = property_specs[i];
148
149     if (param->flags & G_PARAM_READABLE) {
150       g_value_init (&value, param->value_type);
151       g_object_get_property (G_OBJECT (element), param->name, &value);
152     }
153
154     printf("  %-20.20s: %s\n", g_param_spec_get_name (param),
155                                g_param_spec_get_blurb (param));
156
157     switch (G_VALUE_TYPE (&value)) {
158       case G_TYPE_STRING: 
159         printf ("%-23.23s String (Default \"%s\")", "", g_value_get_string (&value));
160         break;
161       case G_TYPE_BOOLEAN: 
162         printf ("%-23.23s Boolean (Default %s)", "", (g_value_get_boolean (&value) ? "true" : "false"));
163         break;
164       case G_TYPE_ULONG: 
165       {
166         GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
167         printf("%-23.23s Unsigned Long. Range: %lu - %lu (Default %lu)", "", 
168                         pulong->minimum, pulong->maximum, g_value_get_ulong (&value));
169         break;
170       }
171       case G_TYPE_LONG: 
172       {
173         GParamSpecLong *plong = G_PARAM_SPEC_LONG (param);
174         printf("%-23.23s Long. Range: %ld - %ld (Default %ld)", "", 
175                         plong->minimum, plong->maximum, g_value_get_long (&value));
176         break;
177       }
178       case G_TYPE_UINT: 
179       {
180         GParamSpecUInt *puint = G_PARAM_SPEC_UINT (param);
181         printf("%-23.23s Unsigned Integer. Range: %u - %u (Default %u)", "", 
182                         puint->minimum, puint->maximum, g_value_get_uint (&value));
183         break;
184       }
185       case G_TYPE_INT: 
186       {
187         GParamSpecInt *pint = G_PARAM_SPEC_INT (param);
188         printf("%-23.23s Integer. Range: %d - %d (Default %d)", "", 
189                         pint->minimum, pint->maximum, g_value_get_int (&value));
190         break;
191       }
192       case G_TYPE_UINT64: 
193       {
194         GParamSpecUInt64 *puint64 = G_PARAM_SPEC_UINT64 (param);
195         printf("%-23.23s Unsigned Integer64. Range: %llu - %llu (Default %llu)", "", 
196                         puint64->minimum, puint64->maximum, g_value_get_uint64 (&value));
197         break;
198       }
199       case G_TYPE_INT64: 
200       {
201         GParamSpecInt64 *pint64 = G_PARAM_SPEC_INT64 (param);
202         printf("%-23.23s Integer64. Range: %lld - %lld (Default %lld)", "", 
203                         pint64->minimum, pint64->maximum, g_value_get_int64 (&value));
204         break;
205       }
206       case G_TYPE_FLOAT: 
207       {
208         GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
209         printf("%-23.23s Float. Default: %-8.8s %15.7g\n", "", "", 
210                 g_value_get_float (&value));
211         printf("%-23.23s Range: %15.7g - %15.7g", "", 
212                pfloat->minimum, pfloat->maximum);
213         break;
214       }
215       case G_TYPE_DOUBLE: 
216       {
217         GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
218         printf("%-23.23s Double. Default: %-8.8s %15.7g\n", "", "", 
219                 g_value_get_double (&value));
220         printf("%-23.23s Range: %15.7g - %15.7g", "", 
221                pdouble->minimum, pdouble->maximum);
222         break;
223       }
224       default:
225         if (param->value_type == GST_TYPE_FILENAME)
226           printf("Filename");
227         else if (G_IS_PARAM_SPEC_ENUM (param)) {
228           GEnumValue *values;
229           guint j = 0;
230
231           printf("%-23.23s Enum \"%s\" (default %d)", "", 
232                           g_type_name (G_VALUE_TYPE (&value)),
233                           g_value_get_enum (&value));
234           values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
235
236           while (values[j].value_name) {
237             printf("\n%-23.23s    (%d): \t%s", "", values[j].value, values[j].value_nick);
238             j++; 
239           }
240           /* g_type_class_unref (ec); */
241         }
242         else
243           printf("unknown type %ld \"%s\"", param->value_type, g_type_name(param->value_type));
244         break;
245     }
246     printf("\n");
247   }
248   if (num_properties == 0) 
249     g_print ("  none\n");
250 }
251
252 static gint
253 print_element_info (GstElementFactory *factory)
254 {
255   GstElement *element;
256   GstObjectClass *gstobject_class;
257   GstElementClass *gstelement_class;
258   GList *pads;
259   GstCaps *caps;
260   GstPad *pad;
261   GstRealPad *realpad;
262   GstPadTemplate *padtemplate;
263   GList *children;
264   GstElement *child;
265   gboolean have_flags;
266   gint maxlevel = 0;
267
268   element = gst_element_factory_create(factory,"element");
269   if (!element) {
270     g_print ("couldn't construct element for some reason\n");
271     return -1;
272   }
273
274   gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
275   gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
276
277   printf("Factory Details:\n");
278   printf("  Long name:\t%s\n",factory->details->longname);
279   printf("  Class:\t%s\n",factory->details->klass);
280   printf("  Description:\t%s\n",factory->details->description);
281   printf("  Version:\t%s\n",factory->details->version);
282   printf("  Author(s):\t%s\n",factory->details->author);
283   printf("  Copyright:\t%s\n",factory->details->copyright);
284   printf("\n");
285
286   output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
287
288   printf("Pad Templates:\n");
289   if (factory->numpadtemplates) {
290     pads = factory->padtemplates;
291     while (pads) {
292       padtemplate = (GstPadTemplate*)(pads->data);
293       pads = g_list_next(pads);
294
295       if (padtemplate->direction == GST_PAD_SRC)
296         printf("  SRC template: '%s'\n",padtemplate->name_template);
297       else if (padtemplate->direction == GST_PAD_SINK)
298         printf("  SINK template: '%s'\n",padtemplate->name_template);
299       else
300         printf("  UNKNOWN!!! template: '%s'\n",padtemplate->name_template);
301
302       if (padtemplate->presence == GST_PAD_ALWAYS)
303         printf("    Availability: Always\n");
304       else if (padtemplate->presence == GST_PAD_SOMETIMES)
305         printf("    Availability: Sometimes\n");
306       else if (padtemplate->presence == GST_PAD_REQUEST) {
307         printf("    Availability: On request\n");
308         printf("      Has request_new_pad() function: %s\n",
309              GST_DEBUG_FUNCPTR_NAME(gstelement_class->request_new_pad));
310       }
311       else
312         printf("    Availability: UNKNOWN!!!\n");
313
314       if (padtemplate->caps) {
315         printf("    Capabilities:\n");
316         caps = padtemplate->caps;
317         while (caps) {
318           GstType *type;
319
320           printf("      '%s':\n",caps->name);
321
322           type = gst_type_find_by_id (caps->id);
323           if (type) 
324             printf("        MIME type: '%s':\n",type->mime);
325           else
326             printf("        MIME type: 'unknown/unknown':\n");
327
328           if (caps->properties)
329             print_props(caps->properties,"        ");
330
331           caps = caps->next;
332         }
333       }
334
335       printf("\n");
336     }
337   } else
338     printf("  none\n");
339
340   have_flags = FALSE;
341
342   printf("\nElement Flags:\n");
343   if (GST_FLAG_IS_SET(element,GST_ELEMENT_COMPLEX)) {
344     printf("  GST_ELEMENT_COMPLEX\n");
345     have_flags = TRUE;
346   }
347   if (GST_FLAG_IS_SET(element,GST_ELEMENT_DECOUPLED)) {
348     printf("  GST_ELEMENT_DECOUPLED\n");
349     have_flags = TRUE;
350   }
351   if (GST_FLAG_IS_SET(element,GST_ELEMENT_THREAD_SUGGESTED)) {
352     printf("  GST_ELEMENT_THREADSUGGESTED\n");
353     have_flags = TRUE;
354   }
355   if (GST_FLAG_IS_SET(element,GST_ELEMENT_NO_SEEK)) {
356     printf("  GST_ELEMENT_NO_SEEK\n");
357     have_flags = TRUE;
358   }
359   if (!have_flags)
360     printf("  no flags set\n");
361
362   if (GST_IS_BIN (element)) {
363     printf("\nBin Flags:\n");
364     if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
365       printf("  GST_BIN_FLAG_MANAGER\n");
366       have_flags = TRUE;
367     }
368     if (GST_FLAG_IS_SET(element,GST_BIN_SELF_SCHEDULABLE)) {
369       printf("  GST_BIN_SELF_SCHEDULABLE\n");
370       have_flags = TRUE;
371     }
372     if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_PREFER_COTHREADS)) {
373       printf("  GST_BIN_FLAG_PREFER_COTHREADS\n");
374       have_flags = TRUE;
375     }
376     if (!have_flags)
377       printf("  no flags set\n");
378   }
379
380
381
382   printf("\nElement Implementation:\n");
383
384   if (element->loopfunc)
385     printf("  loopfunc()-based element: %s\n",GST_DEBUG_FUNCPTR_NAME(element->loopfunc));
386   else
387     printf("  No loopfunc(), must be chain-based or not configured yet\n");
388
389   printf("  Has change_state() function: %s\n",
390          GST_DEBUG_FUNCPTR_NAME(gstelement_class->change_state));
391 #ifndef GST_DISABLE_LOADSAVE
392   printf("  Has custom save_thyself() function: %s\n",
393          GST_DEBUG_FUNCPTR_NAME(gstobject_class->save_thyself));
394   printf("  Has custom restore_thyself() function: %s\n",
395          GST_DEBUG_FUNCPTR_NAME(gstobject_class->restore_thyself));
396 #endif
397
398   have_flags = FALSE;
399
400   printf("\nClocking Interaction:\n");
401   if (element->setclockfunc) {
402     printf("  element requires a clock\n");
403     have_flags = TRUE;
404   }
405   if (element->getclockfunc) {
406     GstClock *clock;
407
408     clock = gst_element_get_clock (element);
409     printf("  element provides a clock: %s\n", GST_OBJECT_NAME(clock));
410     have_flags = TRUE;
411   }
412   if (!have_flags) {
413     printf("  none\n");
414   }
415
416
417   printf("\nPads:\n");
418   if (element->numpads) {
419     pads = gst_element_get_pad_list(element);
420     while (pads) {
421       pad = GST_PAD(pads->data);
422       pads = g_list_next(pads);
423       realpad = GST_PAD_REALIZE(pad);
424
425       if (gst_pad_get_direction(pad) == GST_PAD_SRC)
426         printf("  SRC: '%s'",gst_pad_get_name(pad));
427       else if (gst_pad_get_direction(pad) == GST_PAD_SINK)
428         printf("  SINK: '%s'",gst_pad_get_name(pad));
429       else
430         printf("  UNKNOWN!!!: '%s'\n",gst_pad_get_name(pad));
431
432       if (GST_IS_GHOST_PAD(pad))
433         printf(", ghost of real pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
434       else
435         printf("\n");
436
437       printf("    Implementation:\n");
438       if (realpad->chainfunc)
439         printf("      Has chainfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->chainfunc));
440       if (realpad->getfunc)
441         printf("      Has getfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->getfunc));
442
443       if (pad->padtemplate)
444         printf("    Pad Template: '%s'\n",pad->padtemplate->name_template);
445
446       if (realpad->caps) {
447         printf("    Capabilities:\n");
448         caps = realpad->caps;
449         while (caps) {
450           GstType *type;
451
452           printf("      '%s':\n",caps->name);
453
454           type = gst_type_find_by_id (caps->id);
455           if (type) 
456             printf("        MIME type: '%s':\n",type->mime);
457           else
458             printf("        MIME type: 'unknown/unknown':\n");
459
460           if (caps->properties)
461             print_props(caps->properties,"        ");
462
463           caps = caps->next;
464         }
465       }
466     }
467   } else
468     printf("  none\n");
469
470   print_element_properties (element);
471
472   /* Dynamic Parameters block */
473   {
474     GstDParamManager* dpman;
475     GParamSpec** specs;
476     gint x;
477     
478     printf("\nDynamic Parameters:\n");
479     if((dpman = gst_dpman_get_manager (element))){
480       specs = gst_dpman_list_dparam_specs(dpman);
481       for (x=0; specs[x] != NULL; x++){
482         printf("  %-20.20s: ", g_param_spec_get_name (specs[x]));
483
484         switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
485           case G_TYPE_INT64: 
486             printf("64 Bit Integer (Default %lld, Range %lld -> %lld)", 
487             ((GParamSpecInt64*)specs[x])->default_value,
488             ((GParamSpecInt64*)specs[x])->minimum, 
489             ((GParamSpecInt64*)specs[x])->maximum);
490             break;
491           case G_TYPE_INT: 
492             printf("Integer (Default %d, Range %d -> %d)", 
493             ((GParamSpecInt*)specs[x])->default_value,
494             ((GParamSpecInt*)specs[x])->minimum, 
495             ((GParamSpecInt*)specs[x])->maximum);
496             break;
497           case G_TYPE_FLOAT: 
498             printf("Float. Default: %-8.8s %15.7g\n", "",
499               ((GParamSpecFloat*)specs[x])->default_value);
500             printf("%-23.23s Range: %15.7g - %15.7g", "", 
501               ((GParamSpecFloat*)specs[x])->minimum, 
502               ((GParamSpecFloat*)specs[x])->maximum);
503             break;
504         default: printf("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
505         }
506         printf("\n");
507       }
508       g_free(specs);
509     }
510     else {
511       g_print ("  none\n");
512     }
513   }
514
515   /* Signals Block */  
516   {
517     guint *signals;
518     guint nsignals;
519     gint i;
520     GSignalQuery *query;
521
522     printf("\nElement Signals:\n");
523     
524     signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
525
526     for (i=0; i<nsignals; i++) {
527       gint n_params;
528       GType return_type;
529       const GType *param_types;
530       gint j;
531       
532       query = g_new0(GSignalQuery,1);
533       g_signal_query (signals[i], query);
534       n_params = query->n_params;
535       return_type = query->return_type;
536       param_types = query->param_types;
537
538       printf ("  \"%s\" :\t %s user_function (%s* object, \n", query->signal_name, g_type_name (return_type),
539                       g_type_name (G_OBJECT_TYPE (element)));
540
541       for (j=0; j<n_params; j++) {
542         printf ("    \t\t\t\t%s arg%d,\n", g_type_name (param_types[j]), j);
543       }
544       printf ("    \t\t\t\tgpointer user_data);\n");
545
546       g_free (query);
547     }
548     if (nsignals == 0) g_print ("  none\n");
549   }
550   
551
552   /* for compound elements */
553   if (GST_IS_BIN(element)) {
554     printf("\nChildren:\n");
555     children = (GList *) gst_bin_get_list(GST_BIN(element));
556     if (!children) 
557       g_print ("  none\n");
558     else {
559       while (children) {
560         child = GST_ELEMENT (children->data);
561         children = g_list_next (children);
562
563         g_print("  %s\n",GST_ELEMENT_NAME(child));
564       }
565     }
566   }
567
568   return 0;
569 }
570
571 static void 
572 print_element_list (void) 
573 {
574   GList *plugins;
575
576   plugins = gst_registry_pool_plugin_list();
577   while (plugins) {
578     GList *features;
579     GstPlugin *plugin;
580     
581     plugin = (GstPlugin*)(plugins->data);
582     plugins = g_list_next (plugins);
583
584     features = gst_plugin_get_feature_list (plugin);
585     while (features) {
586       GstPluginFeature *feature;
587
588       feature = GST_PLUGIN_FEATURE (features->data);
589
590       if (GST_IS_ELEMENT_FACTORY (feature)) {
591         GstElementFactory *factory;
592
593         factory = GST_ELEMENT_FACTORY (feature);
594         printf("%s:  %s: %s\n",plugin->name, GST_PLUGIN_FEATURE_NAME (factory) ,factory->details->longname);
595       }
596       else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
597         GstAutoplugFactory *factory;
598
599         factory = GST_AUTOPLUG_FACTORY (feature);
600         printf("%s:  %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
601       }
602       else if (GST_IS_TYPE_FACTORY (feature)) {
603         GstTypeFactory *factory;
604
605         factory = GST_TYPE_FACTORY (feature);
606         printf("%s type:  %s: %s\n", plugin->name, factory->mime, factory->exts);
607
608         if (factory->typefindfunc)
609           printf("      Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
610       }
611       else if (GST_IS_SCHEDULER_FACTORY (feature)) {
612         GstSchedulerFactory *factory;
613
614         factory = GST_SCHEDULER_FACTORY (feature);
615         printf("%s:  %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
616       }
617       else {
618         printf("%s:  %s (%s)\n", plugin->name, GST_PLUGIN_FEATURE_NAME (feature), 
619                       g_type_name (G_OBJECT_TYPE (feature)));
620       }
621
622       features = g_list_next (features);
623     }
624   }
625 }
626
627 static void
628 print_plugin_info (GstPlugin *plugin)
629 {
630   GList *features;
631   
632   printf("Plugin Details:\n");
633   printf("  Name:\t\t%s\n",plugin->name);
634   printf("  Long Name:\t%s\n",plugin->longname);
635   printf("  Filename:\t%s\n",plugin->filename);
636   printf("\n");
637
638   features = gst_plugin_get_feature_list (plugin);
639
640   while (features) {
641     GstPluginFeature *feature;
642
643     feature = GST_PLUGIN_FEATURE (features->data);
644
645     if (GST_IS_ELEMENT_FACTORY (feature)) {
646       GstElementFactory *factory;
647
648       factory = GST_ELEMENT_FACTORY (feature);
649       printf("  %s: %s\n", GST_OBJECT_NAME (factory) ,factory->details->longname);
650     }
651     else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
652       GstAutoplugFactory *factory;
653
654       factory = GST_AUTOPLUG_FACTORY (feature);
655       printf("  %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
656     }
657     else if (GST_IS_TYPE_FACTORY (feature)) {
658       GstTypeFactory *factory;
659
660       factory = GST_TYPE_FACTORY (feature);
661       printf("  %s: %s\n", factory->mime, factory->exts);
662
663       if (factory->typefindfunc)
664         printf("      Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
665     }
666     else if (GST_IS_SCHEDULER_FACTORY (feature)) {
667       GstSchedulerFactory *factory;
668
669       factory = GST_SCHEDULER_FACTORY (feature);
670       printf("  %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
671     }
672     else {
673       printf("  %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)), 
674                       g_type_name (G_OBJECT_TYPE (feature)));
675     }
676
677
678     features = g_list_next (features);
679   }
680   printf("\n");
681 }
682
683
684 int 
685 main (int argc, char *argv[]) 
686 {
687   GstElementFactory *factory;
688   GstPlugin *plugin;
689   gchar *so;
690
691   gst_init(&argc,&argv);
692   gst_control_init(&argc,&argv);
693   
694   /* if no arguments, print out list of elements */
695   if (argc == 1) {
696     print_element_list();
697
698   /* else we try to get a factory */
699   } else {
700     /* first check for help */
701     if (strstr(argv[1],"-help")) {
702       printf("Usage: %s\t\t\tList all registered elements\n",argv[0]);
703       printf("       %s element-name\tShow element details\n",argv[0]);
704       printf("       %s plugin-name[.so]\tShow information about plugin\n",argv[0]);
705       return 0;
706     }
707
708     /* only search for a factory if there's not a '.so' */
709     if (! strstr(argv[1],".so")) {
710       factory = gst_element_factory_find (argv[1]);
711
712       /* if there's a factory, print out the info */
713       if (factory)
714         return print_element_info(factory);
715     } else {
716       /* strip the .so */
717       so = strstr(argv[1],".so");
718       so[0] = '\0';
719     }
720
721     /* otherwise assume it's a plugin */
722     plugin = gst_registry_pool_find_plugin (argv[1]);
723
724     /* if there is such a plugin, print out info */
725
726     if (plugin) {
727       print_plugin_info(plugin);
728
729     } else {
730       printf("no such element or plugin '%s'\n",argv[1]);
731       return -1;
732     }
733   }
734
735   return 0;
736 }