- char *s, *tmp;
- char **v;
-
- s = gst_caps_to_string (caps);
-
- tmp = g_strdup_printf ("\n %s", pfx);
- v = g_strsplit (s, ", ", -1);
- g_free (s);
- s = g_strjoinv (tmp, v);
- g_strfreev (v);
- g_free (tmp);
-
- tmp = g_strdup_printf ("\n%s", pfx);
- v = g_strsplit (s, "; ", -1);
- g_free (s);
- s = g_strjoinv (tmp, v);
- g_free (tmp);
- g_strfreev (v);
-
- g_print ("%s%s\n", pfx, s);
- g_free (s);
+ guint i;
+
+ g_return_if_fail (caps != NULL);
+
+ if (gst_caps_is_any (caps)) {
+ g_print ("%sANY\n", pfx);
+ return;
+ }
+ if (gst_caps_is_empty (caps)) {
+ g_print ("%sEMPTY\n", pfx);
+ return;
+ }
+
+ for (i = 0; i < gst_caps_get_size (caps); i++) {
+ GstStructure *structure = gst_caps_get_structure (caps, i);
+
+ g_print ("%s%s\n", pfx, gst_structure_get_name (structure));
+ gst_structure_foreach (structure, print_field, (gpointer) pfx);
+ }