[vlc-commits] Dash: Simplify Dash detection
Jean-Baptiste Kempf
git at videolan.org
Thu Nov 17 17:04:53 CET 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Nov 17 16:34:57 2011 +0100| [f45bf0377f5598dd4cdd16d30a4b88c37307c95e] | committer: Jean-Baptiste Kempf
Dash: Simplify Dash detection
It should be faster and matches better the other stream filters
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f45bf0377f5598dd4cdd16d30a4b88c37307c95e
---
modules/stream_filter/dash/xml/DOMParser.cpp | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp
index b3a6e16..5288f28 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;
}
More information about the vlc-commits
mailing list