summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 286cd75)
raw | patch | inline | side by side (parent: 286cd75)
author | Tim-Philipp Müller <tim@centricular.net> | |
Sun, 8 Jul 2007 14:11:53 +0000 (14:11 +0000) | ||
committer | Tim-Philipp Müller <tim@centricular.net> | |
Sun, 8 Jul 2007 14:11:53 +0000 (14:11 +0000) |
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_parse_value):
When deserialising foo=bar without a type cast, check if it's a
boolean before falling back to a string type, otherwise things like
audiotestsrc ! audio/x-raw-int,signed=true ! fakesink won't work,
because the filtercaps end up having a signed=(string)true field,
which causes problems later when intersection caps.
* tests/check/gst/gststructure.c: (GST_START_TEST):
Add a unit test for this.
* gst/gststructure.c: (gst_structure_parse_value):
When deserialising foo=bar without a type cast, check if it's a
boolean before falling back to a string type, otherwise things like
audiotestsrc ! audio/x-raw-int,signed=true ! fakesink won't work,
because the filtercaps end up having a signed=(string)true field,
which causes problems later when intersection caps.
* tests/check/gst/gststructure.c: (GST_START_TEST):
Add a unit test for this.
ChangeLog | patch | blob | history | |
gst/gststructure.c | patch | blob | history | |
tests/check/gst/gststructure.c | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index ac4709dd287287fa898749ead7580d2e3d4eecbd..5cb49c5cbc999e77c3cd7eb7b29967a398010389 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2007-07-08 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/gststructure.c: (gst_structure_parse_value):
+ When deserialising foo=bar without a type cast, check if it's a
+ boolean before falling back to a string type, otherwise things like
+ audiotestsrc ! audio/x-raw-int,signed=true ! fakesink won't work,
+ because the filtercaps end up having a signed=(string)true field,
+ which causes problems later when intersection caps.
+
+ * tests/check/gst/gststructure.c: (GST_START_TEST):
+ Add a unit test for this.
+
2007-07-06 Sebastian Dröge <slomo@circular-chaos.org>
Reviewed by: Stefan Kost <ensonic@users.sf.net>
diff --git a/gst/gststructure.c b/gst/gststructure.c
index e8f40dffefc10d159f3b1e44cde16e582dbd23f6..1ccb857dd89f3a4b93be5eb6da12e244d8e1daf4 100644 (file)
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
*value_end = 0;
if (type == G_TYPE_INVALID) {
GType try_types[] =
- { G_TYPE_INT, G_TYPE_DOUBLE, GST_TYPE_FRACTION, G_TYPE_STRING };
+ { G_TYPE_INT, G_TYPE_DOUBLE, GST_TYPE_FRACTION, G_TYPE_BOOLEAN,
+ G_TYPE_STRING
+ };
int i;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < G_N_ELEMENTS (try_types); i++) {
g_value_init (value, try_types[i]);
ret = gst_value_deserialize (value, value_s);
if (ret)
index 5e4c230f99f822c4ae0360bc95f9246ac61dc7c5..e9620a2e3ad2d83963e369bffde536b2713c6d5c 100644 (file)
fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
fail_unless (G_VALUE_HOLDS_STRING (val));
gst_structure_free (structure);
+
+ s = "test-string,value=true";
+ structure = gst_structure_from_string (s, NULL);
+ fail_if (structure == NULL, "Could not get structure from string %s", s);
+ fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
+ fail_unless (G_VALUE_HOLDS_BOOLEAN (val));
+ fail_unless_equals_int (g_value_get_boolean (val), TRUE);
+ gst_structure_free (structure);
}
GST_END_TEST;