diff options
author | Edgard Lima <edgard.lima@indt.org.br> | 2007-10-22 08:53:26 +0000 |
---|---|---|
committer | Edgard Lima <edgard.lima@indt.org.br> | 2007-10-22 08:53:26 +0000 |
commit | 0e3a0fdf35bbfbcba69d47b3c02556c3c7b56eae (patch) | |
tree | afe3f81ed66278cbd9bd56e3fc2d1991d931ff68 /gst/gstcaps.c | |
parent | 81a3de7036efed267e480ca5d1cb0fa7124ac7ed (diff) |
Added GstStructure to gst_value_table and its related functions.
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_to_string),
(gst_caps_from_string_inplace):
* gst/gststructure.c: (gst_structure_get_abbrs),
(gst_structure_to_string), (gst_structure_from_string):
* gst/gstvalue.c: (gst_value_set_structure),
(gst_value_get_structure), (gst_value_serialize_structure),
(gst_value_deserialize_structure), (_gst_value_initialize):
* gst/gstvalue.h:
* tests/check/gst/gststructure.c: (GST_START_TEST),
(gst_structure_suite):
* tests/check/gst/gstvalue.c: (GST_START_TEST):
Added GstStructure to gst_value_table and its related functions.
Changed gst_structure_to_string to print ';' in the end.
Changed gst_caps_to_string to not print ';' beteween its
fields (structures) anymore and remove the lastes ';' from latest
structure. Now it is possible to have nested structures.
In addition, backward compatibilty is assured by accepting '\0' as
end delimiter. Fixes: #487969.
API: add gst_value_set_structure()
API: add gst_value_get_structure()
Diffstat (limited to 'gst/gstcaps.c')
-rw-r--r-- | gst/gstcaps.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 65cf1cd2c..a090765a8 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1797,14 +1797,20 @@ gst_caps_to_string (const GstCaps * caps) GstStructure *structure; char *sstr; - if (i > 0) - g_string_append (s, "; "); + if (i > 0) { + /* ';' is now added by gst_structure_to_string */ + g_string_append (s, " "); + } structure = gst_caps_get_structure (caps, i); sstr = gst_structure_to_string (structure); g_string_append (s, sstr); g_free (sstr); } + if (s->len && s->str[s->len - 1] == ';') { + /* remove latest ';' */ + s->str[--s->len] = '\0'; + } return g_string_free (s, FALSE); } @@ -1830,22 +1836,20 @@ gst_caps_from_string_inplace (GstCaps * caps, const gchar * string) } gst_caps_append_structure (caps, structure); - while (*s == ';') { - s++; + do { + while (g_ascii_isspace (*s)) s++; + if (*s == '\0') { + break; + } structure = gst_structure_from_string (s, &s); if (structure == NULL) { return FALSE; } gst_caps_append_structure (caps, structure); - while (g_ascii_isspace (*s)) - s++; - } - if (*s != 0) { - return FALSE; - } + } while (TRUE); return TRUE; } |