changeset 7150:b212f74e14ec

- add play time subtitle change support - better language support
author pontscho
date Thu, 29 Aug 2002 22:24:49 +0000
parents aa9debe16559
children 9e17b153b785
files Gui/interface.c Gui/interface.h Gui/mplayer/gtk/fs.c Gui/mplayer/mw.h help_mp-en.h help_mp-hu.h mplayer.c mplayer.h
diffstat 8 files changed, 58 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Thu Aug 29 21:37:45 2002 +0000
+++ b/Gui/interface.c	Thu Aug 29 22:24:49 2002 +0000
@@ -238,6 +238,27 @@
 }
 #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 @@
 	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 @@
 	        break;
 	       }
 #endif
+	  default: break;
 	 }
 	break;
    case guiIEvent:
@@ -391,6 +415,8 @@
 // -- 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 )
--- a/Gui/interface.h	Thu Aug 29 21:37:45 2002 +0000
+++ b/Gui/interface.h	Thu Aug 29 22:24:49 2002 +0000
@@ -86,6 +86,7 @@
    int    LengthInSec;
    int    FrameDrop;
    int    FileFormat;
+   float  FPS;
 
    char * Filename;
    int    FilenameChanged;
--- a/Gui/mplayer/gtk/fs.c	Thu Aug 29 21:37:45 2002 +0000
+++ b/Gui/mplayer/gtk/fs.c	Thu Aug 29 22:24:49 2002 +0000
@@ -431,10 +431,12 @@
 	  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;
--- a/Gui/mplayer/mw.h	Thu Aug 29 21:37:45 2002 +0000
+++ b/Gui/mplayer/mw.h	Thu Aug 29 22:24:49 2002 +0000
@@ -33,20 +33,20 @@
 	     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 )
   {
--- a/help_mp-en.h	Thu Aug 29 21:37:45 2002 +0000
+++ b/help_mp-en.h	Thu Aug 29 22:24:49 2002 +0000
@@ -336,6 +336,11 @@
 #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"
--- a/help_mp-hu.h	Thu Aug 29 21:37:45 2002 +0000
+++ b/help_mp-hu.h	Thu Aug 29 22:24:49 2002 +0000
@@ -228,7 +228,7 @@
 #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 @@
 #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 @@
 #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"
--- a/mplayer.c	Thu Aug 29 21:37:45 2002 +0000
+++ b/mplayer.c	Thu Aug 29 22:24:49 2002 +0000
@@ -251,6 +251,10 @@
 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 @@
 
 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 ( subtitles ) 
    {
     sub_free( subtitles );
+    if ( sub_name ) free( sub_name );
     sub_name=NULL;
     vo_sub=NULL;
     subtitles=NULL;
--- a/mplayer.h	Thu Aug 29 21:37:45 2002 +0000
+++ b/mplayer.h	Thu Aug 29 22:24:49 2002 +0000
@@ -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 int    sub_auto;
 extern int    sub_pos;
 extern int    sub_unicode;
+extern subtitle* subtitles;
+extern subtitle* vo_sub;
 
 extern char * filename;