[vlc-commits] playlist/m3u: add some other unofficial Content-Type values

Rémi Denis-Courmont git at videolan.org
Wed Jun 28 22:51:17 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 28 23:47:44 2017 +0300| [733b4d3691e733ba24ce657cf82bd29430dd9531] | committer: Rémi Denis-Courmont

playlist/m3u: add some other unofficial Content-Type values

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

 modules/demux/playlist/m3u.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 576f834d9d..c84e4a3bdd 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -89,26 +89,23 @@ int Import_M3U( vlc_object_t *p_this )
 
     bool b_check_hls = true;
 
-    if( (type != NULL && !strcasecmp(type, "application/x-mpegurl") ) )
-    {
-        free( type );
-        return VLC_EGENERIC;
-    }
-
     if( stream_HasExtension( p_stream, ".m3u8" ) )
-    {
         pf_dup = CheckUnicode; /* UTF-8 file type */
-    }
-    else if( stream_HasExtension( p_stream, ".vlc" ) )
-    {
+    else
+    if (stream_HasExtension(p_stream, ".vlc"))
         b_check_hls = false;
-    }
-    else if( !stream_HasExtension( p_stream, ".m3u" ) &&
-             !ContainsURL( p_stream, p_peek, i_peek ) &&
-             (type == NULL || strcasecmp(type, "audio/x-mpegurl") ) &&
-             !p_stream->obj.force )
-    {
-        /* Guess encoding */
+    else
+    if (stream_HasExtension(p_stream, ".m3u")
+     || p_stream->obj.force
+     || (type != NULL
+      && (!vlc_ascii_strcasecmp(type, "application/mpegurl")
+       || !vlc_ascii_strcasecmp(type, "application/x-mpegurl")
+       || !vlc_ascii_strcasecmp(type, "audio/mpegurl")
+       || !vlc_ascii_strcasecmp(type, "audio/x-mpegurl")))
+     || ContainsURL(p_stream, p_peek, i_peek))
+        ;
+    else
+    {   /* Guess encoding */
         p_peek += offset;
 
         if( !strncasecmp( (const char *)p_peek, "RTSPtext", 8 ) ) /* QuickTime */



More information about the vlc-commits mailing list