Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GStreamer
gstreamer
Commits
ce0d28fe
Commit
ce0d28fe
authored
Mar 11, 2009
by
Laszlo Pandy
Committed by
Stefan Kost
Mar 11, 2009
Browse files
dump2dot: make caps in DOT debug graphs more readable. Fixes 574484
Use a monospace font for edge labels and indent.
parent
d3075137
Changes
1
Hide whitespace changes
Inline
Side-by-side
gst/gstdebugutils.c
View file @
ce0d28fe
...
...
@@ -45,6 +45,7 @@
#include
"gstghostpad.h"
#include
"gstpad.h"
#include
"gstutils.h"
#include
"gstvalue.h"
/*** PIPELINE GRAPHS **********************************************************/
...
...
@@ -70,7 +71,7 @@ debug_dump_get_element_state (GstElement * element)
if
(
pending
==
GST_STATE_VOID_PENDING
)
{
state_name
=
g_strdup_printf
(
"
\\
n[%c]"
,
state_icons
[
state
]);
}
else
{
state_name
=
g_strdup_printf
(
"
\\
n[%c]->[%c]"
,
state_icons
[
state
],
state_name
=
g_strdup_printf
(
"
\\
n[%c]
->
[%c]"
,
state_icons
[
state
],
state_icons
[
pending
]);
}
return
state_name
;
...
...
@@ -204,6 +205,19 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
g_free
(
spc
);
}
static
gboolean
string_append_field
(
GQuark
field
,
const
GValue
*
value
,
gpointer
ptr
)
{
GString
*
str
=
(
GString
*
)
ptr
;
gchar
*
value_str
=
gst_value_serialize
(
value
);
g_string_append_printf
(
str
,
" %15s: %s
\\
l"
,
g_quark_to_string
(
field
),
value_str
);
g_free
(
value_str
);
return
TRUE
;
}
static
gchar
*
debug_dump_describe_caps
(
GstCaps
*
caps
,
GstDebugGraphDetails
details
,
gboolean
*
need_free
)
...
...
@@ -211,38 +225,34 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details,
gchar
*
media
=
NULL
;
if
(
details
&
GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS
)
{
gchar
*
tmp
=
gst_caps_to_string
(
caps
);
gboolean
in_bracket
=
FALSE
;
gint
i
,
sl
=
strlen
(
tmp
);
for
(
i
=
0
;
i
<
sl
;
i
++
)
{
switch
(
tmp
[
i
])
{
case
';'
:
if
(
i
<
(
sl
-
1
))
tmp
[
i
]
=
'\n'
;
else
tmp
[
i
]
=
'\0'
;
break
;
case
','
:
if
(
!
in_bracket
)
tmp
[
i
]
=
'\n'
;
break
;
case
'('
:
case
'{'
:
case
'['
:
in_bracket
=
TRUE
;
break
;
case
')'
:
case
'}'
:
case
']'
:
in_bracket
=
FALSE
;
break
;
if
(
gst_caps_is_any
(
caps
)
||
gst_caps_is_empty
(
caps
))
{
media
=
gst_caps_to_string
(
caps
);
*
need_free
=
TRUE
;
}
else
{
GString
*
str
=
NULL
;
guint
i
;
guint
slen
=
0
;
for
(
i
=
0
;
i
<
gst_caps_get_size
(
caps
);
i
++
)
{
slen
+=
STRUCTURE_ESTIMATED_STRING_LEN
(
gst_caps_get_structure
(
caps
,
i
));
}
}
media
=
g_strescape
(
tmp
,
NULL
);
*
need_free
=
TRUE
;
g_free
(
tmp
);
str
=
g_string_sized_new
(
slen
);
for
(
i
=
0
;
i
<
gst_caps_get_size
(
caps
);
i
++
)
{
GstStructure
*
structure
=
gst_caps_get_structure
(
caps
,
i
);
g_string_append
(
str
,
gst_structure_get_name
(
structure
));
g_string_append
(
str
,
"
\\
l"
);
gst_structure_foreach
(
structure
,
string_append_field
,
(
gpointer
)
str
);
}
media
=
g_string_free
(
str
,
FALSE
);
*
need_free
=
TRUE
;
}
}
else
{
if
(
GST_CAPS_IS_SIMPLE
(
caps
))
...
...
@@ -608,14 +618,14 @@ _gst_debug_bin_to_dot_file (GstBin * bin, GstDebugGraphDetails details,
fprintf
(
out
,
"digraph pipeline {
\n
"
" rankdir=LR;
\n
"
" fontname=
\"
Bitstream Vera S
ans
\"
;
\n
"
" fontname=
\"
s
ans
\"
;
\n
"
" fontsize=
\"
8
\"
;
\n
"
" labelloc=t;
\n
"
" nodesep=.1;
\n
"
" ranksep=.2;
\n
"
" label=
\"
<%s>
\\
n%s%s%s
\"
;
\n
"
" node [style=filled, shape=box, fontsize=
\"
7
\"
, fontname=
\"
Bitstream Vera S
ans
\"
, margin=
\"
0.0,0.0
\"
];
\n
"
" edge [labelfontsize=
\"
7
\"
, fontsize=
\"
7
\"
,
label
fontname=
\"
Bitstream Vera Sans
\"
, fontname=
\"
Bitstream Vera Sans
\"
];
\n
"
" node [style=filled, shape=box, fontsize=
\"
7
\"
, fontname=
\"
s
ans
\"
, margin=
\"
0.0,0.0
\"
];
\n
"
" edge [labelfontsize=
\"
7
\"
, fontsize=
\"
7
\"
, fontname=
\"
monospace
\"
];
\n
"
"
\n
"
,
G_OBJECT_TYPE_NAME
(
bin
),
GST_OBJECT_NAME
(
bin
),
(
state_name
?
state_name
:
""
),
(
param_name
?
param_name
:
""
)
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment