changeset 8423:c6a1a5b6ba25

- fix three submenu bug - audio/video track hiding - normal/double/fullscreen handling - dvd audio channel setting bug - fix file/url/vcd/dvd playing - fix variables initialization - some small bug fix - applied some patch from R¸«ädiger Kuhlmann
author pontscho
date Wed, 11 Dec 2002 01:21:12 +0000
parents 1f1cc58e8e65
children 1994e65f3fa7
files Gui/app.h Gui/interface.c Gui/interface.h Gui/mplayer/gtk/menu.c Gui/mplayer/mw.c Gui/mplayer/play.c Gui/skin/skin.c mplayer.c mplayer.h
diffstat 9 files changed, 109 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/app.h	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/app.h	Wed Dec 11 01:21:12 2002 +0000
@@ -58,7 +58,7 @@
 #define evLoadAudioFile	    42
 #define evSetAspect         44
 #define evSetAudio	    45
-#define evSetVideo          46
+#define evSetVideo	    46
 // 47 ...
 
 #define evExit              1000
--- a/Gui/interface.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/interface.c	Wed Dec 11 01:21:12 2002 +0000
@@ -13,6 +13,7 @@
 #include "mplayer/gtk/eq.h"
 #include "mplayer/widgets.h"
 #include "mplayer/mplayer.h"
+#include "mplayer/play.h"
 
 #include "../mplayer.h"
 #include "app.h"
@@ -264,6 +265,7 @@
  mplSubRender=1;
 // ---
 
+ 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 defined( USE_OSD ) || defined( USE_SUB )
@@ -435,10 +437,11 @@
    case guiCEvent:
         switch ( (int)arg )
 	 {
-          case guiSetPlay:  guiIntfStruct.Playing=1; mplState(); break;
-          case guiSetStop:  guiIntfStruct.Playing=0; mplState(); break;
-          case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
+          case guiSetPlay:  guiIntfStruct.Playing=1; break;
+          case guiSetStop:  guiIntfStruct.Playing=0; break;
+          case guiSetPause: guiIntfStruct.Playing=2; break;
 	 }
+	mplState();
         break;
    case guiSetState:
 	mplState();
@@ -451,9 +454,6 @@
 	if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
 	  else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
 	break;
-   case guiReDrawSubWindow:
-	wsPostRedisplay( &appMPlayer.subWindow );
-	break;
    case guiSetDemuxer:
 	guiIntfStruct.demuxer=(void *)arg;
 	break;
@@ -500,8 +500,6 @@
 		  if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break;
 		vcd_seek_to_track( stream->fd,vcd_track );
 		guiIntfStruct.VCDTracks=--i;
-		mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] vcd tracks: %d\n",guiIntfStruct.VCDTracks );
-		guiIntfStruct.Track=vcd_track;
 	        break;
 	       }
 #endif
@@ -554,12 +552,6 @@
 	if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
 	 else btnSet( evSetMoviePosition,btnReleased );
 	 
-	if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
-	 else stream_cache_size=-1;
-
-	if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
-	 else autosync=0;
-
 // -- audio
         if ( audio_out )
 	{
@@ -604,14 +596,42 @@
 #endif
 	break;
    case guiSetDefaults:
-	if ( filename && !guiIntfStruct.Filename )
-	 {
-	  gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE;
-	  guiSetFilename( guiIntfStruct.Filename,filename );
+        if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
+         {
+          audio_id=-1;
+	  video_id=-1;
+	  dvdsub_id=-1;
+	  vobsub_id=-1;
+          stream_cache_size=-1;
+	  autosync=0;
+	  vcd_track=0;
+	  dvd_title=0;
+	 }				
+	wsPostRedisplay( &appMPlayer.subWindow );
+	break;
+   case guiSetParameters:
+        switch ( guiIntfStruct.StreamType ) 
+         {
+	  case STREAMTYPE_PLAYLIST:
+	       break;
+#ifdef HAVE_VCD
+	  case STREAMTYPE_VCD:
+	       vcd_track=guiIntfStruct.Track;
+	       break;
+#endif
+#ifdef USE_DVDREAD
+ 	  case STREAMTYPE_DVD:
+	       dvd_title=guiIntfStruct.Title;
+	       dvd_chapter=guiIntfStruct.Chapter;
+	       dvd_angle=guiIntfStruct.Angle;
+	       break;
+#endif
 	 }
-
-       guiIntfStruct.DiskChanged=0;
-
+	if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST )
+	 {	
+	  if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
+	   else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
+	 }
 // --- video opts
        
        if ( !video_driver_list )
@@ -674,7 +694,7 @@
 	mixer_device=gtkAOOSSMixer;
 	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
 	 {
-	  char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
+	  char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
 	  sprintf( tmp,"oss:%s",gtkAOOSSDevice );
 	  gaddlist( &audio_driver_list,tmp );
 	 }
@@ -692,9 +712,19 @@
 #endif
 
 // --- misc		    
+	if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
+	 else stream_cache_size=-1;
+
+	if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
+	 else autosync=0;
+
         if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile;
 	  else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL;
 	
+        guiIntfStruct.DiskChanged=0;
+        guiIntfStruct.FilenameChanged=0;
+        guiIntfStruct.NewPlay=0;
+
 	break;
   }
  return False;
--- a/Gui/interface.h	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/interface.h	Wed Dec 11 01:21:12 2002 +0000
@@ -63,9 +63,13 @@
    void * event_struct;
 
    int    DiskChanged;
+   int    NewPlay;
 
 #ifdef USE_DVDREAD
    guiDVDStruct         DVD;
+   int			Title;
+   int			Angle;
+   int			Chapter;
 #endif
 
 #ifdef HAVE_VCD
@@ -125,6 +129,7 @@
 #define guiSetValues	    13
 #define guiSetFileFormat    14
 #define guiSetDemuxer       15
+#define guiSetParameters    16
 
 #define guiSetStop  0
 #define guiSetPlay  1
--- a/Gui/mplayer/gtk/menu.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/mplayer/gtk/menu.c	Wed Dec 11 01:21:12 2002 +0000
@@ -379,14 +379,15 @@
     DVDAudioLanguageMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_AudioLanguages );
      if ( guiIntfStruct.DVD.nr_of_audio_channels )
       {
-       char tmp[64]; int i;
+       char tmp[64]; int i, id = audio_id;
        for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ )
         {
 	 snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ),
 	   ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ],
 	   ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] );
+	 if ( id == -1 ) id=guiIntfStruct.DVD.audio_streams[i].id;
          AddMenuCheckItem( DVDAudioLanguageMenu,tmp,
-			   audio_id == guiIntfStruct.DVD.audio_streams[i].id,
+			   id == guiIntfStruct.DVD.audio_streams[i].id,
 			   ( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
         }
       }
@@ -424,7 +425,7 @@
     AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
    }
 
-  if ( guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
+  if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
    {
     int i,c = 0;
 
--- a/Gui/mplayer/mw.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/mplayer/mw.c	Wed Dec 11 01:21:12 2002 +0000
@@ -252,6 +252,7 @@
 void mplEventHandling( int msg,float param )
 {
  int j;
+ int iparam = (int)param;
 
  switch( msg )
   {
@@ -270,22 +271,20 @@
 	break;
 
    case evSetAudio:
-        if ( !guiIntfStruct.demuxer ) break;
-	audio_id=(int)param;
-	if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
-	guiIntfStruct.FilenameChanged=1;
+        if ( !guiIntfStruct.demuxer || audio_id == iparam ) break;
+	audio_id=iparam;
+	guiIntfStruct.NewPlay=1;
 	break;
 
    case evSetVideo:
-        if ( !guiIntfStruct.demuxer ) break;
-        video_id=(int)param;
-        if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
-        guiIntfStruct.FilenameChanged=1;
-        break;
+        if ( !guiIntfStruct.demuxer || video_id == iparam ) break;
+	video_id=iparam;
+	guiIntfStruct.NewPlay=1;
+	break;
 
 #ifdef HAVE_VCD
    case evSetVCDTrack:
-        guiIntfStruct.Track=(int)param;
+        guiIntfStruct.Track=iparam;
    case evPlayVCD:
  	gtkSet( gtkClearStruct,0,(void *)guiALL );
 	guiIntfStruct.StreamType=STREAMTYPE_VCD;
@@ -299,6 +298,7 @@
 play_dvd_2:
  	gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
         guiIntfStruct.StreamType=STREAMTYPE_DVD;
+	goto play;
 #endif
    case evPlay:
    case evPlaySwitchToPause:
@@ -306,18 +306,11 @@
 
         if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
 
-	vcd_track=0;
-	dvd_title=0;
-
 	if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) )
 	 {
 	  plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
 	  plLastPlayed=next;
-	  guiSetDF( guiIntfStruct.Filename,next->path,next->name );
-	  guiIntfStruct.StreamType=STREAMTYPE_FILE;
-	  guiIntfStruct.FilenameChanged=1;
-	  gfree( (void **)&guiIntfStruct.AudioFile );
-	  gfree( (void **)&guiIntfStruct.Subtitlename );
+	  mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
 	 }
 
         switch ( guiIntfStruct.StreamType )
@@ -335,10 +328,9 @@
 	        {
 		 if ( !guiIntfStruct.Track )
 		  {
-		   if ( guiIntfStruct.VCDTracks == 1 ) guiIntfStruct.Track=1;
-		    else guiIntfStruct.Track=2;
+		   if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2;
+		    else guiIntfStruct.Track=1;
 		  }
-		 vcd_track=guiIntfStruct.Track;
                  guiIntfStruct.DiskChanged=1;
 		}
 	       break;
@@ -350,31 +342,32 @@
 	       mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
 	       if ( guiIntfStruct.Playing != 2 )
 	        {
-	         dvd_title=guiIntfStruct.DVD.current_title;
-	         dvd_angle=guiIntfStruct.DVD.current_angle;
-                 dvd_chapter=guiIntfStruct.DVD.current_chapter;
+		 guiIntfStruct.Title=guiIntfStruct.DVD.current_title;
+		 guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter;
+		 guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle;
                  guiIntfStruct.DiskChanged=1;
 		} 
                break;
 #endif
          }
+	guiIntfStruct.NewPlay=1;
         mplPlay();
         break;
 #ifdef USE_DVDREAD
    case evSetDVDSubtitle:
-        dvdsub_id=(int)param;
+        dvdsub_id=iparam;
         goto play_dvd_2;
         break;
    case evSetDVDAudio:
-        audio_id=(int)param;
+        audio_id=iparam;
         goto play_dvd_2;
         break;
    case evSetDVDChapter:
-        guiIntfStruct.DVD.current_chapter=(int)param;
+        guiIntfStruct.DVD.current_chapter=iparam;
         goto play_dvd_2;
         break;
    case evSetDVDTitle:
-        guiIntfStruct.DVD.current_title=(int)param;
+        guiIntfStruct.DVD.current_title=iparam;
 	guiIntfStruct.DVD.current_chapter=1;
 	guiIntfStruct.DVD.current_angle=1;
         goto play_dvd_2;
@@ -387,7 +380,11 @@
         mplPause();
         break;
 
-   case evStop: guiIntfStruct.Playing=guiSetStop; mplState(); break;
+   case evStop: 
+	guiIntfStruct.Playing=guiSetStop; 
+	mplState(); 
+	guiIntfStruct.NoWindow=False;
+	break;
 
    case evLoadPlay:
         mplMainAutoPlay=1;
@@ -448,7 +445,7 @@
 
 
    case evIconify:
-        switch ( (int)param )
+        switch ( iparam )
          {
           case 0: wsIconify( appMPlayer.mainWindow ); break;
           case 1: wsIconify( appMPlayer.subWindow ); break;
@@ -489,7 +486,7 @@
         break;
 
    case evSetAspect:
-	switch ( (int)param )
+	switch ( iparam )
 	 {
 	  case 2:  movie_aspect=16.0f / 9.0f; break;
 	  case 3:  movie_aspect=4.0f / 3.0f;  break;
@@ -499,10 +496,10 @@
 	 }
 	wsClearWindow( appMPlayer.subWindow );
 #ifdef USE_DVDREAD
-	if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play_dvd_2;
+	if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2;
 	 else 
 #endif
-	 guiIntfStruct.FilenameChanged=1;
+	 guiIntfStruct.NewPlay=1;
 	break;
 
 // --- timer events
--- a/Gui/mplayer/play.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/mplayer/play.c	Wed Dec 11 01:21:12 2002 +0000
@@ -10,6 +10,7 @@
 #include "../wm/ws.h"
 #include "../../config.h"
 #include "../../help_mp.h"
+#include "../../mplayer.h"
 #include "../../libvo/x11_common.h"
 #include "../../input/input.h"
 
@@ -99,7 +100,7 @@
    plLastPlayed=next;
    guiSetDF( guiIntfStruct.Filename,next->path,next->name );
    guiIntfStruct.StreamType=STREAMTYPE_FILE;
-   guiIntfStruct.FilenameChanged=1;
+   guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
    gfree( (void **)&guiIntfStruct.AudioFile );
    gfree( (void **)&guiIntfStruct.Subtitlename );
   } 
@@ -110,6 +111,8 @@
      guiIntfStruct.TimeSec=0;
      guiIntfStruct.Position=0;
      guiIntfStruct.AudioType=0;
+     guiIntfStruct.NoWindow=False;
+
 #ifdef USE_DVDREAD
      guiIntfStruct.DVD.current_title=1;
      guiIntfStruct.DVD.current_chapter=1;
@@ -255,10 +258,10 @@
  if ( !name ) return;
  
  if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
-  else guiSetDF( guiIntfStruct.Filename,dir,name )
+  else guiSetDF( guiIntfStruct.Filename,dir,name );
 
+// filename=guiIntfStruct.Filename;
  guiIntfStruct.StreamType=type;
- guiIntfStruct.FilenameChanged=1;
  gfree( (void **)&guiIntfStruct.AudioFile );
  gfree( (void **)&guiIntfStruct.Subtitlename );
 }
--- a/Gui/skin/skin.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/Gui/skin/skin.c	Wed Dec 11 01:21:12 2002 +0000
@@ -234,7 +234,7 @@
  mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
 
  if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 )
-   { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; }
+   { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
  defList->Items[ defList->NumberOfItems ].pressed=btnReleased;
  if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled;
  defList->Items[ defList->NumberOfItems ].tmp=1;
--- a/mplayer.c	Tue Dec 10 23:10:24 2002 +0000
+++ b/mplayer.c	Wed Dec 11 01:21:12 2002 +0000
@@ -868,8 +868,8 @@
 // =================== GUI idle loop (STOP state) ===========================
 #ifdef HAVE_NEW_GUI
     if ( use_gui ) {
-
-      guiGetEvent( guiReDrawSubWindow,0 );
+      file_format=DEMUXER_TYPE_UNKNOWN;
+      guiGetEvent( guiSetDefaults,0 );
       while ( guiIntfStruct.Playing != 1 )
        {
         mp_cmd_t* cmd;                                                                                   
@@ -878,14 +878,8 @@
 	guiGetEvent( guiReDraw,NULL );
 	if ( (cmd = mp_input_get_cmd(0,0)) != NULL) guiGetEvent( guiIEvent,(char *)cmd->id );
        } 
-
-      guiGetEvent( guiSetDefaults,NULL );
-
-      if ( ( guiIntfStruct.FilenameChanged || !filename )
-//#ifdef USE_DVDREAD
-//           && ( guiIntfStruct.StreamType != STREAMTYPE_DVD )
-//#endif
-       )      
+      guiGetEvent( guiSetParameters,NULL );
+      if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM )
        {
         play_tree_t * entry = play_tree_new();
         play_tree_add_file( entry,guiIntfStruct.Filename );
@@ -905,7 +899,6 @@
 	    filename = play_tree_iter_get_file(playtree_iter,1);
 	   }
          }
-   	guiIntfStruct.FilenameChanged=0;
        } 
     }
 #endif
@@ -951,6 +944,10 @@
   }
   inited_flags|=INITED_STREAM;
 
+#ifdef HAVE_NEW_GUI
+  if ( use_gui ) guiGetEvent( guiSetStream,(char *)stream );
+#endif
+
   if(stream->type == STREAMTYPE_PLAYLIST) {
     play_tree_t* entry;
     // Handle playlist
@@ -1348,8 +1345,6 @@
 #ifdef HAVE_NEW_GUI
    if ( use_gui )
     {
-     guiGetEvent( guiSetStream,(char *)stream );
-     guiGetEvent( guiSetFileName,filename );
      if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels; else guiIntfStruct.AudioType=0;
      if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 );
      guiGetEvent( guiSetFileFormat,(char *)demuxer->file_format );
@@ -2700,12 +2695,11 @@
 	guiGetEvent( guiSetVolume,NULL );
 	if(guiIntfStruct.Playing==0) break; // STOP
 	if(guiIntfStruct.Playing==2) osd_function=OSD_PAUSE;
-        if ( guiIntfStruct.DiskChanged || guiIntfStruct.FilenameChanged ) goto goto_next_file;
+        if ( guiIntfStruct.DiskChanged || guiIntfStruct.NewPlay ) goto goto_next_file;
 #ifdef USE_DVDREAD
         if ( stream->type == STREAMTYPE_DVD )
 	 {
 	  dvd_priv_t * dvdp = stream->priv;
-	  /*guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1;*/
 	  guiIntfStruct.DVD.current_chapter=dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, dvdp->cur_cell)+1;
 	 }
 #endif
--- a/mplayer.h	Tue Dec 10 23:10:24 2002 +0000
+++ b/mplayer.h	Wed Dec 11 01:21:12 2002 +0000
@@ -51,6 +51,7 @@
 extern int audio_id;
 extern int video_id;
 extern int dvdsub_id;
+extern int vobsub_id;
 
 extern void exit_player(char* how);