value: when serialising arrays or lists, handle types we can't serialise more gracefully

https://bugzilla.gnome.org/show_bug.cgi?id=681322
This commit is contained in:
Tim-Philipp Müller 2012-08-13 00:01:16 +01:00
parent 1c3ade2d0f
commit 718a10edda

View file

@ -186,11 +186,16 @@ gst_value_serialize_any_list (const GValue * value, const gchar * begin,
for (i = 0; i < alen; i++) { for (i = 0; i < alen; i++) {
v = &g_array_index (array, GValue, i); v = &g_array_index (array, GValue, i);
s_val = gst_value_serialize (v); s_val = gst_value_serialize (v);
if (s_val != NULL) {
g_string_append (s, s_val); g_string_append (s, s_val);
g_free (s_val); g_free (s_val);
if (i < alen - 1) { if (i < alen - 1) {
g_string_append_len (s, ", ", 2); g_string_append_len (s, ", ", 2);
} }
} else {
GST_WARNING ("Could not serialize list/array value of type '%s'",
G_VALUE_TYPE_NAME (v));
}
} }
g_string_append (s, end); g_string_append (s, end);
return g_string_free (s, FALSE); return g_string_free (s, FALSE);
@ -1839,6 +1844,7 @@ gst_value_serialize_segment (const GValue * value)
gchar *t, *res; gchar *t, *res;
GstStructure *s; GstStructure *s;
/* FIXME: serialize segment offset as well ? */
s = gst_structure_new ("GstSegment", s = gst_structure_new ("GstSegment",
"flags", GST_TYPE_SEGMENT_FLAGS, seg->flags, "flags", GST_TYPE_SEGMENT_FLAGS, seg->flags,
"rate", G_TYPE_DOUBLE, seg->rate, "rate", G_TYPE_DOUBLE, seg->rate,