From 1dd72f56eada174a5764015f4d3b157a6243b9a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 1 Apr 2015 12:13:17 +0100 Subject: [PATCH] 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 --- gst/gst_private.h | 4 ++++ gst/gstcaps.c | 6 ++++++ gst/gstdebugutils.c | 16 +++++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gst/gst_private.h b/gst/gst_private.h index d0aefb4..4f4194a 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -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; diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 147b32c..6acc564 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -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) { diff --git a/gst/gstdebugutils.c b/gst/gstdebugutils.c index 06d3469..b76c948 100644 --- a/gst/gstdebugutils.c +++ b/gst/gstdebugutils.c @@ -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); } -- 2.7.4