mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
tracer: add an internal ptr format for tracer serialisation
We need to apply the string wrapping that value serialisation does also in the tracer logging, otherwise we can't parse nested structures.
This commit is contained in:
parent
f69382c5f9
commit
4859494945
4 changed files with 20 additions and 10 deletions
|
@ -163,6 +163,13 @@ gboolean priv_gst_structure_parse_name (gchar * str, gchar **start, gchar ** end
|
|||
G_GNUC_INTERNAL
|
||||
gboolean priv_gst_structure_parse_fields (gchar *str, gchar ** end, GstStructure *structure);
|
||||
|
||||
/* used in gstvalue.c and gststructure.c */
|
||||
|
||||
#define GST_WRAPPED_PTR_FORMAT "p\aa"
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gchar *priv_gst_string_take_and_wrap (gchar * s);
|
||||
|
||||
/* registry cache backends */
|
||||
G_GNUC_INTERNAL
|
||||
gboolean priv_gst_registry_binary_read_cache (GstRegistry * registry, const char *location);
|
||||
|
|
|
@ -819,6 +819,9 @@ gst_info_printf_pointer_extension_func (const char *format, void *ptr)
|
|||
case 'B': /* GST_SEGMENT_FORMAT */
|
||||
s = gst_debug_print_segment (ptr);
|
||||
break;
|
||||
case 'a': /* GST_WRAPPED_PTR_FORMAT */
|
||||
s = priv_gst_string_take_and_wrap (gst_debug_print_object (ptr));
|
||||
break;
|
||||
default:
|
||||
/* must have been compiled against a newer version with an extension
|
||||
* we don't known about yet - just ignore and fallback to %p below */
|
||||
|
|
|
@ -1974,12 +1974,13 @@ priv__gst_structure_append_template_to_gstring (GQuark field_id,
|
|||
} else if (type == G_TYPE_UINT64) {
|
||||
g_string_append (s, "%" G_GUINT64_FORMAT);
|
||||
} else if (type == GST_TYPE_STRUCTURE) {
|
||||
g_string_append (s, "%" GST_PTR_FORMAT);
|
||||
} else if (g_type_is_a (type, G_TYPE_ENUM)) {
|
||||
g_string_append (s, "%" GST_WRAPPED_PTR_FORMAT);
|
||||
} else if (g_type_is_a (type, G_TYPE_ENUM)
|
||||
|| g_type_is_a (type, G_TYPE_FLAGS)) {
|
||||
g_string_append (s, "%i");
|
||||
} else {
|
||||
GST_WARNING ("unhandled type: %s", g_type_name (type));
|
||||
g_string_append (s, "%" GST_PTR_FORMAT);
|
||||
g_string_append (s, "%" GST_WRAPPED_PTR_FORMAT);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -148,7 +148,6 @@ static gint gst_value_compare_with_func (const GValue * value1,
|
|||
const GValue * value2, GstValueCompareFunc compare);
|
||||
|
||||
static gchar *gst_string_wrap (const gchar * s);
|
||||
static gchar *gst_string_take_and_wrap (gchar * s);
|
||||
static gchar *gst_string_unwrap (const gchar * s);
|
||||
|
||||
static void gst_value_move (GValue * dest, GValue * src);
|
||||
|
@ -1925,7 +1924,7 @@ static gchar *
|
|||
gst_value_serialize_caps (const GValue * value)
|
||||
{
|
||||
GstCaps *caps = g_value_get_boxed (value);
|
||||
return gst_string_take_and_wrap (gst_caps_to_string (caps));
|
||||
return priv_gst_string_take_and_wrap (gst_caps_to_string (caps));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2067,7 +2066,7 @@ gst_value_serialize_structure (const GValue * value)
|
|||
{
|
||||
GstStructure *structure = g_value_get_boxed (value);
|
||||
|
||||
return gst_string_take_and_wrap (gst_structure_to_string (structure));
|
||||
return priv_gst_string_take_and_wrap (gst_structure_to_string (structure));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2149,7 +2148,7 @@ gst_value_serialize_caps_features (const GValue * value)
|
|||
{
|
||||
GstCapsFeatures *features = g_value_get_boxed (value);
|
||||
|
||||
return gst_string_take_and_wrap (gst_caps_features_to_string (features));
|
||||
return priv_gst_string_take_and_wrap (gst_caps_features_to_string (features));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2219,7 +2218,7 @@ gst_value_serialize_tag_list (const GValue * value)
|
|||
{
|
||||
GstTagList *taglist = g_value_get_boxed (value);
|
||||
|
||||
return gst_string_take_and_wrap (gst_tag_list_to_string (taglist));
|
||||
return priv_gst_string_take_and_wrap (gst_tag_list_to_string (taglist));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2916,8 +2915,8 @@ gst_string_wrap (const gchar * s)
|
|||
}
|
||||
|
||||
/* Same as above, but take ownership of the string */
|
||||
static gchar *
|
||||
gst_string_take_and_wrap (gchar * s)
|
||||
gchar *
|
||||
priv_gst_string_take_and_wrap (gchar * s)
|
||||
{
|
||||
gchar *out;
|
||||
gint len = gst_string_measure_wrapping (s);
|
||||
|
|
Loading…
Reference in a new issue