[vlc-devel] [PATCH] xspf playlist reader

Derk-Jan Hartman hartman at videolan.org
Wed Aug 27 11:51:38 CEST 2008


On 27 aug 2008, at 10:56, Petr Menšík wrote:
> Hello,
>
> i have problem with XSPF playlist format. I am using that because no
> other players do use that playlist and so i have it for VLC. I know
> there is .vlc suffix that would make it working with #M3U playlist as
> well.
>
> I have one problem there. In my playlist, i have several http urls to
> DVB-T television and have there also name of television or radio to  
> get
> better orientation. In 0.8.6 it does work well as i expected. In
> nighbuilds from last days it does read playlist, but in list is only
> last station from playlist.
>
> I take a look into sources and found some time and found possible
> problem. There is usage of i_identifier in demux/playlist/xspf.c  
> which i
> dont really understand what is there for and i dont think it should be
> there. It seems it does use it for position information. I cannot  
> prove
> that, but i think i could crash vlc using bad written playlist as  
> well,
> as it is accessing arrays without first resizing it, if index is  
> bigger
> than current size. I tried a little fix, but i am not able to force
> build system cooperate on my ubuntu hardy, so i cannot test it well. I
> am not able to compile that. Please accept it as hint what i meant or
> where problem might be, not as full working patch.
>
> I add also sample of playlist. It is validated on specification site  
> of
> xspf and should be in right format.

Seems identifier was mixed up with 4.1.1.2.14.1.1.1.9 "trackNum"
We should just add the identifier as string to the Meta info in my  
opinion.

DJ

> diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/ 
> xspf.c
> index 260c421..8188078 100644
> --- a/modules/demux/playlist/xspf.c
> +++ b/modules/demux/playlist/xspf.c
> @@ -44,7 +44,6 @@ struct demux_sys_t
> {
>     input_item_t **pp_tracklist;
>     int i_tracklist_entries;
> -    int i_identifier;
>     char * psz_base;
> };
>
> @@ -87,7 +86,6 @@ int Demux( demux_t *p_demux )
>     INIT_PLAYLIST_STUFF;
>     p_demux->p_sys->pp_tracklist = NULL;
>     p_demux->p_sys->i_tracklist_entries = 0;
> -    p_demux->p_sys->i_identifier = 0;
>     p_demux->p_sys->psz_base = NULL;
>
>     /* create new xml parser from stream */
> @@ -498,25 +496,10 @@ static bool parse_track_node COMPLEX_INTERFACE
>                 if( !strcmp( psz_name, psz_element ) )
>                 {
>                     FREE_ATT();
> -                    if( p_demux->p_sys->i_identifier <
> -                        p_demux->p_sys->i_tracklist_entries )
> -                    {
> -                        p_demux->p_sys->pp_tracklist[
> -                            p_demux->p_sys->i_identifier ] =  
> p_new_input;
> -                    }
> -                    else
> -                    {
> -                        if( p_demux->p_sys->i_identifier >
> -                            p_demux->p_sys->i_tracklist_entries )
> -                        {
> -                            p_demux->p_sys->i_tracklist_entries =
> -                                p_demux->p_sys->i_identifier;
> -                        }
> -                        INSERT_ELEM( p_demux->p_sys->pp_tracklist,
> -                                     p_demux->p_sys- 
> >i_tracklist_entries,
> -                                     p_demux->p_sys- 
> >i_tracklist_entries,
> -                                     p_new_input );
> -                    }
> +                    INSERT_ELEM( p_demux->p_sys->pp_tracklist,
> +                                 p_demux->p_sys->i_tracklist_entries,
> +                                 p_demux->p_sys->i_tracklist_entries,
> +                                 p_new_input );
>                     return true;
>                 }
>                 /* there MUST have been a start tag for that element  
> name */
> @@ -574,7 +557,13 @@ static bool parse_track_node COMPLEX_INTERFACE
>                 }
>                 else if( !strcmp( p_handler->name, "identifier" ) )
>                 {
> -                    p_demux->p_sys->i_identifier = atoi( psz_value );
> +                    /* what is this for? XSPF specification says  
> track list is
> +                     * ordered, also identifier dont have to be  
> integer and
> +                     * have different meaning than sequence number  
> of track.
> +                     * see http://www.xspf.org/xspf-v1.html#rfc.section.4.1.1.2.14.1.1.1.2
> +                     * For now, do nothing, as i dont know how we  
> can use this identifier.
> +                     * Petr Mensik <pihhan at cipis dot net>  
> 2008-08-27 */
> +                  /*  p_demux->p_sys->i_identifier =  
> atoi( psz_value ); */
>                 }
>                 else
>                 {
>
> <televize2.xspf>_______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list