From 3f4505eabb260dca3cc0714d36f9c76632821771 Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 7 Apr 2003 16:04:02 +0000 Subject: support for multiple subtitle files by Marcin Wojdyr git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9871 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/interface.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'Gui/interface.c') diff --git a/Gui/interface.c b/Gui/interface.c index 5313df7048..63777a7684 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -328,7 +328,7 @@ void guiInit( void ) if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE ); if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); - if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); + if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename ); #if defined( USE_OSD ) || defined( USE_SUB ) guiLoadFont(); #endif @@ -416,19 +416,20 @@ void guiLoadFont( void ) #ifdef USE_SUB extern mp_osd_obj_t* vo_osd_list; +extern char **sub_name; + void guiLoadSubtitle( char * name ) { if ( guiIntfStruct.Playing == 0 ) { - guiIntfStruct.SubtitleChanged=1; + guiIntfStruct.SubtitleChanged=1; //what is this for? (mw) return; } - if ( subtitles ) + if ( subdata ) { mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" ); - sub_free( subtitles ); - subtitles=NULL; - gfree( (void **)&sub_name ); + sub_free( subdata ); + subdata=NULL; vo_sub=NULL; if ( vo_osd_list ) { @@ -449,11 +450,15 @@ void guiLoadSubtitle( char * name ) } if ( name ) { - mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name ); - sub_name=gstrdup( name ); - subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); - if ( !subtitles ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); + mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Load subtitle: %s\n",name ); + subdata=sub_read_file( gstrdup( name ), guiIntfStruct.FPS ); + if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); + sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted + sub_name[0] = strdup(name); //sub_name[0] will be read + sub_name[1] = NULL; } + update_set_of_subtitles(); + } #endif @@ -797,7 +802,7 @@ int guiGetEvent( int type,char * arg ) #endif // -- subtitle #ifdef USE_SUB - sub_name=gstrdup( guiIntfStruct.Subtitlename ); + //subdata->filename=gstrdup( guiIntfStruct.Subtitlename ); stream_dump_type=0; if ( gtkSubDumpMPSub ) stream_dump_type=4; if ( gtkSubDumpSrt ) stream_dump_type=6; -- cgit v1.2.3