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(" %-40.40s: %s\n", g_param_spec_get_name (param),
155 g_param_spec_get_blurb (param));
157 switch (G_VALUE_TYPE (&value)) {
159 printf ("%-43.43s String (Default \"%s\")", "", g_value_get_string (&value));
162 printf ("%-43.43s Boolean (Default %s)", "", (g_value_get_boolean (&value) ? "true" : "false"));
166 GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (param);
167 printf("%-43.43s 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("%-43.43s 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("%-43.43s 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("%-43.43s 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("%-43.43s 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("%-43.43s 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("%-43.43s Float. Range: %f - %f (Default %f)", "",
210 pfloat->minimum, pfloat->maximum, g_value_get_float (&value));
215 GParamSpecDouble *pdouble = G_PARAM_SPEC_DOUBLE (param);
216 printf("%-43.43s Double. Range: %f - %f (Default %f)", "",
217 pdouble->minimum, pdouble->maximum, g_value_get_double (&value));
221 if (param->value_type == GST_TYPE_FILENAME)
223 else if (G_IS_PARAM_SPEC_ENUM (param)) {
227 printf("%-43.43s Enum \"%s\" (default %d)", "",
228 g_type_name (G_VALUE_TYPE (&value)),
229 g_value_get_enum (&value));
230 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
232 while (values[j].value_name) {
233 printf("\n%-43.43s (%d): \t%s", "", values[j].value, values[j].value_nick);
236 /* g_type_class_unref (ec); */
239 printf("unknown type %ld \"%s\"", param->value_type, g_type_name(param->value_type));
244 if (num_properties == 0)
249 print_element_info (GstElementFactory *factory)
252 GstObjectClass *gstobject_class;
253 GstElementClass *gstelement_class;
258 GstPadTemplate *padtemplate;
264 element = gst_element_factory_create(factory,"element");
266 g_print ("couldn't construct element for some reason\n");
270 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
271 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
273 printf("Factory Details:\n");
274 printf(" Long name:\t%s\n",factory->details->longname);
275 printf(" Class:\t%s\n",factory->details->klass);
276 printf(" Description:\t%s\n",factory->details->description);
277 printf(" Version:\t%s\n",factory->details->version);
278 printf(" Author(s):\t%s\n",factory->details->author);
279 printf(" Copyright:\t%s\n",factory->details->copyright);
282 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
284 printf("Pad Templates:\n");
285 if (factory->numpadtemplates) {
286 pads = factory->padtemplates;
288 padtemplate = (GstPadTemplate*)(pads->data);
289 pads = g_list_next(pads);
291 if (padtemplate->direction == GST_PAD_SRC)
292 printf(" SRC template: '%s'\n",padtemplate->name_template);
293 else if (padtemplate->direction == GST_PAD_SINK)
294 printf(" SINK template: '%s'\n",padtemplate->name_template);
296 printf(" UNKNOWN!!! template: '%s'\n",padtemplate->name_template);
298 if (padtemplate->presence == GST_PAD_ALWAYS)
299 printf(" Availability: Always\n");
300 else if (padtemplate->presence == GST_PAD_SOMETIMES)
301 printf(" Availability: Sometimes\n");
302 else if (padtemplate->presence == GST_PAD_REQUEST) {
303 printf(" Availability: On request\n");
304 printf(" Has request_new_pad() function: %s\n",
305 GST_DEBUG_FUNCPTR_NAME(gstelement_class->request_new_pad));
308 printf(" Availability: UNKNOWN!!!\n");
310 if (padtemplate->caps) {
311 printf(" Capabilities:\n");
312 caps = padtemplate->caps;
316 printf(" '%s':\n",caps->name);
318 type = gst_type_find_by_id (caps->id);
320 printf(" MIME type: '%s':\n",type->mime);
322 printf(" MIME type: 'unknown/unknown':\n");
324 if (caps->properties)
325 print_props(caps->properties," ");
338 printf("\nElement Flags:\n");
339 if (GST_FLAG_IS_SET(element,GST_ELEMENT_COMPLEX)) {
340 printf(" GST_ELEMENT_COMPLEX\n");
343 if (GST_FLAG_IS_SET(element,GST_ELEMENT_DECOUPLED)) {
344 printf(" GST_ELEMENT_DECOUPLED\n");
347 if (GST_FLAG_IS_SET(element,GST_ELEMENT_THREAD_SUGGESTED)) {
348 printf(" GST_ELEMENT_THREADSUGGESTED\n");
351 if (GST_FLAG_IS_SET(element,GST_ELEMENT_NO_SEEK)) {
352 printf(" GST_ELEMENT_NO_SEEK\n");
356 printf(" no flags set\n");
358 if (GST_IS_BIN (element)) {
359 printf("\nBin Flags:\n");
360 if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
361 printf(" GST_BIN_FLAG_MANAGER\n");
364 if (GST_FLAG_IS_SET(element,GST_BIN_SELF_SCHEDULABLE)) {
365 printf(" GST_BIN_SELF_SCHEDULABLE\n");
368 if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_PREFER_COTHREADS)) {
369 printf(" GST_BIN_FLAG_PREFER_COTHREADS\n");
373 printf(" no flags set\n");
378 printf("\nElement Implementation:\n");
380 if (element->loopfunc)
381 printf(" loopfunc()-based element: %s\n",GST_DEBUG_FUNCPTR_NAME(element->loopfunc));
383 printf(" No loopfunc(), must be chain-based or not configured yet\n");
385 printf(" Has change_state() function: %s\n",
386 GST_DEBUG_FUNCPTR_NAME(gstelement_class->change_state));
387 #ifndef GST_DISABLE_LOADSAVE
388 printf(" Has custom save_thyself() function: %s\n",
389 GST_DEBUG_FUNCPTR_NAME(gstobject_class->save_thyself));
390 printf(" Has custom restore_thyself() function: %s\n",
391 GST_DEBUG_FUNCPTR_NAME(gstobject_class->restore_thyself));
396 printf("\nClocking Interaction:\n");
397 if (element->setclockfunc) {
398 printf(" element requires a clock\n");
401 if (element->getclockfunc) {
404 clock = gst_element_get_clock (element);
405 printf(" element provides a clock: %s\n", GST_OBJECT_NAME(clock));
414 if (element->numpads) {
415 pads = gst_element_get_pad_list(element);
417 pad = GST_PAD(pads->data);
418 pads = g_list_next(pads);
419 realpad = GST_PAD_REALIZE(pad);
421 if (gst_pad_get_direction(pad) == GST_PAD_SRC)
422 printf(" SRC: '%s'",gst_pad_get_name(pad));
423 else if (gst_pad_get_direction(pad) == GST_PAD_SINK)
424 printf(" SINK: '%s'",gst_pad_get_name(pad));
426 printf(" UNKNOWN!!!: '%s'\n",gst_pad_get_name(pad));
428 if (GST_IS_GHOST_PAD(pad))
429 printf(", ghost of real pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
433 printf(" Implementation:\n");
434 if (realpad->chainfunc)
435 printf(" Has chainfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->chainfunc));
436 if (realpad->getfunc)
437 printf(" Has getfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->getfunc));
438 if (realpad->getregionfunc)
439 printf(" Has getregionfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->getregionfunc));
441 if (pad->padtemplate)
442 printf(" Pad Template: '%s'\n",pad->padtemplate->name_template);
445 printf(" Capabilities:\n");
446 caps = realpad->caps;
450 printf(" '%s':\n",caps->name);
452 type = gst_type_find_by_id (caps->id);
454 printf(" MIME type: '%s':\n",type->mime);
456 printf(" MIME type: 'unknown/unknown':\n");
458 if (caps->properties)
459 print_props(caps->properties," ");
468 print_element_properties (element);
470 /* Dynamic Parameters block */
472 GstDParamManager* dpman;
476 printf("\nDynamic Parameters:\n");
477 if((dpman = gst_dpman_get_manager (element))){
478 specs = gst_dpman_list_dparam_specs(dpman);
479 for (x=0; specs[x] != NULL; x++){
480 printf(" %-40.40s: ",g_param_spec_get_name(specs[x]));
482 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
484 printf("64 Bit Integer (Default %lld, Range %lld -> %lld)",
485 ((GParamSpecInt64*)specs[x])->default_value,
486 ((GParamSpecInt64*)specs[x])->minimum,
487 ((GParamSpecInt64*)specs[x])->maximum);
490 printf("Integer (Default %d, Range %d -> %d)",
491 ((GParamSpecInt*)specs[x])->default_value,
492 ((GParamSpecInt*)specs[x])->minimum,
493 ((GParamSpecInt*)specs[x])->maximum);
496 printf("Float (Default %f, Range %f -> %f)",
497 ((GParamSpecFloat*)specs[x])->default_value,
498 ((GParamSpecFloat*)specs[x])->minimum,
499 ((GParamSpecFloat*)specs[x])->maximum);
501 default: printf("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
519 printf("\nElement Signals:\n");
521 signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
523 for (i=0; i<nsignals; i++) {
526 const GType *param_types;
529 query = g_new0(GSignalQuery,1);
530 g_signal_query (signals[i], query);
531 n_params = query->n_params;
532 return_type = query->return_type;
533 param_types = query->param_types;
535 printf (" \"%s\" :\t %s user_function (%s* object, \n", query->signal_name, g_type_name (return_type),
536 g_type_name (G_OBJECT_TYPE (element)));
538 for (j=0; j<n_params; j++) {
539 printf (" \t\t\t\t%s arg%d,\n", g_type_name (param_types[j]), j);
541 printf (" \t\t\t\tgpointer user_data);\n");
545 if (nsignals == 0) g_print (" none\n");
549 /* for compound elements */
550 if (GST_IS_BIN(element)) {
551 printf("\nChildren:\n");
552 children = (GList *) gst_bin_get_list(GST_BIN(element));
557 child = GST_ELEMENT (children->data);
558 children = g_list_next (children);
560 g_print(" %s\n",GST_ELEMENT_NAME(child));
569 print_element_list (void)
573 plugins = gst_registry_pool_plugin_list();
578 plugin = (GstPlugin*)(plugins->data);
579 plugins = g_list_next (plugins);
581 features = gst_plugin_get_feature_list (plugin);
583 GstPluginFeature *feature;
585 feature = GST_PLUGIN_FEATURE (features->data);
587 if (GST_IS_ELEMENT_FACTORY (feature)) {
588 GstElementFactory *factory;
590 factory = GST_ELEMENT_FACTORY (feature);
591 printf("%s: %s: %s\n",plugin->name, GST_PLUGIN_FEATURE_NAME (factory) ,factory->details->longname);
593 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
594 GstAutoplugFactory *factory;
596 factory = GST_AUTOPLUG_FACTORY (feature);
597 printf("%s: %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
599 else if (GST_IS_TYPE_FACTORY (feature)) {
600 GstTypeFactory *factory;
602 factory = GST_TYPE_FACTORY (feature);
603 printf("%s type: %s: %s\n", plugin->name, factory->mime, factory->exts);
605 if (factory->typefindfunc)
606 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
608 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
609 GstSchedulerFactory *factory;
611 factory = GST_SCHEDULER_FACTORY (feature);
612 printf("%s: %s: %s\n", plugin->name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
615 printf("%s: %s (%s)\n", plugin->name, GST_PLUGIN_FEATURE_NAME (feature),
616 g_type_name (G_OBJECT_TYPE (feature)));
619 features = g_list_next (features);
625 print_plugin_info (GstPlugin *plugin)
629 printf("Plugin Details:\n");
630 printf(" Name:\t\t%s\n",plugin->name);
631 printf(" Long Name:\t%s\n",plugin->longname);
632 printf(" Filename:\t%s\n",plugin->filename);
635 features = gst_plugin_get_feature_list (plugin);
638 GstPluginFeature *feature;
640 feature = GST_PLUGIN_FEATURE (features->data);
642 if (GST_IS_ELEMENT_FACTORY (feature)) {
643 GstElementFactory *factory;
645 factory = GST_ELEMENT_FACTORY (feature);
646 printf(" %s: %s\n", GST_OBJECT_NAME (factory) ,factory->details->longname);
648 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
649 GstAutoplugFactory *factory;
651 factory = GST_AUTOPLUG_FACTORY (feature);
652 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
654 else if (GST_IS_TYPE_FACTORY (feature)) {
655 GstTypeFactory *factory;
657 factory = GST_TYPE_FACTORY (feature);
658 printf(" %s: %s\n", factory->mime, factory->exts);
660 if (factory->typefindfunc)
661 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
663 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
664 GstSchedulerFactory *factory;
666 factory = GST_SCHEDULER_FACTORY (feature);
667 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
670 printf(" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
671 g_type_name (G_OBJECT_TYPE (feature)));
675 features = g_list_next (features);
682 main (int argc, char *argv[])
684 GstElementFactory *factory;
688 gst_init(&argc,&argv);
689 gst_control_init(&argc,&argv);
691 /* if no arguments, print out list of elements */
693 print_element_list();
695 /* else we try to get a factory */
697 /* first check for help */
698 if (strstr(argv[1],"-help")) {
699 printf("Usage: %s\t\t\tList all registered elements\n",argv[0]);
700 printf(" %s element-name\tShow element details\n",argv[0]);
701 printf(" %s plugin-name[.so]\tShow information about plugin\n",argv[0]);
705 /* only search for a factory if there's not a '.so' */
706 if (! strstr(argv[1],".so")) {
707 factory = gst_element_factory_find (argv[1]);
709 /* if there's a factory, print out the info */
711 return print_element_info(factory);
714 so = strstr(argv[1],".so");
718 /* otherwise assume it's a plugin */
719 plugin = gst_registry_pool_find_plugin (argv[1]);
721 /* if there is such a plugin, print out info */
724 print_plugin_info(plugin);
727 printf("no such element or plugin '%s'\n",argv[1]);