mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
debugutils: Truncate parameter values that are too long
This removes some information from the dumps, but improves readability. https://bugzilla.gnome.org/show_bug.cgi?id=739165
This commit is contained in:
parent
537384898f
commit
e4d6896d0c
2 changed files with 37 additions and 11 deletions
|
@ -90,13 +90,15 @@ debug_dump_get_element_state (GstElement * element)
|
|||
}
|
||||
|
||||
static gchar *
|
||||
debug_dump_get_element_params (GstElement * element)
|
||||
debug_dump_get_element_params (GstElement * element,
|
||||
GstDebugGraphDetails details)
|
||||
{
|
||||
gchar *param_name = NULL;
|
||||
GParamSpec **properties, *property;
|
||||
GValue value = { 0, };
|
||||
guint i, number_of_properties;
|
||||
gchar *tmp, *value_str;
|
||||
const gchar *ellipses;
|
||||
|
||||
/* get paramspecs and show non-default properties */
|
||||
properties =
|
||||
|
@ -118,14 +120,30 @@ debug_dump_get_element_params (GstElement * element)
|
|||
tmp = g_strdup_value_contents (&value);
|
||||
value_str = g_strescape (tmp, NULL);
|
||||
g_free (tmp);
|
||||
if (param_name) {
|
||||
|
||||
/* too long, ellipsize */
|
||||
if (!(details & GST_DEBUG_GRAPH_SHOW_FULL_PARAMS) &&
|
||||
strlen (value_str) > 80)
|
||||
ellipses = "...";
|
||||
else
|
||||
ellipses = "";
|
||||
|
||||
if (param_name)
|
||||
tmp = param_name;
|
||||
param_name = g_strdup_printf ("%s\\n%s=%s",
|
||||
tmp, property->name, value_str);
|
||||
g_free (tmp);
|
||||
else
|
||||
tmp = (char *) "";
|
||||
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_FULL_PARAMS) {
|
||||
param_name = g_strdup_printf ("%s\\n%s=%s", tmp, property->name,
|
||||
value_str);
|
||||
} else {
|
||||
param_name = g_strdup_printf ("\\n%s=%s", property->name, value_str);
|
||||
param_name = g_strdup_printf ("%s\\n%s=%.80s%s", tmp, property->name,
|
||||
value_str, ellipses);
|
||||
}
|
||||
|
||||
if (tmp[0] != '\0')
|
||||
g_free (tmp);
|
||||
|
||||
g_free (value_str);
|
||||
}
|
||||
g_value_unset (&value);
|
||||
|
@ -514,7 +532,8 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details,
|
|||
state_name = debug_dump_get_element_state (GST_ELEMENT (element));
|
||||
}
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
|
||||
param_name = debug_dump_get_element_params (GST_ELEMENT (element));
|
||||
param_name = debug_dump_get_element_params (GST_ELEMENT (element),
|
||||
details);
|
||||
}
|
||||
/* elements */
|
||||
g_string_append_printf (str, "%ssubgraph cluster_%s {\n", spc,
|
||||
|
@ -627,7 +646,7 @@ debug_dump_header (GstBin * bin, GstDebugGraphDetails details, GString * str)
|
|||
state_name = debug_dump_get_element_state (GST_ELEMENT (bin));
|
||||
}
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
|
||||
param_name = debug_dump_get_element_params (GST_ELEMENT (bin));
|
||||
param_name = debug_dump_get_element_params (GST_ELEMENT (bin), details);
|
||||
}
|
||||
|
||||
/* write header */
|
||||
|
|
|
@ -33,9 +33,14 @@ G_BEGIN_DECLS
|
|||
* GstDebugGraphDetails:
|
||||
* @GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE: show caps-name on edges
|
||||
* @GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS: show caps-details on edges
|
||||
* @GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS: show modified parameters on elements
|
||||
* @GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS: show modified parameters on
|
||||
* elements
|
||||
* @GST_DEBUG_GRAPH_SHOW_STATES: show element states
|
||||
* @GST_DEBUG_GRAPH_SHOW_ALL: show all details
|
||||
* @GST_DEBUG_GRAPH_SHOW_FULL_PARAMS: show full element parameter values even
|
||||
* if they are very long
|
||||
* @GST_DEBUG_GRAPH_SHOW_ALL: show all the typical details that one might want
|
||||
* @GST_DEBUG_GRAPH_SHOW_VERBOSE: show all details regardless of how large or
|
||||
* verbose they make the resulting output
|
||||
*
|
||||
* Available details for pipeline graphs produced by GST_DEBUG_BIN_TO_DOT_FILE()
|
||||
* and GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS().
|
||||
|
@ -45,7 +50,9 @@ typedef enum {
|
|||
GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS = (1<<1),
|
||||
GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS = (1<<2),
|
||||
GST_DEBUG_GRAPH_SHOW_STATES = (1<<3),
|
||||
GST_DEBUG_GRAPH_SHOW_ALL = ((1<<4)-1)
|
||||
GST_DEBUG_GRAPH_SHOW_FULL_PARAMS = (1<<4),
|
||||
GST_DEBUG_GRAPH_SHOW_ALL = ((1<<4)-1),
|
||||
GST_DEBUG_GRAPH_SHOW_VERBOSE = (-1)
|
||||
} GstDebugGraphDetails;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue