mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
gst/gststructure.c: When deserialising foo=bar without a type cast, check if it's a boolean before falling back to a ...
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.
This commit is contained in:
parent
286cd75855
commit
cf8abdf3a3
3 changed files with 24 additions and 2 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
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>
|
||||
|
|
|
@ -1769,10 +1769,12 @@ gst_structure_parse_value (gchar * str,
|
|||
*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)
|
||||
|
|
|
@ -107,6 +107,14 @@ GST_START_TEST (test_from_string)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue