debugutils: allow to hide/show pad status with graphdetails flag

This commit is contained in:
Stefan Kost 2009-10-25 21:35:09 +02:00
parent c57e5bf07e
commit b83fb45fac

View file

@ -137,13 +137,11 @@ debug_dump_get_element_params (GstElement * element)
static void static void
debug_dump_pad (GstPad * pad, gchar * color_name, gchar * element_name, debug_dump_pad (GstPad * pad, gchar * color_name, gchar * element_name,
FILE * out, const gint indent) GstDebugGraphDetails details, FILE * out, const gint indent)
{ {
GstPadTemplate *pad_templ; GstPadTemplate *pad_templ;
GstPadPresence presence; GstPadPresence presence;
gchar *pad_name, *style_name; gchar *pad_name, *style_name;
gchar pad_flags[6];
const gchar *activation_mode = "-><";
const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)]; const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)];
pad_name = debug_dump_make_object_name (GST_OBJECT (pad)); pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
@ -158,16 +156,28 @@ debug_dump_pad (GstPad * pad, gchar * color_name, gchar * element_name,
style_name = "filled,dashed"; style_name = "filled,dashed";
} }
} }
/* check if pad flags */ if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
pad_flags[0] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED) ? 'B' : 'b'; gchar pad_flags[6];
pad_flags[1] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING) ? 'F' : 'f'; const gchar *activation_mode = "-><";
pad_flags[2] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS) ? 'G' : 'g';
pad_flags[3] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS) ? 's' : 's';
pad_flags[4] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKING) ? 'B' : 'b';
pad_flags[5] = '\0';
fprintf (out, "%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\\n[%c][%s]\", height=\"0.2\", style=\"%s\"];\n", spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad), activation_mode[pad->mode], /* NONE/PUSH/PULL */ /* check if pad flags */
pad_flags, style_name); pad_flags[0] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED) ? 'B' : 'b';
pad_flags[1] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING) ? 'F' : 'f';
pad_flags[2] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS) ? 'G' : 'g';
pad_flags[3] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS) ? 's' : 's';
pad_flags[4] = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKING) ? 'B' : 'b';
pad_flags[5] = '\0';
fprintf (out,
"%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\\n[%c][%s]\", height=\"0.2\", style=\"%s\"];\n",
spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),
activation_mode[pad->mode], pad_flags, style_name);
} else {
fprintf (out,
"%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\", height=\"0.2\", style=\"%s\"];\n",
spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),
style_name);
}
g_free (pad_name); g_free (pad_name);
} }
@ -198,8 +208,8 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
} else { } else {
target_element_name = ""; target_element_name = "";
} }
debug_dump_pad (target_pad, color_name, target_element_name, out, debug_dump_pad (target_pad, color_name, target_element_name, details,
indent); out, indent);
if (target_element) { if (target_element) {
g_free (target_element_name); g_free (target_element_name);
gst_object_unref (target_element); gst_object_unref (target_element);
@ -214,7 +224,7 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
GST_PAD_SINK) ? "#aaaaff" : "#cccccc"); GST_PAD_SINK) ? "#aaaaff" : "#cccccc");
} }
/* pads */ /* pads */
debug_dump_pad (pad, color_name, element_name, out, indent); debug_dump_pad (pad, color_name, element_name, details, out, indent);
g_free (element_name); g_free (element_name);
} }