/** * gst_caps_features_to_string: * @features: a #GstCapsFeatures * * Converts @features to a human-readable string representation. * * For debugging purposes its easier to do something like this: * |[ * GST_LOG ("features is %" GST_PTR_FORMAT, features); * ]| * This prints the features in human readble form. * * Free-function: g_free * * Returns: (transfer full): a pointer to string allocated by g_malloc(). * g_free() after usage. * * Since: 1.2 */ gchar * gst_caps_features_to_string (const GstCapsFeatures * features) { GString *s; g_return_val_if_fail (features != NULL, NULL); s = g_string_sized_new (FEATURES_ESTIMATED_STRING_LEN (features)); priv_gst_caps_features_append_to_gstring (features, s); return g_string_free (s, FALSE); }
static gchar * debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details) { gchar *media = NULL; if (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS) { if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) { media = gst_caps_to_string (caps); } else { GString *str = NULL; guint i; guint slen = 0; for (i = 0; i < gst_caps_get_size (caps); i++) { slen += 25 + STRUCTURE_ESTIMATED_STRING_LEN (gst_caps_get_structure (caps, i)); } str = g_string_sized_new (slen); for (i = 0; i < gst_caps_get_size (caps); i++) { GstCapsFeatures *features = __gst_caps_get_features_unchecked (caps, i); GstStructure *structure = gst_caps_get_structure (caps, i); g_string_append (str, gst_structure_get_name (structure)); if (features && (gst_caps_features_is_any (features) || !gst_caps_features_is_equal (features, GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))) { g_string_append_c (str, '('); priv_gst_caps_features_append_to_gstring (features, str); g_string_append_c (str, ')'); } g_string_append (str, "\\l"); gst_structure_foreach (structure, string_append_field, (gpointer) str); } media = g_string_free (str, FALSE); } } else { if (GST_CAPS_IS_SIMPLE (caps)) media = g_strdup (gst_structure_get_name (gst_caps_get_structure (caps, 0))); else media = g_strdup ("*"); } return media; }