From: Jean-Baptiste Kempf Date: Thu, 17 Nov 2011 15:34:57 +0000 (+0100) Subject: Dash: Simplify Dash detection X-Git-Tag: 1.3.0-git~276 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f45bf0377f5598dd4cdd16d30a4b88c37307c95e;p=vlc Dash: Simplify Dash detection It should be faster and matches better the other stream filters --- diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp index b3a6e16d6e..5288f2895f 100644 --- a/modules/stream_filter/dash/xml/DOMParser.cpp +++ b/modules/stream_filter/dash/xml/DOMParser.cpp @@ -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; }