diff --git a/gst/gststructure.c b/gst/gststructure.c index 521def4058..83eb96b37d 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -1514,6 +1514,10 @@ gst_structure_get_abbrs (gint * n_abbrs) , {"i", G_TYPE_INT} , + {"uint", G_TYPE_UINT} + , + {"u", G_TYPE_UINT} + , {"float", G_TYPE_FLOAT} , {"f", G_TYPE_FLOAT} diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c index 8d7b00cd98..b37bd24430 100644 --- a/tests/check/gst/gststructure.c +++ b/tests/check/gst/gststructure.c @@ -73,6 +73,49 @@ GST_START_TEST (test_from_string_int) GST_END_TEST; +GST_START_TEST (test_from_string_uint) +{ + const char *strings[] = { + "taglist, bar = (uint) 123456", + "taglist, bar = (uint) 0xFFFF", + "taglist, bar = (uint) 0x0000FFFF", + "taglist, bar = (uint) 0x7FFFFFFF", + "taglist, bar = (uint) 0x80000000", + "taglist, bar = (uint) 0xFF000000" + }; + guint results[] = { + 123456, + 0xFFFF, + 0xFFFF, + 0x7FFFFFFF, + 0x80000000, + 0xFF000000, + }; + GstStructure *structure; + int i; + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + const char *s; + const gchar *name; + guint value; + + s = strings[i]; + + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + name = gst_structure_nth_field_name (structure, 0); + fail_unless (gst_structure_get_uint (structure, name, &value)); + fail_unless (value == results[i], + "Value %u is not the expected result %u for string %s", + value, results[i], s); + + /* cleanup */ + gst_structure_free (structure); + } +} + +GST_END_TEST; + /* Test type conversions from string */ GST_START_TEST (test_from_string) { @@ -566,6 +609,7 @@ gst_structure_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_from_string_int); + tcase_add_test (tc_chain, test_from_string_uint); tcase_add_test (tc_chain, test_from_string); tcase_add_test (tc_chain, test_to_string); tcase_add_test (tc_chain, test_to_from_string);