]> git.sesse.net Git - vlc/commitdiff
Dash: Simplify Dash detection
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Nov 2011 15:34:57 +0000 (16:34 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Nov 2011 16:04:13 +0000 (17:04 +0100)
It should be faster and matches better the other stream filters

modules/stream_filter/dash/xml/DOMParser.cpp

index b3a6e16d6e776dd7815a2dbf44db2a53b5ebafbf..5288f2895f5da2378e8f3cd1805829e23b9a6972 100644 (file)
@@ -141,20 +141,13 @@ Profile DOMParser::getProfile               (dash::xml::Node *node)
 }
 bool    DOMParser::isDash                   (stream_t *stream)
 {
-    const uint8_t *peek, *peek_end;
+    const uint8_t *peek;
 
-    int64_t i_size = stream_Peek(stream, &peek, 2048);
-    if(i_size < 1)
+    const char* psz_namespace = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011";
+    if(stream_Peek(stream, &peek, 1024) < (int)strlen(psz_namespace))
         return false;
 
-    peek_end = peek + i_size;
-    while(peek <= peek_end)
-    {
-        const char *p = strstr((const char*)peek, "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011");
-        if (p != NULL)
-            return true;
-        peek++;
-    };
+    const char *p = strstr((const char*)peek, psz_namespace );
 
-    return false;
+    return p != NULL;
 }