gst/: Add some more comments and debug output. Quote structure name to fix deserialis...
authorStefan Kost <ensonic@users.sourceforge.net>
Mon, 15 Oct 2007 11:19:36 +0000 (11:19 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Mon, 15 Oct 2007 11:19:36 +0000 (11:19 +0000)
Original commit message from CVS:
* gst/gststructure.c:
* gst/gstvalue.c:
Add some more comments and debug output. Quote structure name to fix
deserialisation of some strings.

ChangeLog
gst/gststructure.c
gst/gstvalue.c

index ed01e01..8ebd4b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-10-15  Stefan Kost  <ensonic@users.sf.net>
 
+       * gst/gststructure.c:
+       * gst/gstvalue.c:
+         Add some more comments and debug output. Quote structure name to fix
+         deserialisation of some strings.
+
+2007-10-15  Stefan Kost  <ensonic@users.sf.net>
+
        * gst/gstbuffer.h:
          Define GST_BUFFER_FLAG_GAP more strictly to enable optimizations based
          on it. Fix docs for GST_BUFFER_MALLOCDATA and GstBuffer.malloc_data.
index cc73247..c95845f 100644 (file)
@@ -1464,6 +1464,7 @@ gst_structure_value_get_generic_type (GValue * val)
   return G_VALUE_TYPE (val);
 }
 
+/* keep in sync with gstvalue.c */
 #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
       ((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
       ((c) == '.'))
@@ -1494,7 +1495,7 @@ gst_structure_to_string (const GstStructure * structure)
 
   s = g_string_new ("");
   /* FIXME this string may need to be escaped */
-  g_string_append_printf (s, "%s", g_quark_to_string (structure->name));
+  g_string_append_printf (s, "\"%s\"", g_quark_to_string (structure->name));
   for (i = 0; i < structure->fields->len; i++) {
     char *t;
     GType type;
@@ -1566,7 +1567,6 @@ gst_structure_parse_range (gchar * s, gchar ** after, GValue * value,
   GType range_type;
   gboolean ret;
 
-
   if (*s != '[')
     return FALSE;
   s++;
@@ -1861,13 +1861,18 @@ gst_structure_from_string (const gchar * string, gchar ** end)
   r = copy;
 
   name = r;
-  if (!gst_structure_parse_string (r, &w, &r))
+  if (!gst_structure_parse_string (r, &w, &r)) {
+    GST_WARNING ("Failed to parse structure string");
     goto error;
+  }
 
+  /* skip spaces */
   while (g_ascii_isspace (*r) || (r[0] == '\\' && g_ascii_isspace (r[1])))
     r++;
-  if (*r != 0 && *r != ';' && *r != ',')
+  if (*r != 0 && *r != ';' && *r != ',') {
+    GST_WARNING ("Failed to find delimiter, r=%s", r);
     goto error;
+  }
 
   save = *w;
   *w = 0;
@@ -1875,8 +1880,10 @@ gst_structure_from_string (const gchar * string, gchar ** end)
   *w = save;
 
   while (*r && (*r != ';')) {
-    if (*r != ',')
+    if (*r != ',') {
+      GST_WARNING ("Failed to find delimiter, r=%s", r);
       goto error;
+    }
     r++;
     while (*r && (g_ascii_isspace (*r) || (r[0] == '\\'
                 && g_ascii_isspace (r[1]))))
index bdeacdb..ea326de 100644 (file)
@@ -1711,6 +1711,7 @@ gst_value_compare_string (const GValue * value1, const GValue * value2)
   return GST_VALUE_EQUAL;
 }
 
+/* keep in sync with gststructure.c */
 #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
     ((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
     ((c) == '.'))