[vlc-devel] [PATCH 1/4] xspf: add MIME detection

Rafaël Carré funman at videolan.org
Sat Oct 19 12:09:05 CEST 2013


Hello,

Le 18/10/2013 05:04, Edward Wang a écrit :
> ---
>  modules/demux/playlist/xspf.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
> index 8606759..b41b36c 100644
> --- a/modules/demux/playlist/xspf.c
> +++ b/modules/demux/playlist/xspf.c
> @@ -84,6 +84,19 @@ static int Demux(demux_t *);
>   */
>  int Import_xspf(vlc_object_t *p_this)
>  {
> +    char* mimetype = NULL;
> +    {

I had some trouble understanding why you add apparently undeeded braces
here but then I saw that the DEMUX_BY_EXTENSION.. macro declares a
p_demux already.

I think it would be better to use the same style and add a macro, e.g.
DEMUX_BY_EXTENSION_OR_MIMETYPE_OR_FORCED_MSG.

And since DEMUX_BY_EXTENSION_MSG is not used anywhere it should be
removed, then "_OR_FORCED" could be dropped from the name so it's shorter.

Also the new macro should use strcasecmp like is done in m3u playlist demux.


Else in principle the patchset looks ok

> +        demux_t *p_demux = (demux_t *)p_this;
> +
> +        mimetype = stream_ContentType( p_demux->s );
> +        if( mimetype && !strcmp( "application/xspf+xml", mimetype ) ) {
> +            free( mimetype );
> +            STANDARD_DEMUX_INIT_MSG( "using XSPF playlist reader" );
> +            return VLC_SUCCESS;
> +        }
> +    }
> +    free( mimetype );
> +
>      DEMUX_BY_EXTENSION_OR_FORCED_MSG(".xspf", "xspf-open",
>                                        "using XSPF playlist reader");
>      return VLC_SUCCESS;
> 




More information about the vlc-devel mailing list