[gst-cvs] gst-plugins-base: typefindfunctions: Also detect SVG by the <svg> starting tag

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Aug 12 03:11:16 PDT 2009


Module: gst-plugins-base
Branch: master
Commit: 3b4c35e319809ff8bdc00fb364e9140cb9a4c2d7
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=3b4c35e319809ff8bdc00fb364e9140cb9a4c2d7

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Aug 12 12:09:45 2009 +0200

typefindfunctions: Also detect SVG by the <svg> starting tag

Not all SVG images have the DOCTYPE specified.

---

 gst/typefind/gsttypefindfunctions.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c
index 88b7b21..e308826 100644
--- a/gst/typefind/gsttypefindfunctions.c
+++ b/gst/typefind/gsttypefindfunctions.c
@@ -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);
   }





More information about the Gstreamer-commits mailing list