debugutils: nicer printing of caps features

Only print interesting caps features, don't
append (memory:SystemMemory) to all caps,
which makes them much more unwieldy and
harder to read. Also use internal function
to get caps features so that our printing
has no side effects on the caps.

https://bugzilla.gnome.org/show_bug.cgi?id=746809
This commit is contained in:
Tim-Philipp Müller 2015-04-01 12:13:17 +01:00
parent 373af462db
commit 1dd72f56ea
3 changed files with 19 additions and 7 deletions

View file

@ -186,6 +186,10 @@ _priv_gst_do_linear_regression (GstClockTime *times, guint n,
GstClockTime * m_num, GstClockTime * m_denom, GstClockTime * b,
GstClockTime * xbase, gdouble * r_squared);
/* For use in gstdebugutils */
G_GNUC_INTERNAL
GstCapsFeatures * __gst_caps_get_features_unchecked (const GstCaps * caps, guint idx);
#ifndef GST_DISABLE_REGISTRY
/* Secret variable to initialise gst without registry cache */
GST_EXPORT gboolean _gst_disable_registry_cache;

View file

@ -145,6 +145,12 @@ _priv_gst_caps_initialize (void)
G_TYPE_STRING, gst_caps_transform_to_string);
}
GstCapsFeatures *
__gst_caps_get_features_unchecked (const GstCaps * caps, guint idx)
{
return gst_caps_get_features_unchecked (caps, idx);
}
static GstCaps *
_gst_caps_copy (const GstCaps * caps)
{

View file

@ -357,17 +357,19 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details)
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);
const GstCapsFeatures *features = gst_caps_get_features (caps, i);
gchar *features_name = gst_caps_features_to_string (features);
g_string_append (str, gst_structure_get_name (structure));
g_string_append (str, "(");
g_string_append (str, features_name);
g_string_append (str, ")\\l");
g_free (features_name);
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);
}