changeset 7169:35bab6be713b

add subtitle dropping support
author pontscho
date Fri, 30 Aug 2002 19:11:03 +0000
parents cb1428dd4d79
children 4ae1a0fecac5
files Gui/events.c Gui/events.h Gui/interface.c Gui/mplayer/gtk/menu.c Gui/mplayer/gtk/pl.c Gui/mplayer/mw.h help_mp-en.h help_mp-hu.h
diffstat 8 files changed, 39 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/events.c	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/events.c	Fri Aug 30 19:11:03 2002 +0000
@@ -47,7 +47,8 @@
   { evPlayDVD,		 "evPlayDVD"	       },
   { evPlayVCD,		 "evPlayVCD"	       },
   { evSetURL,		 "evSetURL"	       },
-  { evLoadAudioFile,	 "evLoadAudioFile"     }
+  { evLoadAudioFile,	 "evLoadAudioFile"     },
+  { evDropSubtitle,      "evDropSubtitle"      }
  };
 
 int evBoxs = sizeof( evNames ) / sizeof( evName );
--- a/Gui/events.h	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/events.h	Fri Aug 30 19:11:03 2002 +0000
@@ -47,10 +47,12 @@
 #define evHelp              37
 
 #define evLoadSubtitle      38
+#define evDropSubtitle      43
 #define evPlayDVD           39
 #define evPlayVCD	    40
 #define evPlayNetwork       41
 #define evLoadAudioFile	    42
+// 44 ...
 
 #define evExit              1000
 
--- a/Gui/interface.c	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/interface.c	Fri Aug 30 19:11:03 2002 +0000
@@ -20,6 +20,7 @@
 #include "../libvo/x11_common.h"
 #include "../libvo/video_out.h"
 #include "../libvo/font_load.h"
+#include "../libvo/sub.h"
 #include "../input/input.h"
 #include "../libao2/audio_out.h"
 #include "../mixer.h"
@@ -239,6 +240,8 @@
 #endif
 
 #ifdef USE_SUB
+extern mp_osd_obj_t* vo_osd_list;
+
 void guiLoadSubtitle( char * name )
 {
  if ( guiIntfStruct.Playing == 0 )
@@ -248,14 +251,34 @@
   }
  if ( subtitles )
   {
+   mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" );
    sub_free( subtitles );
-   if ( sub_name ) free( sub_name );
+   subtitles=NULL;
    sub_name=NULL;
    vo_sub=NULL;
-   subtitles=NULL;
+   if ( vo_osd_list )
+    {
+     int len;
+     mp_osd_obj_t * osd = vo_osd_list;
+     while ( osd )
+      {
+       if ( osd->type == OSDTYPE_SUBTITLE ) break;
+       osd=osd->next;
+      }
+     if ( osd && osd->flags&OSDFLAG_VISIBLE )
+      {
+       len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 );
+       memset( osd->bitmap_buffer,0,len );
+       memset( osd->alpha_buffer,0,len );
+      }
+    }
   }
- sub_name=gstrdup( name );
- subtitles=sub_read_file( sub_name,guiIntfStruct.FPS );
+ 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 );
+  }
 }
 #endif
 
--- a/Gui/mplayer/gtk/menu.c	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/mplayer/gtk/menu.c	Fri Aug 30 19:11:03 2002 +0000
@@ -282,6 +282,7 @@
 #endif
     AddMenuItem( SubMenu,MSGTR_MENU_PlayURL, evSetURL );
     AddMenuItem( SubMenu,MSGTR_MENU_LoadSubtitle"   ", evLoadSubtitle );
+    AddMenuItem( SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
     AddMenuItem( SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
    SubMenu=AddSubMenu( Menu,MSGTR_MENU_Playing );
     AddMenuItem( SubMenu,MSGTR_MENU_Play"        ", evPlay );
--- a/Gui/mplayer/gtk/pl.c	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/mplayer/gtk/pl.c	Fri Aug 30 19:11:03 2002 +0000
@@ -638,7 +638,7 @@
   GTK_WIDGET_UNSET_FLAGS( Ok,GTK_CAN_FOCUS );
 //  gtk_widget_add_accelerator( Ok,"released",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
 
-  Cancel=gtk_button_new_with_label( "Cancel" );
+  Cancel=gtk_button_new_with_label( MSGTR_Cancel );
   gtk_widget_ref( Cancel );
   gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Cancel",Cancel,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( Cancel );
--- a/Gui/mplayer/mw.h	Fri Aug 30 14:35:17 2002 +0000
+++ b/Gui/mplayer/mw.h	Fri Aug 30 19:11:03 2002 +0000
@@ -356,6 +356,10 @@
         gtkShow( evLoad,NULL );
         break;
    case evLoadSubtitle:  gtkShow( evLoadSubtitle,NULL );  break;
+   case evDropSubtitle:
+	gfree( (void **)&guiIntfStruct.Subtitlename );
+	guiLoadSubtitle( NULL );
+	break;
    case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
    case evPrev: mplPrev(); break;
    case evNext: mplNext(); break;
--- a/help_mp-en.h	Fri Aug 30 14:35:17 2002 +0000
+++ b/help_mp-en.h	Fri Aug 30 19:11:03 2002 +0000
@@ -391,6 +391,7 @@
 #define MSGTR_MENU_PlayDVD "Play DVD ..."
 #define MSGTR_MENU_PlayURL "Play URL ..."
 #define MSGTR_MENU_LoadSubtitle "Load subtitle ..."
+#define MSGTR_MENU_DropSubtitle "Drop subtitle ..."
 #define MSGTR_MENU_LoadExternAudioFile "Load external audio file ..."
 #define MSGTR_MENU_Playing "Playing"
 #define MSGTR_MENU_Play "Play"
--- a/help_mp-hu.h	Fri Aug 30 14:35:17 2002 +0000
+++ b/help_mp-hu.h	Fri Aug 30 19:11:03 2002 +0000
@@ -294,6 +294,7 @@
 #define MSGTR_MENU_PlayDVD "DVD lejátszás ..."  
 #define MSGTR_MENU_PlayURL "URL lejátszás ..."  
 #define MSGTR_MENU_LoadSubtitle "Felirat betöltése ..."
+#define MSGTR_MENU_DropSubtitle "Felirat eldobása ..."
 #define MSGTR_MENU_LoadExternAudioFile "Külső hang betöltése ..."
 #define MSGTR_MENU_Playing "Lejátszás"
 #define MSGTR_MENU_Play "Lejátszás"