typefindfunctions: Also detect SVG by the <svg> starting tag
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 12 Aug 2009 10:09:45 +0000 (12:09 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 12 Aug 2009 10:11:08 +0000 (12:11 +0200)
Not all SVG images have the DOCTYPE specified.

gst/typefind/gsttypefindfunctions.c

index 88b7b21..e308826 100644 (file)
@@ -1280,6 +1280,7 @@ static void
 svg_type_find (GstTypeFind * tf, gpointer unused)
 {
   static const gchar svg_doctype[] = "!DOCTYPE svg";
+  static const gchar svg_tag[] = "<svg";
   DataScanCtx c = { 0, NULL, 0 };
 
   while (c.offset <= 1024) {
@@ -1289,6 +1290,9 @@ svg_type_find (GstTypeFind * tf, gpointer unused)
     if (memcmp (svg_doctype, c.data, 12) == 0) {
       gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SVG_CAPS);
       return;
+    } else if (memcmp (svg_tag, c.data, 4) == 0) {
+      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, SVG_CAPS);
+      return;
     }
     data_scan_ctx_advance (tf, &c, 1);
   }