From 8a147cf3f099be43ec026426ca87be4f18356025 Mon Sep 17 00:00:00 2001 From: pontscho Date: Thu, 29 Aug 2002 22:24:49 +0000 Subject: - add play time subtitle change support - better language support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7151 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/interface.c | 26 ++++++++++++++++++++++++++ Gui/interface.h | 1 + Gui/mplayer/gtk/fs.c | 4 +++- Gui/mplayer/mw.h | 10 +++++----- help_mp-en.h | 5 +++++ help_mp-hu.h | 11 ++++++++--- mplayer.c | 9 +++++---- mplayer.h | 5 +++++ 8 files changed, 58 insertions(+), 13 deletions(-) diff --git a/Gui/interface.c b/Gui/interface.c index 705f2e782b..246b8998c4 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -238,6 +238,27 @@ void guiLoadFont( void ) } #endif +#ifdef USE_SUB +void guiLoadSubtitle( char * name ) +{ + if ( guiIntfStruct.Playing == 0 ) + { + guiIntfStruct.SubtitleChanged=1; + return; + } + if ( subtitles ) + { + sub_free( subtitles ); + if ( sub_name ) free( sub_name ); + sub_name=NULL; + vo_sub=NULL; + subtitles=NULL; + } + sub_name=gstrdup( name ); + subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); +} +#endif + static void add_vop( char * str ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str ); @@ -337,9 +358,11 @@ int guiGetEvent( int type,char * arg ) guiIntfStruct.StreamType=stream->type; switch( stream->type ) { +#ifdef USE_DVDREAD case STREAMTYPE_DVD: guiGetEvent( guiSetDVD,(char *)stream->priv ); break; +#endif #ifdef HAVE_VCD case STREAMTYPE_VCD: { @@ -353,6 +376,7 @@ int guiGetEvent( int type,char * arg ) break; } #endif + default: break; } break; case guiIEvent: @@ -391,6 +415,8 @@ int guiGetEvent( int type,char * arg ) // -- video if ( arg ) { + tmp_sh_video_t * sh = (tmp_sh_video_t *)arg; + guiIntfStruct.FPS=sh->fps; if ( vo_gamma_brightness == 1000 ) { vo_gamma_brightness=0; get_video_colors( (void *)arg,"brightness",&vo_gamma_brightness ); } if ( vo_gamma_contrast == 1000 ) diff --git a/Gui/interface.h b/Gui/interface.h index d6490a5800..b6e2a2bcf8 100644 --- a/Gui/interface.h +++ b/Gui/interface.h @@ -86,6 +86,7 @@ typedef struct int LengthInSec; int FrameDrop; int FileFormat; + float FPS; char * Filename; int FilenameChanged; diff --git a/Gui/mplayer/gtk/fs.c b/Gui/mplayer/gtk/fs.c index 7ef23fb2da..1bf9ed5c79 100644 --- a/Gui/mplayer/gtk/fs.c +++ b/Gui/mplayer/gtk/fs.c @@ -431,10 +431,12 @@ void fs_Ok_released( GtkButton * button,gpointer user_data ) gfree( (void **)&guiIntfStruct.AudioFile ); gfree( (void **)&guiIntfStruct.Subtitlename ); break; +#ifdef USE_SUB case fsSubtitleSelector: guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile ); - guiIntfStruct.SubtitleChanged=1; + guiLoadSubtitle( guiIntfStruct.Subtitlename ); break; +#endif case fsOtherSelector: guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile ); break; diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index ba0ff8eed3..15f4146839 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -33,20 +33,20 @@ inline void TranslateFilename( int c,char * tmp ) else strcpy( tmp,guiIntfStruct.Filename ); if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; - } else strcpy( tmp,"no file loaded" ); + } else strcpy( tmp,MSGTR_NoFileLoaded ); break; #ifdef USE_DVDREAD case STREAMTYPE_DVD: - if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,"chapter %d",guiIntfStruct.DVD.current_chapter ); - else strcat( tmp,"no chapter" ); + if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter ); + else strcat( tmp,MSGTR_NoChapter ); break; #endif #ifdef HAVE_VCD case STREAMTYPE_VCD: - sprintf( tmp,"VCD track %d",guiIntfStruct.Track ); + sprintf( tmp,MSGTR_VCDTrack,guiIntfStruct.Track ); break; #endif - default: strcpy( tmp,"no media opened" ); + default: strcpy( tmp,MSGTR_NoMediaOpened ); } if ( c ) { diff --git a/help_mp-en.h b/help_mp-en.h index 0c7308fd46..a066ae3988 100644 --- a/help_mp-en.h +++ b/help_mp-en.h @@ -336,6 +336,11 @@ static char help_text[]= #define MSGTR_Network "Network streaming ..." #define MSGTR_Preferences "Preferences" #define MSGTR_OSSPreferences "OSS driver configuration" +#define MSGTR_NoMediaOpened "no media opened" +#define MSGTR_VCDTrack "VCD track %d" +#define MSGTR_NoChapter "no chapter" +#define MSGTR_Chapter "chapter %d" +#define MSGTR_NoFileLoaded "no file loaded" // --- buttons --- #define MSGTR_Ok "Ok" diff --git a/help_mp-hu.h b/help_mp-hu.h index 73f4fa6f4f..e452ab1daf 100644 --- a/help_mp-hu.h +++ b/help_mp-hu.h @@ -228,7 +228,7 @@ static char help_text[]= #ifdef HAVE_NEW_GUI // --- labels --- -#define MSGTR_About "A GUI-ról" +#define MSGTR_About "Az MPlayer - röl" #define MSGTR_FileSelect "File kiválasztása ..." #define MSGTR_SubtitleSelect "Felirat kiválasztása ..." #define MSGTR_OtherSelect "File kiválasztása ..." @@ -240,6 +240,11 @@ static char help_text[]= #define MSGTR_Network "Lejátszás WEB - röl ..." #define MSGTR_Preferences "Beállítások" #define MSGTR_OSSPreferences "OSS driver beállítások" +#define MSGTR_NoMediaOpened "nincs megnyitva semmi" +#define MSGTR_VCDTrack "%d. VCD track" +#define MSGTR_NoChapter "nincs megnyitott fejezet" +#define MSGTR_Chapter "%d. fejezet" +#define MSGTR_NoFileLoaded "nincs file betöltve" // --- buttons --- #define MSGTR_Ok "Ok" @@ -305,10 +310,10 @@ static char help_text[]= #define MSGTR_MENU_PlayDisc "Lemez megnyitása ..." #define MSGTR_MENU_ShowDVDMenu "DVD menű" #define MSGTR_MENU_Titles "Sávok" -#define MSGTR_MENU_Title "Sáv %2d" +#define MSGTR_MENU_Title "%2d. sáv" #define MSGTR_MENU_None "(nincs)" #define MSGTR_MENU_Chapters "Fejezetek" -#define MSGTR_MENU_Chapter "Fejezet %2d" +#define MSGTR_MENU_Chapter "%2d. fejezet" #define MSGTR_MENU_AudioLanguages "Szinkron nyelvei" #define MSGTR_MENU_SubtitleLanguages "Feliratok nyelvei" #define MSGTR_MENU_PlayList "Playlist" diff --git a/mplayer.c b/mplayer.c index e7fb868c3a..d2267365e1 100644 --- a/mplayer.c +++ b/mplayer.c @@ -251,6 +251,10 @@ int sub_auto = 1; char *vobsub_name=NULL; /*DSP!!char *dsp=NULL;*/ int subcc_enabled=0; +#ifdef USE_SUB +subtitle* subtitles=NULL; +float sub_last_pts = -303; +#endif extern char *vo_subdevice; extern char *ao_subdevice; @@ -467,10 +471,6 @@ static int libmpdemux_was_interrupted(int eof) { int main(int argc,char* argv[], char *envp[]){ -#ifdef USE_SUB -static subtitle* subtitles=NULL; -float sub_last_pts = -303; -#endif static demux_stream_t *d_audio=NULL; static demux_stream_t *d_video=NULL; @@ -2803,6 +2803,7 @@ if(use_gui || playtree_iter != NULL){ if ( subtitles ) { sub_free( subtitles ); + if ( sub_name ) free( sub_name ); sub_name=NULL; vo_sub=NULL; subtitles=NULL; diff --git a/mplayer.h b/mplayer.h index 60972adbbe..a3d412eec4 100644 --- a/mplayer.h +++ b/mplayer.h @@ -2,6 +2,9 @@ #ifndef __MPLAYER_MAIN #define __MPLAYER_MAIN +#include "libvo/sub.h" +#include "subreader.h" + extern int use_gui; extern char* current_module; extern int fullscreen; @@ -25,6 +28,8 @@ extern float sub_fps; extern int sub_auto; extern int sub_pos; extern int sub_unicode; +extern subtitle* subtitles; +extern subtitle* vo_sub; extern char * filename; -- cgit v1.2.3