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_info (GstElementFactory *factory)
139 GstObjectClass *gstobject_class;
140 GstElementClass *gstelement_class;
145 GstPadTemplate *padtemplate;
146 gint num_properties,i;
147 GParamSpec **property_specs;
153 element = gst_element_factory_create(factory,"element");
155 g_print ("couldn't construct element for some reason\n");
159 gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
160 gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
162 printf("Factory Details:\n");
163 printf(" Long name:\t%s\n",factory->details->longname);
164 printf(" Class:\t%s\n",factory->details->klass);
165 printf(" Description:\t%s\n",factory->details->description);
166 printf(" Version:\t%s\n",factory->details->version);
167 printf(" Author(s):\t%s\n",factory->details->author);
168 printf(" Copyright:\t%s\n",factory->details->copyright);
171 output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
173 printf("Pad Templates:\n");
174 if (factory->numpadtemplates) {
175 pads = factory->padtemplates;
177 padtemplate = (GstPadTemplate*)(pads->data);
178 pads = g_list_next(pads);
180 if (padtemplate->direction == GST_PAD_SRC)
181 printf(" SRC template: '%s'\n",padtemplate->name_template);
182 else if (padtemplate->direction == GST_PAD_SINK)
183 printf(" SINK template: '%s'\n",padtemplate->name_template);
185 printf(" UNKNOWN!!! template: '%s'\n",padtemplate->name_template);
187 if (padtemplate->presence == GST_PAD_ALWAYS)
188 printf(" Availability: Always\n");
189 else if (padtemplate->presence == GST_PAD_SOMETIMES)
190 printf(" Availability: Sometimes\n");
191 else if (padtemplate->presence == GST_PAD_REQUEST) {
192 printf(" Availability: On request\n");
193 printf(" Has request_new_pad() function: %s\n",
194 GST_DEBUG_FUNCPTR_NAME(gstelement_class->request_new_pad));
197 printf(" Availability: UNKNOWN!!!\n");
199 if (padtemplate->caps) {
200 printf(" Capabilities:\n");
201 caps = padtemplate->caps;
205 printf(" '%s':\n",caps->name);
207 type = gst_type_find_by_id (caps->id);
209 printf(" MIME type: '%s':\n",type->mime);
211 printf(" MIME type: 'unknown/unknown':\n");
213 if (caps->properties)
214 print_props(caps->properties," ");
227 printf("\nElement Flags:\n");
228 if (GST_FLAG_IS_SET(element,GST_ELEMENT_COMPLEX)) {
229 printf(" GST_ELEMENT_COMPLEX\n");
232 if (GST_FLAG_IS_SET(element,GST_ELEMENT_DECOUPLED)) {
233 printf(" GST_ELEMENT_DECOUPLED\n");
236 if (GST_FLAG_IS_SET(element,GST_ELEMENT_THREAD_SUGGESTED)) {
237 printf(" GST_ELEMENT_THREADSUGGESTED\n");
240 if (GST_FLAG_IS_SET(element,GST_ELEMENT_NO_SEEK)) {
241 printf(" GST_ELEMENT_NO_SEEK\n");
245 printf(" no flags set\n");
247 if (GST_IS_BIN (element)) {
248 printf("\nBin Flags:\n");
249 if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
250 printf(" GST_BIN_FLAG_MANAGER\n");
253 if (GST_FLAG_IS_SET(element,GST_BIN_SELF_SCHEDULABLE)) {
254 printf(" GST_BIN_SELF_SCHEDULABLE\n");
257 if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_PREFER_COTHREADS)) {
258 printf(" GST_BIN_FLAG_PREFER_COTHREADS\n");
262 printf(" no flags set\n");
267 printf("\nElement Implementation:\n");
269 if (element->loopfunc)
270 printf(" loopfunc()-based element: %s\n",GST_DEBUG_FUNCPTR_NAME(element->loopfunc));
272 printf(" No loopfunc(), must be chain-based or not configured yet\n");
274 printf(" Has change_state() function: %s\n",
275 GST_DEBUG_FUNCPTR_NAME(gstelement_class->change_state));
276 #ifndef GST_DISABLE_LOADSAVE
277 printf(" Has custom save_thyself() function: %s\n",
278 GST_DEBUG_FUNCPTR_NAME(gstobject_class->save_thyself));
279 printf(" Has custom restore_thyself() function: %s\n",
280 GST_DEBUG_FUNCPTR_NAME(gstobject_class->restore_thyself));
285 printf("\nClocking Interaction:\n");
286 if (element->setclockfunc) {
287 printf(" element requires a clock\n");
290 if (element->getclockfunc) {
293 clock = gst_element_get_clock (element);
294 printf(" element provides a clock: %s\n", GST_OBJECT_NAME(clock));
303 if (element->numpads) {
304 pads = gst_element_get_pad_list(element);
306 pad = GST_PAD(pads->data);
307 pads = g_list_next(pads);
308 realpad = GST_PAD_REALIZE(pad);
310 if (gst_pad_get_direction(pad) == GST_PAD_SRC)
311 printf(" SRC: '%s'",gst_pad_get_name(pad));
312 else if (gst_pad_get_direction(pad) == GST_PAD_SINK)
313 printf(" SINK: '%s'",gst_pad_get_name(pad));
315 printf(" UNKNOWN!!!: '%s'\n",gst_pad_get_name(pad));
317 if (GST_IS_GHOST_PAD(pad))
318 printf(", ghost of real pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
322 printf(" Implementation:\n");
323 if (realpad->chainfunc)
324 printf(" Has chainfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->chainfunc));
325 if (realpad->getfunc)
326 printf(" Has getfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->getfunc));
327 if (realpad->getregionfunc)
328 printf(" Has getregionfunc(): %s\n",GST_DEBUG_FUNCPTR_NAME(realpad->getregionfunc));
330 if (pad->padtemplate)
331 printf(" Pad Template: '%s'\n",pad->padtemplate->name_template);
334 printf(" Capabilities:\n");
335 caps = realpad->caps;
339 printf(" '%s':\n",caps->name);
341 type = gst_type_find_by_id (caps->id);
343 printf(" MIME type: '%s':\n",type->mime);
345 printf(" MIME type: 'unknown/unknown':\n");
347 if (caps->properties)
348 print_props(caps->properties," ");
357 property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
358 printf("\nElement Arguments:\n");
360 for (i=0;i<num_properties;i++) {
361 GValue value = { 0, };
362 GParamSpec *param = property_specs[i];
364 if (param->flags & G_PARAM_READABLE) {
365 g_value_init (&value, param->value_type);
366 g_object_get_property (G_OBJECT (element), param->name, &value);
369 printf(" %-40.40s: ",param->name);
370 switch (G_VALUE_TYPE (&value)) {
372 printf("String (Default \"%s\")", g_value_get_string (&value));
375 printf("Pointer (Default \"%p\")", g_value_get_pointer (&value));
378 printf("Boolean (Default %s)", (g_value_get_boolean (&value)?"true":"false"));
381 printf("Unsigned Long (Default %lu, Range %lu -> %lu)", g_value_get_ulong (&value),
382 ((GParamSpecULong*)param)->minimum, ((GParamSpecULong*)param)->maximum);
385 printf("Long (Default %ld, Range %ld -> %ld)", g_value_get_long (&value),
386 ((GParamSpecLong*)param)->minimum, ((GParamSpecLong*)param)->maximum);
389 printf("Unsigned Integer (Default %u, Range %u -> %u)", g_value_get_uint (&value),
390 ((GParamSpecUInt*)param)->minimum, ((GParamSpecUInt*)param)->maximum);
393 printf("Integer (Default %d, Range %d -> %d)", g_value_get_int (&value),
394 ((GParamSpecInt*)param)->minimum, ((GParamSpecInt*)param)->maximum);
397 printf("64 Bit Integer (Default %lld, Range %lld -> %lld)", g_value_get_int64 (&value),
398 ((GParamSpecInt64*)param)->minimum, ((GParamSpecInt64*)param)->maximum);
401 printf("Float (Default %f, Range %f -> %f)", g_value_get_float (&value),
402 ((GParamSpecFloat*)param)->minimum, ((GParamSpecFloat*)param)->maximum);
405 printf("Double (Default %f, Range %f -> %f)", g_value_get_double (&value),
406 ((GParamSpecDouble*)param)->minimum, ((GParamSpecDouble*)param)->maximum);
409 if (param->value_type == GST_TYPE_FILENAME)
411 else if (G_IS_PARAM_SPEC_ENUM (param)) {
415 printf("Enum \"%s\" (default %d)", g_type_name (G_VALUE_TYPE (&value)),
416 g_value_get_enum (&value));
417 values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
419 while (values[j].value_name) {
420 printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
423 /* g_type_class_unref (ec); */
426 printf("unknown %ld", param->value_type);
434 if (num_properties == 0) g_print (" none\n");
436 /* Dynamic Parameters block */
438 GstDParamManager* dpman;
442 printf("\nDynamic Parameters:\n");
443 if((dpman = gst_dpman_get_manager (element))){
444 specs = gst_dpman_list_dparam_specs(dpman);
445 for (x=0; specs[x] != NULL; x++){
446 printf(" %-40.40s: ",g_param_spec_get_name(specs[x]));
448 switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
450 printf("64 Bit Integer (Default %lld, Range %lld -> %lld)",
451 ((GParamSpecInt64*)specs[x])->default_value,
452 ((GParamSpecInt64*)specs[x])->minimum,
453 ((GParamSpecInt64*)specs[x])->maximum);
456 printf("Integer (Default %d, Range %d -> %d)",
457 ((GParamSpecInt*)specs[x])->default_value,
458 ((GParamSpecInt*)specs[x])->minimum,
459 ((GParamSpecInt*)specs[x])->maximum);
462 printf("Float (Default %f, Range %f -> %f)",
463 ((GParamSpecFloat*)specs[x])->default_value,
464 ((GParamSpecFloat*)specs[x])->minimum,
465 ((GParamSpecFloat*)specs[x])->maximum);
467 default: printf("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
485 printf("\nElement Signals:\n");
487 signals = g_signal_list_ids (G_OBJECT_TYPE (element), &nsignals);
489 for (i=0; i<nsignals; i++) {
492 const GType *param_types;
495 query = g_new0(GSignalQuery,1);
496 g_signal_query (signals[i], query);
497 n_params = query->n_params;
498 return_type = query->return_type;
499 param_types = query->param_types;
501 printf (" \"%s\" :\t %s user_function (%s* object, \n", query->signal_name, g_type_name (return_type),
502 g_type_name (G_OBJECT_TYPE (element)));
504 for (j=0; j<n_params; j++) {
505 printf (" \t\t\t\t%s arg%d,\n", g_type_name (param_types[j]), j);
507 printf (" \t\t\t\tgpointer user_data);\n");
509 if (nsignals == 0) g_print (" none\n");
513 /* for compound elements */
514 if (GST_IS_BIN(element)) {
515 printf("\nChildren:\n");
516 children = gst_bin_get_list(GST_BIN(element));
521 child = GST_ELEMENT (children->data);
522 children = g_list_next (children);
524 g_print(" %s\n",GST_ELEMENT_NAME(child));
533 print_element_list (void)
537 plugins = gst_plugin_get_list();
542 plugin = (GstPlugin*)(plugins->data);
543 plugins = g_list_next (plugins);
545 features = gst_plugin_get_feature_list (plugin);
547 GstPluginFeature *feature;
549 feature = GST_PLUGIN_FEATURE (features->data);
551 if (GST_IS_ELEMENT_FACTORY (feature)) {
552 GstElementFactory *factory;
554 factory = GST_ELEMENT_FACTORY (feature);
555 printf("%s element: %s: %s\n",plugin->name, GST_OBJECT_NAME (factory) ,factory->details->longname);
557 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
558 GstAutoplugFactory *factory;
560 factory = GST_AUTOPLUG_FACTORY (feature);
561 printf("%s autoplug: %s: %s\n", plugin->name, GST_OBJECT_NAME (factory), factory->longdesc);
563 else if (GST_IS_TYPE_FACTORY (feature)) {
564 GstTypeFactory *factory;
566 factory = GST_TYPE_FACTORY (feature);
567 printf("%s type: %s: %s\n", plugin->name, factory->mime, factory->exts);
569 if (factory->typefindfunc)
570 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
572 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
573 GstSchedulerFactory *factory;
575 factory = GST_SCHEDULER_FACTORY (feature);
576 printf("%s scheduler: %s: %s\n", plugin->name, GST_OBJECT_NAME (factory), factory->longdesc);
579 printf("%s: %s (%s)\n", plugin->name, gst_object_get_name (GST_OBJECT (feature)),
580 g_type_name (G_OBJECT_TYPE (feature)));
583 features = g_list_next (features);
589 print_plugin_info (GstPlugin *plugin)
593 printf("Plugin Details:\n");
594 printf(" Name:\t\t%s\n",plugin->name);
595 printf(" Long Name:\t%s\n",plugin->longname);
596 printf(" Filename:\t%s\n",plugin->filename);
599 features = gst_plugin_get_feature_list (plugin);
602 GstPluginFeature *feature;
604 feature = GST_PLUGIN_FEATURE (features->data);
606 if (GST_IS_ELEMENT_FACTORY (feature)) {
607 GstElementFactory *factory;
609 factory = GST_ELEMENT_FACTORY (feature);
610 printf(" %s: %s\n", GST_OBJECT_NAME (factory) ,factory->details->longname);
612 else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
613 GstAutoplugFactory *factory;
615 factory = GST_AUTOPLUG_FACTORY (feature);
616 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
618 else if (GST_IS_TYPE_FACTORY (feature)) {
619 GstTypeFactory *factory;
621 factory = GST_TYPE_FACTORY (feature);
622 printf(" %s: %s\n", factory->mime, factory->exts);
624 if (factory->typefindfunc)
625 printf(" Has typefind function: %s\n",GST_DEBUG_FUNCPTR_NAME(factory->typefindfunc));
627 else if (GST_IS_SCHEDULER_FACTORY (feature)) {
628 GstSchedulerFactory *factory;
630 factory = GST_SCHEDULER_FACTORY (feature);
631 printf(" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc);
634 printf(" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
635 g_type_name (G_OBJECT_TYPE (feature)));
639 features = g_list_next (features);
646 main (int argc, char *argv[])
648 GstElementFactory *factory;
652 gst_init(&argc,&argv);
653 gst_control_init(&argc,&argv);
655 /* if no arguments, print out list of elements */
657 print_element_list();
659 /* else we try to get a factory */
661 /* first check for help */
662 if (strstr(argv[1],"-help")) {
663 printf("Usage: %s\t\t\tList all registered elements\n",argv[0]);
664 printf(" %s element-name\tShow element details\n",argv[0]);
665 printf(" %s plugin-name[.so]\tShow information about plugin\n",argv[0]);
669 /* only search for a factory if there's not a '.so' */
670 if (! strstr(argv[1],".so")) {
671 factory = gst_element_factory_find (argv[1]);
673 /* if there's a factory, print out the info */
675 return print_element_info(factory);
678 so = strstr(argv[1],".so");
682 /* otherwise assume it's a plugin */
683 plugin = gst_plugin_find (argv[1]);
685 /* if there is such a plugin, print out info */
688 print_plugin_info(plugin);
691 printf("no such element or plugin '%s'\n",argv[1]);