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

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


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

asx: retrieve Content-Type only once

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

 modules/demux/playlist/asx.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index 7d7863e8f7..3d78dde738 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -148,19 +148,25 @@ int Import_ASX( vlc_object_t *p_this )
     demux_t *p_demux = (demux_t *)p_this;
 
     CHECK_FILE();
-    if( demux_IsPathExtension( p_demux, ".asx" ) ||
-        demux_IsPathExtension( p_demux, ".wax" ) ||
-        demux_IsPathExtension( p_demux, ".wvx" ) ||
-        (
-          ( CheckMimeType( p_demux->s, "video/x-ms-asf" ) ||
-            CheckMimeType( p_demux->s, "audio/x-ms-wax" ) ) && PeekASX( p_demux )
-        ) ||
-        demux_IsForced( p_demux, "asx-open" ) )
+
+    char *type = stream_MimeType( p_demux->s );
+
+    if( demux_IsPathExtension( p_demux, ".asx" )
+     || demux_IsPathExtension( p_demux, ".wax" )
+     || demux_IsPathExtension( p_demux, ".wvx" )
+     || (type != NULL && (strcasecmp(type, "video-x-ms-asf") == 0
+                       || strcasecmp(type, "audio/x-ms-wax") == 0)
+                      && PeekASX( p_demux ) )
+     || demux_IsForced( p_demux, "asx-open" ) )
     {
         msg_Dbg( p_demux, "found valid ASX playlist" );
+        free(type);
     }
     else
+    {
+        free(type);
         return VLC_EGENERIC;
+    }
 
     p_demux->pf_control = Control;
     p_demux->pf_demux = Demux;



More information about the vlc-commits mailing list