2 #include <gst/control/control.h>
6 print_prop (GstPropsEntry *prop, gboolean showname, gchar *pfx)
11 printf("%s%s: ", pfx, gst_props_entry_get_name (prop));
15 type = gst_props_entry_get_type (prop);
18 case GST_PROPS_INT_TYPE:
21 gst_props_entry_get_int (prop, &val);
22 printf("Integer: %d\n", val);
25 case GST_PROPS_INT_RANGE_TYPE:
28 gst_props_entry_get_int_range (prop, &min, &max);
29 printf("Integer range: %d - %d\n", min, max);
32 case GST_PROPS_FLOAT_TYPE:
35 gst_props_entry_get_float (prop, &val);
36 printf("Float: %f\n", val);
39 case GST_PROPS_FLOAT_RANGE_TYPE:
42 gst_props_entry_get_float_range (prop, &min, &max);
43 printf("Float range: %f - %f\n", min, max);
46 case GST_PROPS_BOOL_TYPE:
49 gst_props_entry_get_boolean (prop, &val);
50 printf("Boolean: %s\n", val ? "TRUE" : "FALSE");
53 case GST_PROPS_STRING_TYPE:
56 gst_props_entry_get_string (prop, &val);
57 printf("String: %s\n", val);
60 case GST_PROPS_FOURCC_TYPE:
63 gst_props_entry_get_fourcc_int (prop, &val);
64 printf("FourCC: '%c%c%c%c'\n",
66 (gchar)((val >> 8) & 0xff),
67 (gchar)((val >> 16) & 0xff),
68 (gchar)((val >> 24) & 0xff));
71 case GST_PROPS_LIST_TYPE:
76 gst_props_entry_get_list (prop, &list);
78 longprefix = g_strdup_printf ("%s ", pfx);
80 GstPropsEntry *listentry;
82 listentry = (GstPropsEntry*) (list->data);
83 print_prop (listentry, FALSE, longprefix);
85 list = g_list_next (list);
91 printf("unknown props %d\n", type);
96 print_props (GstProps *properties, gchar *pfx)
101 props = properties->properties;
103 prop = (GstPropsEntry*)(props->data);
104 props = g_list_next(props);
106 print_prop(prop,TRUE,pfx);
111 output_hierarchy (GType type, gint level, gint *maxlevel)
116 parent = g_type_parent (type);
118 *maxlevel = *maxlevel + 1;
122 output_hierarchy (parent, level, maxlevel);
124 for (i=1; i<*maxlevel-level; i++)
129 g_print ("%s\n", g_type_name (type));
136 print_element_properties (GstElement *element)
138 GParamSpec **property_specs;
139 gint num_properties,i;
141 property_specs = g_object_class_list_properties
142 (G_OBJECT_GET_CLASS (element), &num_properties);
143 printf("\nElement Arguments:\n");
145 for (i = 0; i < num_properties; i++) {
146 GValue value = { 0, };
147 GParamSpec *param = property_specs[i];
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);
154 printf(" %-20.20s: %s\n", g_param_spec_get_name (param),
155 g_param_spec_get_blurb (param));
157 switch (G_VALUE_TYPE (&value)) {
159 printf ("%-23.23s String (Default \"%s\")", "", g_value_get_string (&value));
162 printf ("%-23.23s Boolean (Default %s)", "", (g_value_get_boolean (&value) ? "true" : "false"));
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));
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));
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));
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));
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));
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));
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);
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);
225 if (param->value_type == GST_TYPE_FILENAME)
227 else if (G_IS_PARAM_SPEC_ENUM (param)) {
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;
236 while (values[j].value_name) {
237 printf("\n%-23.23s (%d): \t%s", "", values[j].value, values[j].value_nick);
240 /* g_type_class_unref (ec); */
243 printf("unknown type %ld \"%s\"", param->value_type, g_type_name(param->value_type));
248 if (num_properties == 0)
253 print_element_info (GstElementFactory *factory)
256 GstObjectClass *gstobject_class;
257 GstElementClass *gstelement_class;
262 GstPadTemplate *padtemplate;
268 element = gst_element_factory_create(factory,"element");
270 g_print ("couldn't construct element for some reason\n");
274 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
275 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
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);
286 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
288 printf("Pad Templates:\n");
289 if (factory->numpadtemplates) {
290 pads = factory->padtemplates;
292 padtemplate = (GstPadTemplate*)(pads->data);
293 pads = g_list_next(pads);
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);
300 printf(" UNKNOWN!!! template: '%s'\n",padtemplate->name_template);
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));
312 printf(" Availability: UNKNOWN!!!\n");
314 if (padtemplate->caps) {
315 printf(" Capabilities:\n");
316 caps = padtemplate->caps;
320 printf(" '%s':\n",caps->name);
322 type = gst_type_find_by_id (caps->id);
324 printf(" MIME type: '%s':\n",type->mime);
326 printf(" MIME type: 'unknown/unknown':\n");
328 if (caps->properties)
329 print_props(caps->properties," ");
342 printf("\nElement Flags:\n");
343 if (GST_FLAG_IS_SET(element,GST_ELEMENT_COMPLEX)) {
344 printf(" GST_ELEMENT_COMPLEX\n");
347 if (GST_FLAG_IS_SET(element,GST_ELEMENT_DECOUPLED)) {
348 printf(" GST_ELEMENT_DECOUPLED\n");
351 if (GST_FLAG_IS_SET(element,GST_ELEMENT_THREAD_SUGGESTED)) {
352 printf(" GST_ELEMENT_THREADSUGGESTED\n");
355 if (GST_FLAG_IS_SET(element,GST_ELEMENT_NO_SEEK)) {
356 printf(" GST_ELEMENT_NO_SEEK\n");
360 printf(" no flags set\n");
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");
368 if (GST_FLAG_IS_SET(element,GST_BIN_SELF_SCHEDULABLE)) {
369 printf(" GST_BIN_SELF_SCHEDULABLE\n");
372 if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_PREFER_COTHREADS)) {
373 printf(" GST_BIN_FLAG_PREFER_COTHREADS\n");
377 printf(" no flags set\n");
382 printf("\nElement Implementation:\n");
384 if (element->loopfunc)
385 printf(" loopfunc()-based element: %s\n",GST_DEBUG_FUNCPTR_NAME(element->loopfunc));
387 printf(" No loopfunc(), must be chain-based or not configured yet\n");
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));
400 printf("\nClocking Interaction:\n");
401 if (element->setclockfunc) {
402 printf(" element requires a clock\n");
405 if (element->getclockfunc) {
408 clock = gst_element_get_clock (element);
409 printf(" element provides a clock: %s\n", GST_OBJECT_NAME(clock));
418 if (element->numpads) {
419 pads = gst_element_get_pad_list(element);
421 pad = GST_PAD(pads->data);
422 pads = g_list_next(pads);
423 realpad = GST_PAD_REALIZE(pad);
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));
430 printf(" UNKNOWN!!!: '%s'\n",gst_pad_get_name(pad));
432 if (GST_IS_GHOST_PAD(pad))
433 printf(", ghost of real pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
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));
443 if (pad->padtemplate)
444 printf(" Pad Template: '%s'\n",pad->padtemplate->name_template);
447 printf(" Capabilities:\n");
448 caps = realpad->caps;
452 printf(" '%s':\n",caps->name);
454 type = gst_type_find_by_id (caps->id);
456 printf(" MIME type: '%s':\n",type->mime);
458 printf(" MIME type: 'unknown/unknown':\n");
460 if (caps->properties)
461 print_props(caps->properties," ");
470 print_element_properties (element);
472 /* Dynamic Parameters block */
474 GstDParamManager* dpman;
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]));
484 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
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);
492 printf("Integer (Default %d, Range %d -> %d)",
493 ((GParamSpecInt*)specs[x])->default_value,
494 ((GParamSpecInt*)specs[x])->minimum,
495 ((GParamSpecInt*)specs[x])->maximum);
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);
504 default: printf("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
522 printf("\nElement Signals:\n");
524 signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
526 for (i=0; i<nsignals; i++) {
529 const GType *param_types;
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;
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)));
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);
544 printf (" \t\t\t\tgpointer user_data);\n");
548 if (nsignals == 0) g_print (" none\n");
552 /* for compound elements */
553 if (GST_IS_BIN(element)) {
554 printf("\nChildren:\n");
555 children = (GList *) gst_bin_get_list(GST_BIN(element));
560 child = GST_ELEMENT (children->data);
561 children = g_list_next (children);
563 g_print(" %s\n",GST_ELEMENT_NAME(child));
572 print_element_list (void)
576 plugins = gst_registry_pool_plugin_list();
581 plugin = (GstPlugin*)(plugins->data);
582 plugins = g_list_next (plugins);
584 features = gst_plugin_get_feature_list (plugin);
586 GstPluginFeature *feature;
588 feature = GST_PLUGIN_FEATURE (features->data);
590 if (GST_IS_ELEMENT_FACTORY (feature)) {
591 GstElementFactory *factory;
593 factory = GST_ELEMENT_FACTORY (feature);
594 printf("%s: %s: %s\n",plugin->name, GST_PLUGIN_FEATURE_NAME (factory) ,factory->details->longname);
596 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
597 GstAutoplugFactory *factory;
599 factory = GST_AUTOPLUG_FACTORY (feature);
600 printf("%s: %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
602 else if (GST_IS_TYPE_FACTORY (feature)) {
603 GstTypeFactory *factory;
605 factory = GST_TYPE_FACTORY (feature);
606 printf("%s type: %s: %s\n", plugin->name, factory->mime, factory->exts);
608 if (factory->typefindfunc)
609 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
611 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
612 GstSchedulerFactory *factory;
614 factory = GST_SCHEDULER_FACTORY (feature);
615 printf("%s: %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
618 printf("%s: %s (%s)\n", plugin->name, GST_PLUGIN_FEATURE_NAME (feature),
619 g_type_name (G_OBJECT_TYPE (feature)));
622 features = g_list_next (features);
628 print_plugin_info (GstPlugin *plugin)
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);
638 features = gst_plugin_get_feature_list (plugin);
641 GstPluginFeature *feature;
643 feature = GST_PLUGIN_FEATURE (features->data);
645 if (GST_IS_ELEMENT_FACTORY (feature)) {
646 GstElementFactory *factory;
648 factory = GST_ELEMENT_FACTORY (feature);
649 printf(" %s: %s\n", GST_OBJECT_NAME (factory) ,factory->details->longname);
651 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
652 GstAutoplugFactory *factory;
654 factory = GST_AUTOPLUG_FACTORY (feature);
655 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
657 else if (GST_IS_TYPE_FACTORY (feature)) {
658 GstTypeFactory *factory;
660 factory = GST_TYPE_FACTORY (feature);
661 printf(" %s: %s\n", factory->mime, factory->exts);
663 if (factory->typefindfunc)
664 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
666 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
667 GstSchedulerFactory *factory;
669 factory = GST_SCHEDULER_FACTORY (feature);
670 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
673 printf(" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
674 g_type_name (G_OBJECT_TYPE (feature)));
678 features = g_list_next (features);
685 main (int argc, char *argv[])
687 GstElementFactory *factory;
691 gst_init(&argc,&argv);
692 gst_control_init(&argc,&argv);
694 /* if no arguments, print out list of elements */
696 print_element_list();
698 /* else we try to get a factory */
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]);
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]);
712 /* if there's a factory, print out the info */
714 return print_element_info(factory);
717 so = strstr(argv[1],".so");
721 /* otherwise assume it's a plugin */
722 plugin = gst_registry_pool_find_plugin (argv[1]);
724 /* if there is such a plugin, print out info */
727 print_plugin_info(plugin);
730 printf("no such element or plugin '%s'\n",argv[1]);