[vlc-commits] stream_filter/httplive.c: Improve detection of HTTP Live Streaming detection to all EXT-X tags.

Jean-Paul Saman git at videolan.org
Fri Feb 11 10:14:07 CET 2011


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Jan 26 13:56:40 2011 +0100| [ba75ce0f0766cfeb2ab9487347aa0e3d5ff7370f] | committer: Jean-Paul Saman

stream_filter/httplive.c: Improve detection of HTTP Live Streaming detection to all EXT-X tags.

Improve detection of HTTP Live Streaming detection to all EXT-X tags.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba75ce0f0766cfeb2ab9487347aa0e3d5ff7370f
---

 modules/stream_filter/httplive.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 0df42a0..25c37d4 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -148,6 +148,17 @@ static void segment_Free(segment_t *segment);
 /****************************************************************************
  *
  ****************************************************************************/
+static const char *const ext[] = {
+    "#EXT-X-TARGETDURATION",
+    "#EXT-X-MEDIA-SEQUENCE",
+    "#EXT-X-KEY",
+    "#EXT-X-ALLOW-CACHE",
+    "#EXT-X-ENDLIST",
+    "#EXT-X-STREAM-INF",
+    "#EXT-X-DISCONTINUITY",
+    "#EXT-X-VERSION"
+};
+
 static bool isHTTPLiveStreaming(stream_t *s)
 {
     const uint8_t *peek, *peek_end;
@@ -167,10 +178,12 @@ static bool isHTTPLiveStreaming(stream_t *s)
     {
         if (*peek == '#')
         {
-            if (strncasecmp((const char*)peek, "#EXT-X-TARGETDURATION", 21) == 0)
-                return true;
-            else if (strncasecmp((const char*)peek, "#EXT-X-STREAM-INF", 17) == 0)
-                return true;
+            for (unsigned int i = 0; i < ARRAY_SIZE(ext); i++)
+            {
+                char *p = strstr((const char*)peek, ext[i]);
+                if (p != NULL)
+                    return true;
+            }
         }
         peek++;
     };



More information about the vlc-commits mailing list