summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--check/gst/capslist.h3
-rw-r--r--check/gst/gstcaps.c12
-rw-r--r--gst/gststructure.c2
-rw-r--r--gst/gstvalue.c7
-rw-r--r--tests/check/gst/capslist.h3
-rw-r--r--tests/check/gst/gstcaps.c12
7 files changed, 52 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 087f06099..805ad30cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-22 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * check/gst/gstcaps.c: (GST_START_TEST):
+ Extend caps string tests to check that a caps to string
+ conversion is reversible and produces the same caps.
+
+ * gst/gststructure.c: (gst_structure_value_get_generic_type):
+ Output "fraction" as the generic type fraction range, so caps
+ serialisation and deserialisation works.
+ * check/gst/capslist.h:
+ * gst/gstvalue.c: (gst_value_deserialize_fraction):
+ Support 'MIN' and 'MAX' for deserialising fractions.
+
2005-11-22 Andy Wingo <wingo@pobox.com>
* gst/gstevent.h (gst_event_new_new_segment)
diff --git a/check/gst/capslist.h b/check/gst/capslist.h
index 894a905b3..6e7beda95 100644
--- a/check/gst/capslist.h
+++ b/check/gst/capslist.h
@@ -16,7 +16,10 @@ static const gchar *caps_list[] = {
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]",
"video/x-raw-rgb,\\ bpp=(int)32",
"test/gst-fraction, fraction = (fraction) 1/8",
+ "test/gst-fraction, fraction = (fraction) MIN",
+ "test/gst-fraction, fraction = (fraction) MAX",
"test/gst-fraction-range, fraction = (fraction) [ 1/3, 1/4 ]",
+ "test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]",
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], 1/8 }",
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], [ 1/8, 2/8 ] }",
"ANY",
diff --git a/check/gst/gstcaps.c b/check/gst/gstcaps.c
index 75e81de95..b31da8d76 100644
--- a/check/gst/gstcaps.c
+++ b/check/gst/gstcaps.c
@@ -27,13 +27,25 @@
GST_START_TEST (test_from_string)
{
GstCaps *caps;
+ GstCaps *caps2;
+ gchar *to_str;
int i;
for (i = 0; i < G_N_ELEMENTS (caps_list); i++) {
caps = gst_caps_from_string (caps_list[i]);
fail_if (caps == NULL,
"Could not create caps from string %s\n", caps_list[i]);
+ to_str = gst_caps_to_string (caps);
+ fail_if (to_str == NULL,
+ "Could not convert caps back to string %s\n", caps_list[i]);
+ caps2 = gst_caps_from_string (caps_list[i]);
+ fail_if (caps2 == NULL, "Could not create caps from string %s\n", to_str);
+
+ fail_unless (gst_caps_is_equal (caps, caps2));
+
g_free (caps);
+ g_free (caps2);
+ g_free (to_str);
}
}
diff --git a/gst/gststructure.c b/gst/gststructure.c
index 23f728c2d..5141caba8 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -1286,6 +1286,8 @@ gst_structure_value_get_generic_type (GValue * val)
return G_TYPE_INT;
} else if (G_VALUE_TYPE (val) == GST_TYPE_DOUBLE_RANGE) {
return G_TYPE_DOUBLE;
+ } else if (G_VALUE_TYPE (val) == GST_TYPE_FRACTION_RANGE) {
+ return GST_TYPE_FRACTION;
}
return G_VALUE_TYPE (val);
}
diff --git a/gst/gstvalue.c b/gst/gstvalue.c
index 8a864e10a..9454da106 100644
--- a/gst/gstvalue.c
+++ b/gst/gstvalue.c
@@ -3344,6 +3344,13 @@ gst_value_deserialize_fraction (GValue * dest, const char *s)
gst_value_set_fraction (dest, num, 1);
return TRUE;
}
+ if (g_ascii_strcasecmp (s, "min") == 0) {
+ gst_value_set_fraction (dest, -G_MAXINT, 1);
+ return TRUE;
+ } else if (g_ascii_strcasecmp (s, "max") == 0) {
+ gst_value_set_fraction (dest, G_MAXINT, 1);
+ return TRUE;
+ }
return FALSE;
}
diff --git a/tests/check/gst/capslist.h b/tests/check/gst/capslist.h
index 894a905b3..6e7beda95 100644
--- a/tests/check/gst/capslist.h
+++ b/tests/check/gst/capslist.h
@@ -16,7 +16,10 @@ static const gchar *caps_list[] = {
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]",
"video/x-raw-rgb,\\ bpp=(int)32",
"test/gst-fraction, fraction = (fraction) 1/8",
+ "test/gst-fraction, fraction = (fraction) MIN",
+ "test/gst-fraction, fraction = (fraction) MAX",
"test/gst-fraction-range, fraction = (fraction) [ 1/3, 1/4 ]",
+ "test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]",
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], 1/8 }",
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], [ 1/8, 2/8 ] }",
"ANY",
diff --git a/tests/check/gst/gstcaps.c b/tests/check/gst/gstcaps.c
index 75e81de95..b31da8d76 100644
--- a/tests/check/gst/gstcaps.c
+++ b/tests/check/gst/gstcaps.c
@@ -27,13 +27,25 @@
GST_START_TEST (test_from_string)
{
GstCaps *caps;
+ GstCaps *caps2;
+ gchar *to_str;
int i;
for (i = 0; i < G_N_ELEMENTS (caps_list); i++) {
caps = gst_caps_from_string (caps_list[i]);
fail_if (caps == NULL,
"Could not create caps from string %s\n", caps_list[i]);
+ to_str = gst_caps_to_string (caps);
+ fail_if (to_str == NULL,
+ "Could not convert caps back to string %s\n", caps_list[i]);
+ caps2 = gst_caps_from_string (caps_list[i]);
+ fail_if (caps2 == NULL, "Could not create caps from string %s\n", to_str);
+
+ fail_unless (gst_caps_is_equal (caps, caps2));
+
g_free (caps);
+ g_free (caps2);
+ g_free (to_str);
}
}