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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Apr 19 11:14:35 CEST 2017


On Tue, Apr 18, 2017, at 08:56 PM, Rémi Denis-Courmont wrote:
> 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;
>  

Both chunk seem to invert the logic, and break m3u playback.

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list