From 48c9ee2154e4436506ab2608624468367ec1a626 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sat, 25 Jun 2005 13:31:08 +0000 Subject: [PATCH] shoutcast genres fix by Jonas A. Larsen --- modules/demux/playlist/b4s.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c index d30f970a85..edeba24ef5 100644 --- a/modules/demux/playlist/b4s.c +++ b/modules/demux/playlist/b4s.c @@ -48,6 +48,7 @@ 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 *get_next_token(char *cur_string); static int IsWhitespace( char *psz_string ); static void ShoutcastAdd( playlist_t *p_playlist, playlist_item_t* p_genre, playlist_item_t *p_bitrate, playlist_item_t *p_item, @@ -360,8 +361,22 @@ static int Demux( demux_t *p_demux ) vlc_input_item_CopyOptions( &p_current->input, &p_item->input ); if( b_shoutcast ) - ShoutcastAdd( p_playlist, p_genre, p_bitrate, p_item, - psz_genre, psz_bitrate ); + { + char *psz_genreToken; + char *psz_otherToken; + + + psz_genreToken = psz_genre; + + while ( psz_genreToken && ( psz_otherToken = get_next_token(psz_genreToken ))) + { + ShoutcastAdd( p_playlist, p_genre, p_bitrate, p_item, + psz_genreToken, psz_bitrate ); + + psz_genreToken = psz_otherToken; + } + } + #define FREE(a) if( a ) free( a ); a = NULL; FREE( psz_name ); FREE( psz_mrl ); @@ -410,6 +425,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) return VLC_EGENERIC; } +static char *get_next_token(char *cur_string) { + while (*cur_string && !isspace(*cur_string)) cur_string++; + if (!*cur_string) return NULL; + *cur_string++ = '\0'; + while (*cur_string && isspace(*cur_string)) cur_string++; + return cur_string; +} + static int IsWhitespace( char *psz_string ) { while( *psz_string ) -- 2.39.2