diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-06-16 08:43:53 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-06-16 08:55:17 +0100 |
commit | 470e5612166777156ca3de26efb43db5aef81dd8 (patch) | |
tree | 94b20aec4a890d4b8e51cb299e9413c7b1504528 /gst | |
parent | 8624aaa41500077f018a3e0485505d9f6a1d9bed (diff) |
gstxml: fix (de)serialisation of properties of type GstStructure
souphttpsrc has a property of type GstStructure, which causes an
assertion when serialising it to xml. Fixes #585137.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstelement.c | 9 | ||||
-rw-r--r-- | gst/gstutils.c | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gst/gstelement.c b/gst/gstelement.c index af83fcecb..4fc095b92 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -89,6 +89,7 @@ #include "gstevent.h" #include "gstutils.h" #include "gstinfo.h" +#include "gstvalue.h" #include "gst-i18n-lib.h" /* Element signals and args */ @@ -2958,7 +2959,13 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) else if (G_IS_PARAM_SPEC_INT64 (spec)) contents = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (&value)); - else + else if (GST_VALUE_HOLDS_STRUCTURE (&value)) { + if (g_value_get_boxed (&value) != NULL) { + contents = g_strdup_value_contents (&value); + } else { + contents = g_strdup ("NULL"); + } + } else contents = g_strdup_value_contents (&value); xmlNewChild (param, NULL, (xmlChar *) "value", (xmlChar *) contents); diff --git a/gst/gstutils.c b/gst/gstutils.c index 1b74d6286..0f49340e6 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -140,16 +140,25 @@ gst_util_set_object_arg (GObject * object, const gchar * name, value_type = G_PARAM_SPEC_VALUE_TYPE (pspec); - GST_DEBUG ("pspec->flags is %d, pspec->value_type is %d", - pspec->flags, (gint) value_type); + GST_DEBUG ("pspec->flags is %d, pspec->value_type is %s", + pspec->flags, g_type_name (value_type)); if (!(pspec->flags & G_PARAM_WRITABLE)) return; g_value_init (&v, value_type); + + /* special case for element <-> xml (de)serialisation */ + if (GST_VALUE_HOLDS_STRUCTURE (&v) && strcmp (value, "NULL") == 0) { + g_value_set_boxed (&v, NULL); + goto done; + } + if (!gst_value_deserialize (&v, value)) return; +done: + g_object_set_property (object, pspec->name, &v); g_value_unset (&v); } |