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

Not all SVG images have the DOCTYPE specified.
This commit is contained in:
Sebastian Dröge 2009-08-12 12:09:45 +02:00
parent cb19626c8c
commit 3b4c35e319

View 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);
}