[vlc-commits] m3u: check for BOM regardless of .m3u8 extension

Rémi Denis-Courmont git at videolan.org
Sun Oct 4 14:37:54 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct  4 15:35:51 2020 +0300| [981c2a09ad18ee20fe9820951515de714a847503] | committer: Rémi Denis-Courmont

m3u: check for BOM regardless of .m3u8 extension

Refs #21860.

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

 modules/demux/playlist/m3u.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index f62b134c69..b56e1c13e1 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -69,10 +69,6 @@ int Import_M3U( vlc_object_t *p_this )
     /* Encoding: UTF-8 or unspecified */
     char *(*pf_dup) (const char *) = GuessEncoding;
 
-    if (stream_HasExtension(p_stream, ".m3u8")
-     || strncasecmp((const char *)p_peek, "RTSPtext", 8) == 0) /* QuickTime */
-        pf_dup = CheckUnicode;
-    else
     if (memcmp( p_peek, "\xef\xbb\xbf", 3) == 0) /* UTF-8 Byte Order Mark */
     {
         if( i_peek < 12 )
@@ -83,6 +79,10 @@ int Import_M3U( vlc_object_t *p_this )
         i_peek -= offset;
     }
 
+    if (stream_HasExtension(p_stream, ".m3u8")
+     || strncasecmp((const char *)p_peek, "RTSPtext", 8) == 0) /* QuickTime */
+        pf_dup = CheckUnicode;
+
     /* File type: playlist, or not (HLS manifest or whatever else) */
     char *type = stream_MimeType(p_stream->s);
     bool match;



More information about the vlc-commits mailing list