[vlc-commits] m3u: retrieve Content-Type only once

Rémi Denis-Courmont git at videolan.org
Tue Apr 18 20:56:23 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 17 23:13:12 2017 +0300| [4af4f54bc42c907e339bf18686ec54f659501da0] | committer: Rémi Denis-Courmont

m3u: retrieve Content-Type only once

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

 modules/demux/playlist/m3u.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index d719350406..8a84d9a972 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -77,19 +77,26 @@ int Import_M3U( vlc_object_t *p_this )
         offset = 3;
     }
 
+    char *type = stream_MimeType(p_demux->s);
+
     if( demux_IsPathExtension( p_demux, ".m3u8" )
      || demux_IsForced( p_demux, "m3u8" )
-     || CheckMimeType( p_demux->s, "application/vnd.apple.mpegurl" ) )
+     || (type != NULL && strcasecmp(type, "application/vnd.apple.mpegurl")))
+    {
         pf_dup = CheckUnicode; /* UTF-8 file type */
+        free(type);
+    }
     else
     if( demux_IsPathExtension( p_demux, ".m3u" )
      || demux_IsPathExtension( p_demux, ".vlc" )
      || demux_IsForced( p_demux, "m3u" )
      || ContainsURL( p_demux )
-     || CheckMimeType( p_demux->s, "audio/x-mpegurl") )
-        ; /* Guess encoding */
+     || (type != NULL && strcasecmp(type, "audio/x-mpegurl")))
+        free(type); /* Guess encoding */
     else
     {
+        free(type);
+
         if( vlc_stream_Peek( p_demux->s, &p_peek, 8 + offset ) < (8 + offset) )
             return VLC_EGENERIC;
 



More information about the vlc-commits mailing list