value: Add support for parsing short fourccs from strings
authorMartin Bisson <martin.bisson@gmail.com>
Mon, 7 Jun 2010 06:18:40 +0000 (08:18 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 7 Jun 2010 06:21:00 +0000 (08:21 +0200)
For example "Y16 " and "Y8  ".

gst/gstvalue.c

index 383b88a..05b76ef 100644 (file)
@@ -727,6 +727,15 @@ gst_value_deserialize_fourcc (GValue * dest, const char *s)
   if (strlen (s) == 4) {
     fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
     ret = TRUE;
+  } else if (strlen (s) == 3) {
+    fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], ' ');
+    ret = TRUE;
+  } else if (strlen (s) == 2) {
+    fourcc = GST_MAKE_FOURCC (s[0], s[1], ' ', ' ');
+    ret = TRUE;
+  } else if (strlen (s) == 1) {
+    fourcc = GST_MAKE_FOURCC (s[0], ' ', ' ', ' ');
+    ret = TRUE;
   } else if (g_ascii_isdigit (*s)) {
     fourcc = strtoul (s, &end, 0);
     if (*end == 0) {