X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fplaylist%2Fold.c;h=2a76a9fcaa7a15b18f923ac8ab794b292c6bb854;hb=f0ddd6157663426507a2ac18ef1341e69fbed2bf;hp=644fecf59cca02acadab15bf33ee11b225f6ae2f;hpb=91f2877dec9e00d081facbb7b12f610a9f329357;p=vlc diff --git a/modules/demux/playlist/old.c b/modules/demux/playlist/old.c index 644fecf59c..2a76a9fcaa 100644 --- a/modules/demux/playlist/old.c +++ b/modules/demux/playlist/old.c @@ -1,10 +1,10 @@ /***************************************************************************** * old.c : Old playlist format import ***************************************************************************** - * Copyright (C) 2004 VideoLAN + * Copyright (C) 2004 the VideoLAN team * $Id$ * - * Authors: Clément Stenac + * Authors: Clément Stenac * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,43 +18,38 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ - #include #include #include - -#include /* ENOMEM */ +#include "charset.h" #define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5" /***************************************************************************** * Local prototypes *****************************************************************************/ -int Import_Old ( vlc_object_t * ); static int Demux( demux_t *p_demux); static int Control( demux_t *p_demux, int i_query, va_list args ); /***************************************************************************** * Import_Old : main import function *****************************************************************************/ -int Import_Old( vlc_object_t *p_this ) +int E_(Import_Old)( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; uint8_t *p_peek; if( stream_Peek( p_demux->s, &p_peek, 31 ) < 31 ) return VLC_EGENERIC; - if( strncmp( p_peek, PLAYLIST_FILE_HEADER , 31 ) ) return VLC_EGENERIC; + if( strncmp( (char *)p_peek, PLAYLIST_FILE_HEADER , 31 ) ) return VLC_EGENERIC; msg_Dbg( p_demux, "found valid old playlist file"); - p_demux->pf_control = Control; p_demux->pf_demux = Demux; @@ -68,16 +63,17 @@ static int Demux( demux_t *p_demux) playlist_t *p_playlist; p_playlist = (playlist_t*)vlc_object_find( p_demux, - VLC_OBJECT_PLAYLIST, FIND_PARENT ); + VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( !p_playlist ) { msg_Err( p_demux, "cannot attach playlist" ); return VLC_EGENERIC; } - p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE; while( ( psz_line = stream_ReadLine( p_demux->s) ) != NULL ) { + char *psz_unicode; + if( ( psz_line[0] == '#' ) || (psz_line[0] == '\r') || ( psz_line[0] == '\n') || (psz_line[0] == (char)0) ) { @@ -91,10 +87,13 @@ static int Demux( demux_t *p_demux) if( psz_line[strlen(psz_line) - 1 ] == '\r' ) psz_line[strlen(psz_line) - 1 ] = (char)0; } - playlist_Add( p_playlist, psz_line, psz_line, PLAYLIST_APPEND, - PLAYLIST_END ); + + psz_unicode = FromLocale( psz_line ); +// playlist_Add( p_playlist, psz_unicode, psz_unicode, PLAYLIST_APPEND, +// PLAYLIST_END ); free( psz_line ); + LocaleFree( psz_line ); } p_demux->b_die = VLC_TRUE;