X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fplaylist%2Fwpl.c;h=7f30facf433f1b21a4f570578b27378904d262db;hb=b0eb44053c3fffdf04b00f5e0cd1986c7fdf848f;hp=86ac85bb1a08a72443427296b7b1e5064c1d6e4a;hpb=120876d136ce7537715f55bf0864f9a93074da91;p=vlc diff --git a/modules/demux/playlist/wpl.c b/modules/demux/playlist/wpl.c index 86ac85bb1a..7f30facf43 100644 --- a/modules/demux/playlist/wpl.c +++ b/modules/demux/playlist/wpl.c @@ -30,7 +30,6 @@ #include #include -#include #include "playlist.h" @@ -44,7 +43,6 @@ struct demux_sys_t *****************************************************************************/ static int Demux( demux_t *p_demux); static int Control( demux_t *p_demux, int i_query, va_list args ); -static char* ParseUriValue(char* psz_string); /***************************************************************************** * Import_WPL: main import function @@ -52,8 +50,6 @@ static char* ParseUriValue(char* psz_string); int Import_WPL( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; - const uint8_t *p_peek; - CHECK_PEEK( p_peek, 8 ); if(! ( demux_IsPathExtension( p_demux, ".wpl" ) || demux_IsForced( p_demux, "wpl" ))) return VLC_EGENERIC; @@ -76,31 +72,16 @@ void Close_WPL( vlc_object_t *p_this ) free( p_demux->p_sys ); } -static inline void MaybeFromLocaleRep (char **str) -{ - char *const orig_str = *str; - - if ((orig_str != NULL) && !IsUTF8 (orig_str)) - { - *str = FromLocaleDup (orig_str); - free (orig_str); - } -} - - static int Demux( demux_t *p_demux ) { char *psz_line; - char *psz_uri = NULL; - char *psz_parse; - input_item_t *p_input; + input_item_t *p_current_input = GetCurrentItem(p_demux); - INIT_PLAYLIST_STUFF; + input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); - psz_line = stream_ReadLine( p_demux->s ); - while( psz_line ) + while( (psz_line = stream_ReadLine( p_demux->s )) ) { - psz_parse = psz_line; + char *psz_parse = psz_line; /* Skip leading tabs and spaces */ while( *psz_parse == ' ' || *psz_parse == '\t' || *psz_parse == '\n' || *psz_parse == '\r' ) @@ -109,24 +90,30 @@ static int Demux( demux_t *p_demux ) /* if the line is the uri of the media item */ if( !strncasecmp( psz_parse, "p_sys->psz_prefix ); - MaybeFromLocaleRep( &psz_uri ); p_input = input_item_NewExt( p_demux, psz_uri, psz_uri, 0, NULL, 0, -1 ); - input_item_AddSubItem( p_current_input, p_input ); + input_item_node_AppendItem( p_subitems, p_input ); + vlc_gc_decref( p_input ); } - free( psz_uri ); } /* Fetch another line */ free( psz_line ); - psz_line = stream_ReadLine( p_demux->s ); } - HANDLE_PLAY_AND_RELEASE; + + input_item_node_PostAndDelete( p_subitems ); + + vlc_gc_decref(p_current_input); var_Destroy( p_demux, "wpl-extvlcopt" ); return 0; /* Needed for correct operation of go back */ } @@ -136,19 +123,3 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args); return VLC_EGENERIC; } - -static char* ParseUriValue( char* psz_string ) -{ - int i_len = strlen( psz_string ); - if( i_len <= 3 ) - return NULL; - char* psz_value = calloc( i_len, 1 ); - if( !psz_value ) - return NULL; - - sscanf( psz_string, "%*[^=]=\"%[^\r\t\n\"]", psz_value ); - - return psz_value; -} - -